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

NumberFormatException thrown when executing graph query that returns infinity #3010

Closed
InverseIntegral opened this issue May 31, 2022 · 1 comment · Fixed by #3011
Closed
Labels
Milestone

Comments

@InverseIntegral
Copy link

Expected behavior

I would expect the query to run without any problem.

Actual behavior

An exception is thrown:

Caused by: java.lang.NumberFormatException: For input string: "inf"
	at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
	at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
	at java.base/java.lang.Double.parseDouble(Double.java:543)
	at redis.clients.jedis.graph.ResultSetBuilder.deserializeScalar(ResultSetBuilder.java:259)
	at redis.clients.jedis.graph.ResultSetBuilder.parseRecords(ResultSetBuilder.java:155)
	at redis.clients.jedis.graph.ResultSetBuilder.build(ResultSetBuilder.java:62)
	at redis.clients.jedis.graph.ResultSetBuilder.build(ResultSetBuilder.java:23)
	at redis.clients.jedis.Response.build(Response.java:62)
	at redis.clients.jedis.Response.get(Response.java:38)
	at redis.clients.jedis.TransactionBase.exec(TransactionBase.java:141)
	at redis.clients.jedis.Transaction.exec(Transaction.java:47)

Steps to reproduce:

Run the following to reproduce the exception:

try (Jedis resource = pool.getResource()) {
    try (Transaction transaction = new Transaction(resource)) {
        transaction.graphQuery("db", "RETURN 10^100000");
        transaction.exec();
    }
}

RedisGraph returns inf / -inf which cannot be parsed by Double.parseDouble. Similarly, the same thing happens with NaN values.

Redis / Jedis Configuration

Jedis version: 4.2.3
Redis version: 6.2.6
Java version: 11

@sazzad16
Copy link
Collaborator

@InverseIntegral acknowledged. Thanks for the test, it's really helpful.

@sazzad16 sazzad16 added the bug label May 31, 2022
@sazzad16 sazzad16 added this to the 4.3.0 milestone May 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants