fix(server): add tip for gremlin api NPE with empty query (#2467)

fix #2426
This commit is contained in:
SunnyBoy-WYH 2024-03-02 01:23:01 +08:00 committed by VGalaxies
parent a199534b89
commit 6565a22137
1 changed files with 2 additions and 0 deletions

View File

@ -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());