You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hugegraph.apache.org by ji...@apache.org on 2022/11/09 10:25:21 UTC

[incubator-hugegraph] 18/33: fix server id/role NPE in initServerInfo when truncate temp graph (#28)

This is an automated email from the ASF dual-hosted git repository.

jin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git

commit 7ef0305da7a295d700a59603d746723c619fd6f6
Author: Jermy Li <li...@baidu.com>
AuthorDate: Mon Aug 3 11:00:33 2020 +0800

    fix server id/role NPE in initServerInfo when truncate temp graph (#28)
    
    Change-Id: Iedbafa9a31ed3f5b3fb35ccb0c583ec0a0cfc6ac
---
 .../hugegraph/job/algorithm/AbstractAlgorithm.java | 89 +++++-----------------
 .../job/algorithm/SubgraphStatAlgorithm.java       | 13 +++-
 .../job/algorithm/comm/AbstractCommAlgorithm.java  | 10 ++-
 .../job/algorithm/comm/KCoreAlgorithm.java         |  5 +-
 .../job/algorithm/comm/LouvainAlgorithm.java       |  5 +-
 .../job/algorithm/path/RingsDetectAlgorithm.java   |  3 +-
 .../similarity/FusiformSimilarityAlgorithm.java    | 16 ++--
 7 files changed, 53 insertions(+), 88 deletions(-)

diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/AbstractAlgorithm.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/AbstractAlgorithm.java
index cc245f6f9..0d9c79a9f 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/AbstractAlgorithm.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/AbstractAlgorithm.java
@@ -55,6 +55,7 @@ import com.baidu.hugegraph.util.Bytes;
 import com.baidu.hugegraph.util.CollectionUtil;
 import com.baidu.hugegraph.util.E;
 import com.baidu.hugegraph.util.JsonUtil;
+import com.baidu.hugegraph.util.ParameterUtil;
 
 import jersey.repackaged.com.google.common.base.Objects;
 
@@ -114,7 +115,7 @@ public abstract class AbstractAlgorithm implements Algorithm {
     }
 
     protected static int depth(Map<String, Object> parameters) {
-        int depth = parameterInt(parameters, KEY_DEPTH);
+        int depth = ParameterUtil.parameterInt(parameters, KEY_DEPTH);
         E.checkArgument(depth > 0,
                         "The value of %s must be > 0, but got %s",
                         KEY_DEPTH, depth);
@@ -125,14 +126,14 @@ public abstract class AbstractAlgorithm implements Algorithm {
         if (!parameters.containsKey(KEY_LABEL)) {
             return null;
         }
-        return parameterString(parameters, KEY_LABEL);
+        return ParameterUtil.parameterString(parameters, KEY_LABEL);
     }
 
     protected static Directions direction(Map<String, Object> parameters) {
         if (!parameters.containsKey(KEY_DIRECTION)) {
             return Directions.BOTH;
         }
-        Object direction = parameter(parameters, KEY_DIRECTION);
+        Object direction = ParameterUtil.parameter(parameters, KEY_DIRECTION);
         return parseDirection(direction);
     }
 
@@ -140,7 +141,7 @@ public abstract class AbstractAlgorithm implements Algorithm {
         if (!parameters.containsKey(KEY_DIRECTION)) {
             return Directions.OUT;
         }
-        Object direction = parameter(parameters, KEY_DIRECTION);
+        Object direction = ParameterUtil.parameter(parameters, KEY_DIRECTION);
         return parseDirection(direction);
     }
 
@@ -148,7 +149,7 @@ public abstract class AbstractAlgorithm implements Algorithm {
         if (!parameters.containsKey(KEY_DIRECTION)) {
             return Directions.OUT;
         }
-        Object direction = parameter(parameters, KEY_DIRECTION);
+        Object direction = ParameterUtil.parameter(parameters, KEY_DIRECTION);
         Directions dir = parseDirection(direction);
         E.checkArgument(dir == Directions.OUT || dir == Directions.IN,
                         "The value of %s must be either OUT or IN, but got: %s",
@@ -160,7 +161,7 @@ public abstract class AbstractAlgorithm implements Algorithm {
         if (!parameters.containsKey(KEY_ALPHA)) {
             return DEFAULT_ALPHA;
         }
-        double alpha = parameterDouble(parameters, KEY_ALPHA);
+        double alpha = ParameterUtil.parameterDouble(parameters, KEY_ALPHA);
         E.checkArgument(alpha > 0.0 && alpha <= 1.0,
                         "The value of %s must be in range (0, 1], but got %s",
                         KEY_ALPHA, alpha);
@@ -171,7 +172,7 @@ public abstract class AbstractAlgorithm implements Algorithm {
         if (!parameters.containsKey(KEY_TOP)) {
             return 0L;
         }
-        long top = parameterLong(parameters, KEY_TOP);
+        long top = ParameterUtil.parameterLong(parameters, KEY_TOP);
         HugeTraverser.checkNonNegativeOrNoLimit(top, KEY_TOP);
         return top;
     }
@@ -180,7 +181,7 @@ public abstract class AbstractAlgorithm implements Algorithm {
         if (!parameters.containsKey(KEY_DEGREE)) {
             return DEFAULT_DEGREE;
         }
-        long degree = parameterLong(parameters, KEY_DEGREE);
+        long degree = ParameterUtil.parameterLong(parameters, KEY_DEGREE);
         HugeTraverser.checkDegree(degree);
         return degree;
     }
@@ -189,7 +190,7 @@ public abstract class AbstractAlgorithm implements Algorithm {
         if (!parameters.containsKey(KEY_CAPACITY)) {
             return DEFAULT_CAPACITY;
         }
-        long capacity = parameterLong(parameters, KEY_CAPACITY);
+        long capacity = ParameterUtil.parameterLong(parameters, KEY_CAPACITY);
         HugeTraverser.checkCapacity(capacity);
         return capacity;
     }
@@ -198,7 +199,7 @@ public abstract class AbstractAlgorithm implements Algorithm {
         if (!parameters.containsKey(KEY_LIMIT)) {
             return DEFAULT_LIMIT;
         }
-        long limit = parameterLong(parameters, KEY_LIMIT);
+        long limit = ParameterUtil.parameterLong(parameters, KEY_LIMIT);
         HugeTraverser.checkLimit(limit);
         return limit;
     }
@@ -207,7 +208,7 @@ public abstract class AbstractAlgorithm implements Algorithm {
         if (!parameters.containsKey(KEY_EACH_LIMIT)) {
             return DEFAULT_EACH_LIMIT;
         }
-        long limit = parameterLong(parameters, KEY_EACH_LIMIT);
+        long limit = ParameterUtil.parameterLong(parameters, KEY_EACH_LIMIT);
         HugeTraverser.checkPositiveOrNoLimit(limit, KEY_EACH_LIMIT);
         return limit;
     }
@@ -216,7 +217,7 @@ public abstract class AbstractAlgorithm implements Algorithm {
         if (!parameters.containsKey(KEY_SAMPLE)) {
             return DEFAULT_SAMPLE;
         }
-        long sample = parameterLong(parameters, KEY_SAMPLE);
+        long sample = ParameterUtil.parameterLong(parameters, KEY_SAMPLE);
         HugeTraverser.checkPositiveOrNoLimit(sample, KEY_SAMPLE);
         return sample;
     }
@@ -225,7 +226,8 @@ public abstract class AbstractAlgorithm implements Algorithm {
         if (!parameters.containsKey(KEY_SOURCE_SAMPLE)) {
             return HugeTraverser.NO_LIMIT;
         }
-        long sample = parameterLong(parameters, KEY_SOURCE_SAMPLE);
+        long sample = ParameterUtil.parameterLong(parameters,
+                                                  KEY_SOURCE_SAMPLE);
         HugeTraverser.checkPositiveOrNoLimit(sample, KEY_SOURCE_SAMPLE);
         return sample;
     }
@@ -234,79 +236,26 @@ public abstract class AbstractAlgorithm implements Algorithm {
         if (!parameters.containsKey(KEY_SOURCE_LABEL)) {
             return null;
         }
-        return parameterString(parameters, KEY_SOURCE_LABEL);
+        return ParameterUtil.parameterString(parameters, KEY_SOURCE_LABEL);
     }
 
     protected static String sourceCLabel(Map<String, Object> parameters) {
         if (!parameters.containsKey(KEY_SOURCE_CLABEL)) {
             return null;
         }
-        return parameterString(parameters, KEY_SOURCE_CLABEL);
+        return ParameterUtil.parameterString(parameters, KEY_SOURCE_CLABEL);
     }
 
     protected static int workers(Map<String, Object> parameters) {
         if (!parameters.containsKey(KEY_WORKERS)) {
             return -1;
         }
-        int workers = parameterInt(parameters, KEY_WORKERS);
+        int workers = ParameterUtil.parameterInt(parameters, KEY_WORKERS);
         HugeTraverser.checkNonNegativeOrNoLimit(workers, KEY_WORKERS);
         return workers;
     }
 
-    public static Object parameter(Map<String, Object> parameters, String key) {
-        Object value = parameters.get(key);
-        E.checkArgument(value != null,
-                        "Expect '%s' in parameters: %s",
-                        key, parameters);
-        return value;
-    }
-
-    public static String parameterString(Map<String, Object> parameters,
-                                         String key) {
-        Object value = parameter(parameters, key);
-        E.checkArgument(value instanceof String,
-                        "Expect string value for parameter '%s': '%s'",
-                        key, value);
-        return (String) value;
-    }
-
-    public static int parameterInt(Map<String, Object> parameters,
-                                   String key) {
-        Object value = parameter(parameters, key);
-        E.checkArgument(value instanceof Number,
-                        "Expect int value for parameter '%s': '%s'",
-                        key, value);
-        return ((Number) value).intValue();
-    }
-
-    public static long parameterLong(Map<String, Object> parameters,
-                                     String key) {
-        Object value = parameter(parameters, key);
-        E.checkArgument(value instanceof Number,
-                        "Expect long value for parameter '%s': '%s'",
-                        key, value);
-        return ((Number) value).longValue();
-    }
-
-    public static double parameterDouble(Map<String, Object> parameters,
-                                         String key) {
-        Object value = parameter(parameters, key);
-        E.checkArgument(value instanceof Number,
-                        "Expect double value for parameter '%s': '%s'",
-                        key, value);
-        return ((Number) value).doubleValue();
-    }
-
-    public static boolean parameterBoolean(Map<String, Object> parameters,
-                                           String key) {
-        Object value = parameter(parameters, key);
-        E.checkArgument(value instanceof Boolean,
-                        "Expect boolean value for parameter '%s': '%s'",
-                        key, value);
-        return ((Boolean) value);
-    }
-
-    public static Directions parseDirection(Object direction) {
+    protected static Directions parseDirection(Object direction) {
         if (direction.equals(Directions.BOTH.toString())) {
             return Directions.BOTH;
         } else if (direction.equals(Directions.OUT.toString())) {
diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/SubgraphStatAlgorithm.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/SubgraphStatAlgorithm.java
index a098a8582..bf3509734 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/SubgraphStatAlgorithm.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/SubgraphStatAlgorithm.java
@@ -46,6 +46,7 @@ import com.baidu.hugegraph.traversal.optimize.HugeScriptTraversal;
 import com.baidu.hugegraph.util.E;
 import com.baidu.hugegraph.util.InsertionOrderUtil;
 import com.baidu.hugegraph.util.Log;
+import com.baidu.hugegraph.util.ParameterUtil;
 import com.google.common.collect.ImmutableMap;
 
 public class SubgraphStatAlgorithm extends AbstractAlgorithm {
@@ -79,7 +80,8 @@ public class SubgraphStatAlgorithm extends AbstractAlgorithm {
             UserJob<Object> tmpJob = new TempJob<>(graph, job, job.task());
             return traverser.subgraphStat(tmpJob);
         } finally {
-            graph.truncateBackend();
+            // Use clearBackend instead of truncateBackend due to no server-id
+            graph.clearBackend();
             try {
                 graph.close();
             } catch (Throwable e) {
@@ -91,10 +93,15 @@ public class SubgraphStatAlgorithm extends AbstractAlgorithm {
 
     private HugeGraph createTempGraph(UserJob<Object> job) {
         Id id = job.task().id();
+        String name = "tmp_" + id;
         PropertiesConfiguration config = new PropertiesConfiguration();
         config.setProperty(CoreOptions.BACKEND.name(), "memory");
-        config.setProperty(CoreOptions.STORE.name(), "tmp_" + id);
+        config.setProperty(CoreOptions.STORE.name(), name);
         config.setDelimiterParsingDisabled(true);
+        /*
+         * NOTE: this temp graph don't need to init backend because no task info
+         * required, also not set started because no task to be scheduled.
+         */
         return new StandardHugeGraph(new HugeConfig(config));
     }
 
@@ -124,7 +131,7 @@ public class SubgraphStatAlgorithm extends AbstractAlgorithm {
         if (!parameters.containsKey(KEY_COPY_SCHEMA)) {
             return false;
         }
-        return parameterBoolean(parameters, KEY_COPY_SCHEMA);
+        return ParameterUtil.parameterBoolean(parameters, KEY_COPY_SCHEMA);
     }
 
     private static class Traverser extends AlgoTraverser {
diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/comm/AbstractCommAlgorithm.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/comm/AbstractCommAlgorithm.java
index 74b884a06..82bba9bc3 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/comm/AbstractCommAlgorithm.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/comm/AbstractCommAlgorithm.java
@@ -24,6 +24,7 @@ import java.util.Map;
 import com.baidu.hugegraph.job.algorithm.AbstractAlgorithm;
 import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
 import com.baidu.hugegraph.util.E;
+import com.baidu.hugegraph.util.ParameterUtil;
 
 public abstract class AbstractCommAlgorithm extends AbstractAlgorithm {
 
@@ -38,7 +39,7 @@ public abstract class AbstractCommAlgorithm extends AbstractAlgorithm {
         if (!parameters.containsKey(KEY_TIMES)) {
             return (int) DEFAULT_TIMES;
         }
-        int times = parameterInt(parameters, KEY_TIMES);
+        int times = ParameterUtil.parameterInt(parameters, KEY_TIMES);
         HugeTraverser.checkPositiveOrNoLimit(times, KEY_TIMES);
         E.checkArgument(times <= MAX_TIMES,
                         "The maximum number of iterations is %s, but got %s",
@@ -50,7 +51,7 @@ public abstract class AbstractCommAlgorithm extends AbstractAlgorithm {
         if (!parameters.containsKey(KEY_STABLE_TIMES)) {
             return (int) DEFAULT_STABLE_TIMES;
         }
-        int times = parameterInt(parameters, KEY_STABLE_TIMES);
+        int times = ParameterUtil.parameterInt(parameters, KEY_STABLE_TIMES);
         HugeTraverser.checkPositiveOrNoLimit(times, KEY_STABLE_TIMES);
         E.checkArgument(times <= MAX_TIMES,
                         "The maximum number of stable iterations is %s, " +
@@ -62,7 +63,8 @@ public abstract class AbstractCommAlgorithm extends AbstractAlgorithm {
         if (!parameters.containsKey(KEY_PRECISION)) {
             return DEFAULT_PRECISION;
         }
-        double precision = parameterDouble(parameters, KEY_PRECISION);
+        double precision = ParameterUtil.parameterDouble(parameters,
+                                                         KEY_PRECISION);
         E.checkArgument(0d < precision && precision < 1d,
                         "The %s parameter must be in range(0,1), but got: %s",
                         KEY_PRECISION, precision);
@@ -73,6 +75,6 @@ public abstract class AbstractCommAlgorithm extends AbstractAlgorithm {
         if (!parameters.containsKey(KEY_SHOW_COMM)) {
             return null;
         }
-        return parameterString(parameters, KEY_SHOW_COMM);
+        return ParameterUtil.parameterString(parameters, KEY_SHOW_COMM);
     }
 }
diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/comm/KCoreAlgorithm.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/comm/KCoreAlgorithm.java
index 508052354..f03db565e 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/comm/KCoreAlgorithm.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/comm/KCoreAlgorithm.java
@@ -40,6 +40,7 @@ import com.baidu.hugegraph.type.define.Directions;
 import com.baidu.hugegraph.util.CollectionUtil;
 import com.baidu.hugegraph.util.E;
 import com.baidu.hugegraph.util.JsonUtil;
+import com.baidu.hugegraph.util.ParameterUtil;
 import com.google.common.collect.ImmutableSet;
 
 public class KCoreAlgorithm extends AbstractCommAlgorithm {
@@ -88,7 +89,7 @@ public class KCoreAlgorithm extends AbstractCommAlgorithm {
         if (!parameters.containsKey(KEY_K)) {
             return DEFAULT_K;
         }
-        int k = parameterInt(parameters, KEY_K);
+        int k = ParameterUtil.parameterInt(parameters, KEY_K);
         E.checkArgument(k > 1, "The k of kcore must be > 1, but got %s", k);
         return k;
     }
@@ -97,7 +98,7 @@ public class KCoreAlgorithm extends AbstractCommAlgorithm {
         if (!parameters.containsKey(KEY_MERGED)) {
             return false;
         }
-        return parameterBoolean(parameters, KEY_MERGED);
+        return ParameterUtil.parameterBoolean(parameters, KEY_MERGED);
     }
 
     private static class Traverser extends AlgoTraverser {
diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/comm/LouvainAlgorithm.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/comm/LouvainAlgorithm.java
index f05f85e56..ab6e0f214 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/comm/LouvainAlgorithm.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/comm/LouvainAlgorithm.java
@@ -23,6 +23,7 @@ import java.util.Map;
 
 import com.baidu.hugegraph.job.UserJob;
 import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
+import com.baidu.hugegraph.util.ParameterUtil;
 
 public class LouvainAlgorithm extends AbstractCommAlgorithm {
 
@@ -82,7 +83,7 @@ public class LouvainAlgorithm extends AbstractCommAlgorithm {
         if (!parameters.containsKey(KEY_CLEAR)) {
             return null;
         }
-        long pass = parameterLong(parameters, KEY_CLEAR);
+        long pass = ParameterUtil.parameterLong(parameters, KEY_CLEAR);
         HugeTraverser.checkNonNegativeOrNoLimit(pass, KEY_CLEAR);
         return pass;
     }
@@ -91,7 +92,7 @@ public class LouvainAlgorithm extends AbstractCommAlgorithm {
         if (!parameters.containsKey(KEY_SHOW_MOD)) {
             return null;
         }
-        long pass = parameterLong(parameters, KEY_SHOW_MOD);
+        long pass = ParameterUtil.parameterLong(parameters, KEY_SHOW_MOD);
         HugeTraverser.checkNonNegative(pass, KEY_SHOW_MOD);
         return pass;
     }
diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/path/RingsDetectAlgorithm.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/path/RingsDetectAlgorithm.java
index d228b70a2..e6c6435c4 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/path/RingsDetectAlgorithm.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/path/RingsDetectAlgorithm.java
@@ -29,6 +29,7 @@ import com.baidu.hugegraph.job.algorithm.Consumers.StopExecution;
 import com.baidu.hugegraph.traversal.algorithm.SubGraphTraverser;
 import com.baidu.hugegraph.type.define.Directions;
 import com.baidu.hugegraph.util.JsonUtil;
+import com.baidu.hugegraph.util.ParameterUtil;
 
 public class RingsDetectAlgorithm extends AbstractAlgorithm {
 
@@ -80,7 +81,7 @@ public class RingsDetectAlgorithm extends AbstractAlgorithm {
         if (!parameters.containsKey(KEY_COUNT_ONLY)) {
             return false;
         }
-        return parameterBoolean(parameters, KEY_COUNT_ONLY);
+        return ParameterUtil.parameterBoolean(parameters, KEY_COUNT_ONLY);
     }
 
     private static class Traverser extends AlgoTraverser {
diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/similarity/FusiformSimilarityAlgorithm.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/similarity/FusiformSimilarityAlgorithm.java
index daf5b09aa..0a1679fcf 100644
--- a/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/similarity/FusiformSimilarityAlgorithm.java
+++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/job/algorithm/similarity/FusiformSimilarityAlgorithm.java
@@ -34,6 +34,7 @@ import com.baidu.hugegraph.traversal.algorithm.FusiformSimilarityTraverser.Simil
 import com.baidu.hugegraph.traversal.algorithm.HugeTraverser;
 import com.baidu.hugegraph.type.define.Directions;
 import com.baidu.hugegraph.util.JsonUtil;
+import com.baidu.hugegraph.util.ParameterUtil;
 
 public class FusiformSimilarityAlgorithm extends AbstractAlgorithm {
 
@@ -100,7 +101,8 @@ public class FusiformSimilarityAlgorithm extends AbstractAlgorithm {
         if (!parameters.containsKey(KEY_MIN_NEIGHBORS)) {
             return DEFAULT_MIN_NEIGHBORS;
         }
-        int minNeighbors = parameterInt(parameters, KEY_MIN_NEIGHBORS);
+        int minNeighbors = ParameterUtil.parameterInt(parameters,
+                                                      KEY_MIN_NEIGHBORS);
         HugeTraverser.checkPositive(minNeighbors, KEY_MIN_NEIGHBORS);
         return minNeighbors;
     }
@@ -109,7 +111,8 @@ public class FusiformSimilarityAlgorithm extends AbstractAlgorithm {
         if (!parameters.containsKey(KEY_MIN_SIMILARS)) {
             return DEFAULT_MIN_SIMILARS;
         }
-        int minSimilars = parameterInt(parameters, KEY_MIN_SIMILARS);
+        int minSimilars = ParameterUtil.parameterInt(parameters,
+                                                     KEY_MIN_SIMILARS);
         HugeTraverser.checkPositive(minSimilars, KEY_MIN_SIMILARS);
         return minSimilars;
     }
@@ -118,7 +121,8 @@ public class FusiformSimilarityAlgorithm extends AbstractAlgorithm {
         if (!parameters.containsKey(KEY_TOP_SIMILARS)) {
             return DEFAULT_TOP_SIMILARS;
         }
-        int minSimilars = parameterInt(parameters, KEY_TOP_SIMILARS);
+        int minSimilars = ParameterUtil.parameterInt(parameters,
+                                                     KEY_TOP_SIMILARS);
         HugeTraverser.checkNonNegative(minSimilars, KEY_TOP_SIMILARS);
         return minSimilars;
     }
@@ -127,14 +131,14 @@ public class FusiformSimilarityAlgorithm extends AbstractAlgorithm {
         if (!parameters.containsKey(KEY_GROUP_PROPERTY)) {
             return null;
         }
-        return parameterString(parameters, KEY_GROUP_PROPERTY);
+        return ParameterUtil.parameterString(parameters, KEY_GROUP_PROPERTY);
     }
 
     protected static int minGroups(Map<String, Object> parameters) {
         if (!parameters.containsKey(KEY_MIN_GROUPS)) {
             return DEFAULT_MIN_GROUPS;
         }
-        int minGroups = parameterInt(parameters, KEY_MIN_GROUPS);
+        int minGroups = ParameterUtil.parameterInt(parameters, KEY_MIN_GROUPS);
         HugeTraverser.checkPositive(minGroups, KEY_MIN_GROUPS);
         return minGroups;
     }
@@ -143,7 +147,7 @@ public class FusiformSimilarityAlgorithm extends AbstractAlgorithm {
         if (!parameters.containsKey(KEY_LIMIT)) {
             return DEFAULT_LIMIT;
         }
-        long limit = parameterLong(parameters, KEY_LIMIT);
+        long limit = ParameterUtil.parameterLong(parameters, KEY_LIMIT);
         HugeTraverser.checkLimit(limit);
         return limit;
     }