Skip to content
Snippets Groups Projects
Commit 584289f6 authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- bugfix, new fixity value should only be set in Fixity-object, if

  a) old value is null or
  b) newvalue is equivalent to old value
  otherwise it results in logic error if a copy from operational to
  permanent fails first and will be triggered again
parent a06bd145
No related branches found
No related tags found
No related merge requests found
......@@ -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() );
}
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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment