Skip to content

Commit

Permalink
JSONWire to parse doubles/ints surrounded by quotes #886
Browse files Browse the repository at this point in the history
  • Loading branch information
peter-lawrey committed Apr 26, 2024
1 parent 1265df3 commit ad493dd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/main/java/net/openhft/chronicle/wire/JSONWire.java
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public double float64() {
if (sep != 0) {
int end = peekBack();
if (end != sep)
throw new IORuntimeException("Expected " + sep + " but was " + end);
throw new IORuntimeException("Expected " + (char) sep + " but was " + (char) end);
} else {
checkRewindDouble();
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/net/openhft/chronicle/wire/TextWire.java
Original file line number Diff line number Diff line change
Expand Up @@ -2815,7 +2815,7 @@ public double float64() {
if (sep != 0) {
int end = peekBack();
if (end != sep)
throw new IORuntimeException("Expected " + sep + " but was " + end);
throw new IORuntimeException("Expected " + (char) sep + " but was " + (char) end);
} else {
checkRewindDouble();
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/java/net/openhft/chronicle/wire/WiresTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void textWireNumberTest() {
Assert.assertTrue(Double.isInfinite(TEXT.apply(Bytes.from("-Infinity")).getValueIn().float64()));

// -0.0 is sent to denote and error
Assert.assertEquals(-0.0, TEXT.apply(Bytes.from("'1.0'")).getValueIn().float64(), 0);
Assert.assertEquals(-0.0, TEXT.apply(Bytes.from("''")).getValueIn().float64(), 0);

// -0.0 is sent to denote and error
Assert.assertEquals(-0.0, TEXT.apply(Bytes.from("Broken")).getValueIn().float64(), 0);
Expand Down

0 comments on commit ad493dd

Please sign in to comment.