diff --git a/src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java b/src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java index 601a4809ddb..6d4fbec731b 100644 --- a/src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java +++ b/src/main/java/edu/harvard/iq/dataverse/EditDatafilesPage.java @@ -1263,11 +1263,11 @@ public String save() { workingVersion = dataset.getEditVersion(); logger.fine("working version id: "+workingVersion.getId()); - + if(systemConfig.isProvCollectionEnabled()) { try { - provPopupFragmentBean.saveStagedProvJson(false); - + //If datasetUpdateRequired did not trigger save the prov code will need to save its staged changes. + provPopupFragmentBean.saveStagedProvJson(!datasetUpdateRequired); } catch (AbstractApiBean.WrappedResponse ex) { JsfHelper.addErrorMessage(getBundleString("file.metadataTab.provenance.error")); Logger.getLogger(EditDatafilesPage.class.getName()).log(Level.SEVERE, null, ex); diff --git a/src/main/java/edu/harvard/iq/dataverse/ProvPopupFragmentBean.java b/src/main/java/edu/harvard/iq/dataverse/ProvPopupFragmentBean.java index c4c9eba2386..529fa14d257 100644 --- a/src/main/java/edu/harvard/iq/dataverse/ProvPopupFragmentBean.java +++ b/src/main/java/edu/harvard/iq/dataverse/ProvPopupFragmentBean.java @@ -265,7 +265,7 @@ public void saveStagedProvJson(boolean saveContext) throws AbstractApiBean.Wrapp df = execCommand(new PersistProvJsonCommand(dvRequestService.getDataverseRequest(), df, provString, df.getProvEntityName(), saveContext)); } mapEntry.dataFile = df; - provenanceUpdates.put(mapEntry.dataFile.getChecksumValue(), mapEntry); //MAD: Modifying the set as we go through it is probably causing errors + provenanceUpdates.put(mapEntry.dataFile.getChecksumValue(), mapEntry); //Updates the datafile to the latest. } }