Skip to content
Snippets Groups Projects
Commit bc1460d5 authored by Jens Steidl's avatar Jens Steidl :baby_chick:
Browse files

- fixed NPE (Cannot invoke "String.length()" because "<local5>" is null) in...

- fixed NPE (Cannot invoke "String.length()" because "<local5>" is null) in String comparison to tackle underlying issue
parent fad45dca
No related branches found
No related tags found
No related merge requests found
...@@ -176,7 +176,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -176,7 +176,7 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
*/ */
private boolean checkFixityByPlugin(Fixity fixity, String storedEntityIdentifier, boolean isRelativePath, boolean result) throws Exception { private boolean checkFixityByPlugin(Fixity fixity, String storedEntityIdentifier, boolean isRelativePath, boolean result) throws Exception {
log.info("SLUBStoragePlugin.checkFixityByPlugin() another fixity"); log.info("SLUBStoragePlugin.checkFixityByPlugin() another fixity");
String pluginname; String pluginname = "";
  • Den Sinn verstehe ich nicht... du behandelst unten Null-Pointer, dann braucht es keine (überflüssige) Initialisierung

  • Author Owner

    Sonst Compiler Error (JDK17) bei Prüfung auf null

    java/org/slub/rosetta/dps/repository/plugin/storage/nfs/SLUBStoragePlugin.java:193: error: variable pluginname might not have been initialized
                if (pluginname == null || pluginname.length() == 0) {
                    ^
    1 error
  • Please register or sign in to reply
try { try {
pluginname = fixity.getPluginName(); pluginname = fixity.getPluginName();
log.info("SLUBStoragePlugin.checkFixityByPlugin() pluginname=" + pluginname); log.info("SLUBStoragePlugin.checkFixityByPlugin() pluginname=" + pluginname);
...@@ -185,9 +185,11 @@ public class SLUBStoragePlugin extends AbstractStorageHandler { ...@@ -185,9 +185,11 @@ public class SLUBStoragePlugin extends AbstractStorageHandler {
log.warn("SLUBStoragePlugin.checkFixityByPlugin() hard error getting plugin name, " + e.getMessage()); log.warn("SLUBStoragePlugin.checkFixityByPlugin() hard error getting plugin name, " + e.getMessage());
pluginname = ""; pluginname = "";
} }
if (pluginname.length() == 0) { finally {
if (pluginname == null || pluginname.length() == 0) {
log.error("SLUBStoragePlugin failed to get pluginname, because it is empty. Possibly, there is no valid fixity typeused or a CustomFixityPlugin missed"); log.error("SLUBStoragePlugin failed to get pluginname, because it is empty. Possibly, there is no valid fixity typeused or a CustomFixityPlugin missed");
} }
}
String oldValue = ""; String oldValue = "";
try { try {
......
  • Owner

    typo in 190, "typeused"

  • Owner

    189 würde ich trennen in zwei Fehlermessages. Das eine ist ein Nullpointer-, das andere ein leerer String Fehler.

  • Author Owner

    typo Fix in abff43f3

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment