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

- minor fix, string compare using constant first (avoids problems if string is null)

- added log.info about which method is used
parent 07d8d9df
No related branches found
No related tags found
No related merge requests found
...@@ -179,7 +179,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -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 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"); log.warn("SLUBStoragePlugin.checkFixityByPlugin() trying to use fallback table to determine plugin name");
String algorithm = fixity.getAlgorithm(); String algorithm = fixity.getAlgorithm();
if (algorithm.equals("SHA512")) { if ("SHA512".equals(algorithm)) {
pluginname = "CustomFixitySHA512Plugin"; pluginname = "CustomFixitySHA512Plugin";
log.info("SLUBStoragePlugin.checkFixityByPlugin() pluginname=" + pluginname); log.info("SLUBStoragePlugin.checkFixityByPlugin() pluginname=" + pluginname);
} else { } else {
...@@ -295,6 +295,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -295,6 +295,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
is.close(); is.close();
} }
copyStream(storedEntityMetadata, destFilePath); copyStream(storedEntityMetadata, destFilePath);
log.info("SLUBStoragePlugin.storeEntity() try copy (copyStream) was successfull");
} }
else else
{ {
...@@ -307,7 +308,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -307,7 +308,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
try (OutputStream output = java.nio.file.Files.newOutputStream( Paths.get( destFilePath))) try (OutputStream output = java.nio.file.Files.newOutputStream( Paths.get( destFilePath)))
{ {
IOUtil.copy(is, output, default_buffer); 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)) { if (!checkFixity(storedEntityMetadata.getFixities(), storedEntityIdentifier)) {
...@@ -338,19 +339,23 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -338,19 +339,23 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
assert canonicalSrcFile != null; assert canonicalSrcFile != null;
FileUtil.moveFile(canonicalSrcFile, new File(destPath)); FileUtil.moveFile(canonicalSrcFile, new File(destPath));
saveDestPathsTmpFile(iePid, pid, destPath); saveDestPathsTmpFile(iePid, pid, destPath);
log.info("SLUBStoragePlugin.copyStream(), move was successful");
} }
else if ("soft_link".equalsIgnoreCase(filesHandlingMethod)) else if ("soft_link".equalsIgnoreCase(filesHandlingMethod))
{ {
softLink(srcPath, destPath); softLink(srcPath, destPath);
log.info("SLUBStoragePlugin.copyStream(), softlink was successful");
} }
else if ("hard_link".equalsIgnoreCase(filesHandlingMethod)) else if ("hard_link".equalsIgnoreCase(filesHandlingMethod))
{ {
hardLink(srcPath, destPath); hardLink(srcPath, destPath);
log.info("SLUBStoragePlugin.copyStream(), hardlink was successful");
} }
else else
{ {
FileUtil.copyFile(srcPath, destPath); FileUtil.copyFile(srcPath, destPath);
saveDestPathsTmpFile(iePid, pid, destPath); saveDestPathsTmpFile(iePid, pid, destPath);
log.info("SLUBStoragePlugin.copyStream(), copyFile was successful");
} }
} }
protected String getFilePathInDescIfExists(StoredEntityMetaData storedEntityMetadata) protected String getFilePathInDescIfExists(StoredEntityMetaData storedEntityMetadata)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment