From 6565a22137e3a9f581a71c54cbdd018718875bdb Mon Sep 17 00:00:00 2001 From: SunnyBoy-WYH <48077841+SunnyBoy-WYH@users.noreply.github.com> Date: Sat, 2 Mar 2024 01:23:01 +0800 Subject: [PATCH] fix(server): add tip for gremlin api NPE with empty query (#2467) fix #2426 --- .../main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java index 4373b0f006..110a3ef5b8 100644 --- a/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java +++ b/hugegraph-server/hugegraph-api/src/main/java/org/apache/hugegraph/api/gremlin/GremlinAPI.java @@ -20,6 +20,7 @@ import org.apache.hugegraph.api.filter.CompressInterceptor.Compress; import org.apache.hugegraph.config.HugeConfig; import org.apache.hugegraph.metrics.MetricsUtil; +import org.apache.hugegraph.util.E; import com.codahale.metrics.Histogram; import com.codahale.metrics.annotation.Timed; @@ -77,6 +78,7 @@ public Response get(@Context HugeConfig conf, @Context UriInfo uriInfo) { String auth = headers.getHeaderString(HttpHeaders.AUTHORIZATION); String query = uriInfo.getRequestUri().getRawQuery(); + E.checkArgumentNotNull(query, "The request query can't be empty"); MultivaluedMap params = uriInfo.getQueryParameters(); Response response = this.client().doGetRequest(auth, params); GREMLIN_INPUT_HISTOGRAM.update(query.length());