diff --git a/java/org/slub/rosetta/dps/repository/plugin/storage/nfs/SLUBStoragePlugin.java b/java/org/slub/rosetta/dps/repository/plugin/storage/nfs/SLUBStoragePlugin.java index 9c0c45ef97b41c465bff9f2637304e6dec56ebeb..7e29eed7d73668b2432898213acaf22beb438e06 100644 --- a/java/org/slub/rosetta/dps/repository/plugin/storage/nfs/SLUBStoragePlugin.java +++ b/java/org/slub/rosetta/dps/repository/plugin/storage/nfs/SLUBStoragePlugin.java @@ -326,12 +326,17 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { contractAssertIsRelativePath(storedEntityIdentifier); InputStream is = retrieveEntity(storedEntityIdentifier); Checksummer checksummer = new Checksummer(is, true, true, true, true); - fixity.setValue(checksummer.getChecksum(algorithm)); - var newValue = fixity.getValue(); - //log.debug("SLUBStoragePlugin.checkFixityByBuiltin() newvalue=" + newValue); - fixity.setResult((oldValue == null) || (oldValue.equalsIgnoreCase(newValue))); - boolean result = fixity.getResult(); is.close(); + String newValue = checksummer.getChecksum(algorithm); + boolean result = (oldValue == null) || (oldValue.equals(newValue)); + if (result) { + /* only if no old value or newvalue = oldvalue set new value, + * this prevents errors in output logic if a copy from operational to + * permanent fails first and will be triggered again. + */ + fixity.setValue(newValue); + } + fixity.setResult(result); long endtime = System.currentTimeMillis(); log.info("SLUBStoragePlugin.checkFixityByBuiltin(), end checksum calc for pathname='" + absolute_storedEntityIdentifier.filestring() + "'" + " algorithm=" + algorithm @@ -387,12 +392,18 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { } catch (Exception e) { log.error("SLUBStoragePlugin.checkFixityByPlugin() exception in getChecksumUsingPlugin("+absolute_storedEntityIdentifier.filestring() + ", "+ pluginname + ", " + oldValue +"), " + e.getMessage() ); } - fixity.setValue(newValue); + boolean result = (oldValue == null) || (oldValue.equals(newValue)); + if (result) { + /* only if no old value or newvalue = oldvalue set new value, + * this prevents errors in output logic if a copy from operational to + * permanent fails first and will be triggered again. + */ + fixity.setValue(newValue); + } + fixity.setResult(result); /* HINT: if plugin name is still empty a java.lang.NullPointerException gets thrown Rosetta will handle it and let us know (creates technical issue in workbench) */ - fixity.setResult((oldValue == null) || (oldValue.equals(newValue))); - boolean result = fixity.getResult(); long endtime = System.currentTimeMillis(); log.info("SLUBStoragePlugin.checkFixityByPlugin(), end checksum calc for pathname='" + absolute_storedEntityIdentifier.filestring() + "'" + " plugin=" + pluginname