From 290a6426701ad0610d8caf8baa776a68ae559c0a Mon Sep 17 00:00:00 2001
From: Andreas Romeyke <andreas.romeyke@slub-dresden.de>
Date: Mon, 27 Oct 2014 12:35:03 +0000
Subject: [PATCH] - added more debugging info to track a nullpointer error in
 code copied from NFSStorage Plugin

---
 PLUGIN-INF/metadata_SLUBStoragepPlugin.xml       |  4 ++--
 .../plugin/storage/nfs/SLUBStoragePlugin.java    | 16 ++++++++++++++++
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/PLUGIN-INF/metadata_SLUBStoragepPlugin.xml b/PLUGIN-INF/metadata_SLUBStoragepPlugin.xml
index 9a31a9d..d93cf6b 100644
--- a/PLUGIN-INF/metadata_SLUBStoragepPlugin.xml
+++ b/PLUGIN-INF/metadata_SLUBStoragepPlugin.xml
@@ -6,7 +6,7 @@
 		<fr:x_form xmlns:fr="http://com/exlibris/digitool/common/forms/xmlbeans">
 			<form_name>SLUBStoragePlugin_Params</form_name>
 			<description>SLUBTreeStoragePlugin_parameters_form</description>
-			<version>0.2</version>
+			<version>1.0</version>
 			<grid_x>1</grid_x>
 			<md_format>1</md_format>
 			<x_fields>
@@ -70,7 +70,7 @@
 		</fr:x_form>
 	</pl:initParameters>
 	<pl:description>SLUB Storage Plugin</pl:description>
-	<pl:version>2.5</pl:version>
+	<pl:version>2.801</pl:version>
 	<pl:materialType>DIGITAL</pl:materialType>
 	<pl:module>Repository</pl:module>
 	<pl:generalType>TASK</pl:generalType>
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 ced4917..57944b6 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
@@ -91,26 +91,35 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
                 fixity.setResult(null);
                 if (Fixity.FixityAlgorithm.MD5.toString().equals(fixity.getAlgorithm()))
                 {
+                    log.info("SLUBStoragePlugin.checkFixity() calcMD5=true");
                     calcMD5 = true;
                 }
                 else if (Fixity.FixityAlgorithm.SHA1.toString().equals(fixity.getAlgorithm()))
                 {
+                    log.info("SLUBStoragePlugin.checkFixity() calcSHA1=true");
                     calcSHA1 = true;
                 }
                 else if (Fixity.FixityAlgorithm.CRC32.toString().equals(fixity.getAlgorithm()))
                 {
+                    log.info("SLUBStoragePlugin.checkFixity() calcCRC32=true");
                     calcCRC32 = true;
                 }
                 else
                 {
+                    log.info("SLUBStoragePlugin.checkFixity() another fixity");
+                    log.info("SLUBStoragePlugin.checkFixity() pluginname=" + fixity.getPluginName());
                     String oldValue = fixity.getValue();
+                    log.info("SLUBStoragePlugin.checkFixity() oldvalue=" + oldValue);
                     fixity.setValue(getChecksumUsingPlugin(isRelativePath ? getLocalFilePath(storedEntityIdentifier) : storedEntityIdentifier, fixity.getPluginName(), oldValue));
                     fixity.setResult(Boolean.valueOf((oldValue == null) || (oldValue.equals(fixity.getValue()))));
+                    log.info("SLUBStoragePlugin.checkFixity() newvalue=" + fixity.getValue());
                     result &= fixity.getResult().booleanValue();
+                    log.info("SLUBStoragePlugin.checkFixity() result=" + result);
                 }
             }
             if ((calcMD5) || (calcSHA1) || (calcCRC32))
             {
+                log.info("SLUBStoragePlugin.checkFixity() calcMD5|calcSHA1|calcCRC32=true");
                 InputStream is = null;
                 try
                 {
@@ -121,16 +130,23 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
                         int checksummerAlgorithmIndex = getChecksummerAlgorithmIndex(fixity.getAlgorithm());
                         if (checksummerAlgorithmIndex != -1)
                         {
+                            log.info("SLUBStoragePlugin.checkFixity() checksummerAlgorithmIndex=" + checksummerAlgorithmIndex);
                             String oldValue = fixity.getValue();
+                            log.info("SLUBStoragePlugin.checkFixity() getAlgorithm=" + fixity.getAlgorithm());
+                            log.info("SLUBStoragePlugin.checkFixity() oldvalue=" + oldValue);
                             fixity.setValue(checksummer.getChecksum(fixity.getAlgorithm()));
+                            log.info("SLUBStoragePlugin.checkFixity() newvalue=" + fixity.getValue());
                             fixity.setResult(Boolean.valueOf((oldValue == null) || (oldValue.equalsIgnoreCase(fixity.getValue()))));
                             result &= fixity.getResult().booleanValue();
+                            log.info("SLUBStoragePlugin.checkFixity() result=" + result);
                         }
                     }
                 }
                 finally
                 {
+                    log.info("SLUBStoragePlugin.checkFixity() finally called");
                     if (is != null) {
+                      log.info("SLUBStoragePlugin.checkFixity()is closed");
                         is.close();
                     }
                 }
-- 
GitLab