This is an automated email from the ASF dual-hosted git repository.
vgalaxies pushed a commit to branch pd-store
in repository https://gitbox.apache.org/repos/asf/incubator-hugegraph.git
The following commit(s) were added to refs/heads/pd-store by this push:
new 6565a2213 fix(server): add tip for gremlin api NPE with empty query
(#2467)
6565a2213 is described below
commit 6565a22137e3a9f581a71c54cbdd018718875bdb
Author: SunnyBoy-WYH <[email protected]>
AuthorDate: Sat Mar 2 01:23:01 2024 +0800
fix(server): add tip for gremlin api NPE with empty query (#2467)
fix #2426
---
.../src/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 4373b0f00..110a3ef5b 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 @@ package org.apache.hugegraph.api.gremlin;
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 class GremlinAPI extends GremlinQueryAPI {
@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<String, String> params = uriInfo.getQueryParameters();
Response response = this.client().doGetRequest(auth, params);
GREMLIN_INPUT_HISTOGRAM.update(query.length());