diff --git a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java index a5754fe4ef..3ad6bc58f1 100644 --- a/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java +++ b/hugegraph-api/src/main/java/com/baidu/hugegraph/api/traversers/NeighborRankAPI.java @@ -67,7 +67,7 @@ public String neighborRank(@Context GraphManager manager, "The source of rank request can't be null"); E.checkArgument(request.steps != null && !request.steps.isEmpty(), "The steps of rank request can't be empty"); - E.checkArgument(request.steps.size() <= Long.valueOf(DEFAULT_MAX_DEPTH), + E.checkArgument(request.steps.size() <= Long.parseLong(DEFAULT_MAX_DEPTH), "The steps length of rank request can't exceed %s", DEFAULT_MAX_DEPTH); E.checkArgument(request.alpha > 0 && request.alpha <= 1.0, @@ -107,7 +107,7 @@ private static class RankRequest { @JsonProperty("alpha") private double alpha; @JsonProperty("capacity") - public long capacity = Long.valueOf(DEFAULT_CAPACITY); + public long capacity = Long.parseLong(DEFAULT_CAPACITY); @Override public String toString() { @@ -124,11 +124,11 @@ private static class Step { @JsonProperty("labels") public List labels; @JsonProperty("degree") - public long degree = Long.valueOf(DEFAULT_DEGREE); + public long degree = Long.parseLong(DEFAULT_DEGREE); @JsonProperty("skip_degree") public long skipDegree = 0L; @JsonProperty("top") - public int top = Integer.valueOf(DEFAULT_PATHS_LIMIT); + public int top = Integer.parseInt(DEFAULT_PATHS_LIMIT); public static final int DEFAULT_CAPACITY_PER_LAYER = 100000; diff --git a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java index 2203064bf4..9e0c59248f 100644 --- a/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java +++ b/hugegraph-core/src/main/java/com/baidu/hugegraph/traversal/algorithm/NeighborRankTraverser.java @@ -244,7 +244,9 @@ public Step(HugeGraph g, Directions direction, List labels, long degree, long skipDegree, int top, int capacity) { E.checkArgument(top > 0 && top <= MAX_TOP, "The top of each layer can't exceed %s", MAX_TOP); - + E.checkArgument(capacity > 0, + "The capacity of each layer must be > 0, " + + "but got %s", capacity); this.edgeStep = new EdgeStep(g, direction, labels, null, degree, skipDegree); this.top = top;