diff --git a/core/src/main/java/apoc/cypher/CypherInitializer.java b/core/src/main/java/apoc/cypher/CypherInitializer.java index f65f8ed61c..432f22ce38 100644 --- a/core/src/main/java/apoc/cypher/CypherInitializer.java +++ b/core/src/main/java/apoc/cypher/CypherInitializer.java @@ -19,6 +19,7 @@ import java.util.ConcurrentModificationException; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.TreeMap; public class CypherInitializer implements AvailabilityListener { @@ -91,9 +92,11 @@ public void available() { }).start(); } - // only for testing purpose + // the visibility is public only for testing purpose, it could be private otherwise public static boolean isVersionDifferent(List versions, String apocFullVersion) { - return versions.stream().noneMatch(apocFullVersion::startsWith); + return Optional.ofNullable(apocFullVersion) + .map(v -> versions.stream().noneMatch(v::startsWith)) + .orElse(true); } private Collection collectInitializers(boolean isSystemDatabase, Configuration config) {