Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avoids java.util.ConcurrentModificationException when uploading 100+ … #3021

Merged
merged 1 commit into from
May 17, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -1020,7 +1020,12 @@ public boolean isDuplicate(FileMetadata fileMetadata) {
// more than a certain number of files... Still, needs to be revisited
// before the final 4.0.
// -- L.A. 4.0
Iterator<FileMetadata> fmIt = workingVersion.getFileMetadatas().iterator();

// make a "defensive copy" to avoid java.util.ConcurrentModificationException from being thrown
// when uploading 100+ files
List<FileMetadata> wvCopy = new ArrayList<>(workingVersion.getFileMetadatas());
Iterator<FileMetadata> fmIt = wvCopy.iterator();

while (fmIt.hasNext()) {
FileMetadata fm = fmIt.next();
String md5 = fm.getDataFile().getmd5();
Expand Down Expand Up @@ -1089,7 +1094,7 @@ private InputStream getDropBoxInputStream(String fileLink, GetMethod dropBoxMeth
* Using information from the DropBox choose, ingest the chosen files
* https://www.dropbox.com/developers/dropins/chooser/js
*
* @param e
* @param event
*/
public void handleDropBoxUpload(ActionEvent event) {

Expand Down