Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 task done
aroundabout opened this issue Jan 24, 2024 · 1 comment · Fixed by #2467
Closed
1 task done

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

aroundabout opened this issue Jan 24, 2024 · 1 comment · Fixed by #2467
Labels
bug Something isn't working gremlin TinkerPop gremlin rocksdb RocksDB backend

Comments

@aroundabout
Copy link
Contributor

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 aroundabout added the bug Something isn't working label Jan 24, 2024
Copy link

dosubot bot commented Jan 24, 2024

🤖

你好,@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working gremlin TinkerPop gremlin rocksdb RocksDB backend
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant