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 on "inf" zscore #528

Closed
DarkSeraphim opened this issue Apr 29, 2017 · 1 comment
Closed

NumberFormatException on "inf" zscore #528

DarkSeraphim opened this issue Apr 29, 2017 · 1 comment
Labels
type: bug A general bug
Milestone

Comments

@DarkSeraphim
Copy link

DarkSeraphim commented Apr 29, 2017

ScoredValueStreamingOutput does not appear to be handling the 'inf' score (as Java only parses 'Infinity'). This bug occurred on 4.3.1.Final, and appears to exist in later builds as well (unless something rewrites the byte[] internally, but I haven't tested it, so it's all speculation at this point).

stack trace

To reproduce, I suppose all you'd need to do is to add an entry to a sorted set with score Double.POSITIVE_INFINITY, and try to grab it through zrangebyscoreWithScores(ScoredValueStreamingChannel<V>, K, Range<? extends Number> range)

// connection is a StatefulRedisConnection<String, String> field
final String KEY = "foo";
this.connection.sync().zadd(KEY, Double.POSITIVE_INFINITY, "bar");

RedisAsyncCommands<String, String> asyncRedis = this.connection.async();
Range<Double> range = Range.from(Range.Boundary.including((double) System.currentTimeMillis()),
                                 Range.Boundary.including(Double.POSITIVE_INFINITY));
asyncRedis.zrangebyscoreWithScores(entry -> {
    // TODO: fill
}, KEY, range);
@mp911de mp911de added the type: bug A general bug label Apr 29, 2017
@mp911de mp911de added this to the Lettuce 4.3.3 milestone Apr 29, 2017
mp911de added a commit that referenced this issue Apr 29, 2017
Lettuce now parses positive and negative infinite scores correctly. Infinite scores are received as inf and -inf that require appropriate transformation instead of parsing the floating point value.

Previously parsing caused NumberFormatException.
mp911de added a commit that referenced this issue Apr 29, 2017
Lettuce now parses positive and negative infinite scores correctly. Infinite scores are received as inf and -inf that require appropriate transformation instead of parsing the floating point value.

Previously parsing caused NumberFormatException.
mp911de added a commit that referenced this issue Apr 29, 2017
Lettuce now parses positive and negative infinite scores correctly. Infinite scores are received as inf and -inf that require appropriate transformation instead of parsing the floating point value.

Previously parsing caused NumberFormatException.
@mp911de
Copy link
Collaborator

mp911de commented Apr 29, 2017

Thanks a lot for the ticket. It contains exactly the details required to reproduce and fix the issue. The issue is fixed now in the 4.3.3, 4.4 and 5.0 branches.

@mp911de mp911de closed this as completed Apr 29, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants