From cbc9512c9ac181bcd8a41454bd731548c7f8ed66 Mon Sep 17 00:00:00 2001
From: Andreas Romeyke <andreas.romeyke@slub-dresden.de>
Date: Tue, 24 Jan 2023 13:16:31 +0100
Subject: [PATCH] - minor fix, string compare using constant first (avoids
 problems if string is null) - added log.info about which method is used

---
 .../repository/plugin/storage/nfs/SLUBStoragePlugin.java | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

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 cbe8ec3..46f2a9b 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
@@ -179,7 +179,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
             log.warn("SLUBStoragePlugin failed to get pluginname, because it is empty. Possibly, there is no valid fixity type used or a CustomFixityPlugin missed");
             log.warn("SLUBStoragePlugin.checkFixityByPlugin() trying to use fallback table to determine plugin name");
             String algorithm = fixity.getAlgorithm();
-            if (algorithm.equals("SHA512")) {
+            if ("SHA512".equals(algorithm)) {
                 pluginname = "CustomFixitySHA512Plugin";
                 log.info("SLUBStoragePlugin.checkFixityByPlugin() pluginname=" + pluginname);
             } else {
@@ -295,6 +295,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
                     is.close();
                 }
                 copyStream(storedEntityMetadata, destFilePath);
+                log.info("SLUBStoragePlugin.storeEntity() try copy (copyStream) was successfull");
             }
             else
             {
@@ -307,7 +308,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
                 try (OutputStream output = java.nio.file.Files.newOutputStream( Paths.get( destFilePath)))
                 {
                     IOUtil.copy(is, output, default_buffer);
-                    log.debug("SLUBStoragePlugin.storeEntity() try copy was successfull");
+                    log.info("SLUBStoragePlugin.storeEntity() try copy (IOUtil.copy) was successfull");
                 }
             }
             if (!checkFixity(storedEntityMetadata.getFixities(), storedEntityIdentifier)) {
@@ -338,19 +339,23 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
             assert canonicalSrcFile != null;
             FileUtil.moveFile(canonicalSrcFile, new File(destPath));
             saveDestPathsTmpFile(iePid, pid, destPath);
+            log.info("SLUBStoragePlugin.copyStream(), move was successful");
         }
         else if ("soft_link".equalsIgnoreCase(filesHandlingMethod))
         {
             softLink(srcPath, destPath);
+            log.info("SLUBStoragePlugin.copyStream(), softlink was successful");
         }
         else if ("hard_link".equalsIgnoreCase(filesHandlingMethod))
         {
             hardLink(srcPath, destPath);
+            log.info("SLUBStoragePlugin.copyStream(), hardlink was successful");
         }
         else
         {
             FileUtil.copyFile(srcPath, destPath);
             saveDestPathsTmpFile(iePid, pid, destPath);
+            log.info("SLUBStoragePlugin.copyStream(), copyFile was successful");
         }
     }
     protected String getFilePathInDescIfExists(StoredEntityMetaData storedEntityMetadata)
-- 
GitLab