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

- because the fixity.getAlgorithm() (which was broken in Rosetta4.0 because

results in lowercase instead of uppercase) was used on different parts of code,
the workaround is rewritten to fix all occurences
parent 9390b9b2
Branches
Tags
No related merge requests found
......@@ -70,7 +70,7 @@
</fr:x_form>
</pl:initParameters>
<pl:description>SLUB Storage Plugin</pl:description>
<pl:version>2.803</pl:version>
<pl:version>2.804</pl:version>
<pl:materialType>DIGITAL</pl:materialType>
<pl:module>Repository</pl:module>
<pl:generalType>TASK</pl:generalType>
......
......@@ -93,17 +93,20 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
log.info("SLUBStoragePlugin.checkFixity() FixityAlgorithm.MD5=" + Fixity.FixityAlgorithm.MD5.toString());
log.info("SLUBStoragePlugin.checkFixity() FixityAlgorithm.SHA1=" + Fixity.FixityAlgorithm.SHA1.toString());
log.info("SLUBStoragePlugin.checkFixity() FixityAlgorithm.CRC32=" + Fixity.FixityAlgorithm.CRC32.toString());
if (Fixity.FixityAlgorithm.MD5.toString().toLowerCase().equals(fixity.getAlgorithm().toLowerCase()))
/* TODO: with upcoming versions of Rosetta, recheck need of
* Workaround for fixity.getAlgorithm() */
String algorithm = fixity.getAlgorithm().toUpperCase(); // workaround, because fixity.getAlgorithm() returns lowercase string
if (Fixity.FixityAlgorithm.MD5.toString().equals(algorithm))
{
log.info("SLUBStoragePlugin.checkFixity() calcMD5=true");
calcMD5 = true;
}
else if (Fixity.FixityAlgorithm.SHA1.toString().toLowerCase().equals(fixity.getAlgorithm().toLowerCase()))
else if (Fixity.FixityAlgorithm.SHA1.toString().equals(algorithm))
{
log.info("SLUBStoragePlugin.checkFixity() calcSHA1=true");
calcSHA1 = true;
}
else if (Fixity.FixityAlgorithm.CRC32.toString().toLowerCase().equals(fixity.getAlgorithm().toLowerCase()))
else if (Fixity.FixityAlgorithm.CRC32.toString().equals(algorithm))
{
log.info("SLUBStoragePlugin.checkFixity() calcCRC32=true");
calcCRC32 = true;
......@@ -131,14 +134,17 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
Checksummer checksummer = new Checksummer(is, calcMD5, calcSHA1, calcCRC32);
for (Fixity fixity : fixities)
{
int checksummerAlgorithmIndex = getChecksummerAlgorithmIndex(fixity.getAlgorithm());
/* TODO: with upcoming versions of Rosetta, recheck need of
* Workaround for fixity.getAlgorithm() */
String algorithm = fixity.getAlgorithm().toUpperCase(); // workaround, because fixity.getAlgorithm() returns lowercase string
int checksummerAlgorithmIndex = getChecksummerAlgorithmIndex(algorithm);
if (checksummerAlgorithmIndex != -1)
{
log.info("SLUBStoragePlugin.checkFixity() checksummerAlgorithmIndex=" + checksummerAlgorithmIndex);
String oldValue = fixity.getValue();
log.info("SLUBStoragePlugin.checkFixity() getAlgorithm (2)=" + fixity.getAlgorithm());
log.info("SLUBStoragePlugin.checkFixity() getAlgorithm (2)=" + algorithm);
log.info("SLUBStoragePlugin.checkFixity() oldvalue=" + oldValue);
fixity.setValue(checksummer.getChecksum(fixity.getAlgorithm()));
fixity.setValue(checksummer.getChecksum(algorithm));
log.info("SLUBStoragePlugin.checkFixity() newvalue=" + fixity.getValue());
fixity.setResult(Boolean.valueOf((oldValue == null) || (oldValue.equalsIgnoreCase(fixity.getValue()))));
result &= fixity.getResult().booleanValue();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment