apache / incubator-hugegraph

A graph database that supports more than 100+ billion data, high performance and scalability (Include OLTP Engine & REST-API & Backends)

Home Page:https://hugegraph.apache.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] http://localhost:8080/gremlin have the null pointer error

aroundabout opened this issue · comments

Bug Type (问题类型)

gremlin (结果不合预期)

Before submit

  • 我已经确认现有的 IssuesFAQ 中没有相同 / 重复问题 (I have confirmed and searched that there are no similar problems in the historical issue and documents)

Environment (环境信息)

  • Server Version: 1.2.0 (Apache Release Version)
  • Backend: RocksDB x nodes, HDD or SSD
  • OS: xx CPUs, xx G RAM, Ubuntu 2x.x / CentOS 7.x
  • Data Size: xx vertices, xx edges

Expected & Actual behavior (期望与实际表现)

use the gremline api from apache-hugegraph-incubating-1.2.0.tar.gz
image

It seems we should handle the empty query at:
img_v3_027d_5106ff33-da1d-42f2-8aa1-cb2247730afg

Vertex/Edge example (问题点 / 边数据举例)

No response

Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

No response

🤖

你好,@aroundabout!很高兴再次看到你的反馈。希望你一切都好。

The null pointer error you're encountering when using the gremlin API from the apache-hugegraph-incubating-1.2.0.tar.gz could be due to an empty or null query being passed to the API. The code provided does not seem to handle null or empty queries, which could lead to a null pointer exception.

To handle an empty query and prevent a null pointer exception, you can add a null check before processing the query. Here's an example of how you can do this:

public class GremlinQueryAPI extends API {
    // ...
    public Response executeQuery(String query) {
        if (query == null || query.isEmpty()) {
            throw new IllegalArgumentException("Query cannot be null or empty");
        }
        // Process the query
    }
    // ...
}

In this example, if the query is null or empty, an IllegalArgumentException is thrown. This prevents the null pointer exception from occurring later in the code. You can adjust this to suit your needs, for example by returning a specific error response instead of throwing an exception.

Unfortunately, I wasn't able to find the exact line of code or method in the incubator-hugegraph codebase that is causing the null pointer error when an empty query is passed to the gremlin API. Also, I couldn't find the exact method in the GremlinQueryAPI class that processes the query. It would be helpful if you could provide more information or context about the issue.

For more information, you can refer to the GremlinQueryAPI.java file in the incubator-hugegraph repository.

-Dosu

Sources


This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.