Skip to content

Commit 9101077

Browse files
refactor(client): add null check for graphspace
1 parent 9157220 commit 9101077

File tree

1 file changed

+8
-1
lines changed
  • hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs

1 file changed

+8
-1
lines changed

hugegraph-client/src/main/java/org/apache/hugegraph/api/graphs/GraphsAPI.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,10 @@ public void mode(String graph, GraphMode mode) {
206206
public void mode(String graphSpace, String graph, GraphMode mode) {
207207
// NOTE: Must provide id for PUT. If you use "graph/mode", "/" will
208208
// be encoded to "%2F". So use "mode" here, although inaccurate.
209-
if (graphSpace == null)
209+
if (graphSpace == null) {
210+
mode(graph, mode);
211+
return;
212+
}
210213
this.client.put(joinPath(this.path(), graphSpace, graph, MODE), null, mode);
211214
}
212215

@@ -215,6 +218,10 @@ public void readMode(String graphSpace, String graph, GraphReadMode readMode) {
215218
// NOTE: Must provide id for PUT. If you use "graph/graph_read_mode", "/"
216219
// will be encoded to "%2F". So use "graph_read_mode" here, although
217220
// inaccurate.
221+
if (graphSpace == null) {
222+
readMode(graph, readMode);
223+
return;
224+
}
218225
this.client.put(joinPath(this.path(), graphSpace, graph, GRAPH_READ_MODE), null, readMode);
219226
}
220227

0 commit comments

Comments
 (0)