Skip to content

Commit

Permalink
Merge pull request #3021 from bmckinney/feature/2880-file-upload-bug-fix
Browse files Browse the repository at this point in the history
avoids java.util.ConcurrentModificationException when uploading 100+ …
  • Loading branch information
scolapasta committed May 17, 2016
2 parents a30407a + 3b475d5 commit 60fb3d8
Showing 1 changed file with 7 additions and 2 deletions.
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 @@ -1047,7 +1047,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 @@ -1116,7 +1121,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

0 comments on commit 60fb3d8

Please sign in to comment.