Skip to content
This repository has been archived by the owner on Feb 16, 2022. It is now read-only.

Commit

Permalink
Fix floating data problem
Browse files Browse the repository at this point in the history
  • Loading branch information
devjeonghwan committed Sep 28, 2021
1 parent 9235590 commit 0769bab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/main/java/com/realtimetech/kson/KsonContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,7 @@ public JsonValue fromString(String kson) throws IOException {
this.stringMaker.add(currentChar);
}
} else if (currentMode == ValueMode.NUMBER) {
if (!(currentChar >= '0' && currentChar <= '9') && currentChar != '-' && currentChar != 'D' && currentChar != 'd' && currentChar != 'F' && currentChar != 'f' && currentChar != 'L' && currentChar != 'l' && currentChar != 'B' && currentChar != 'b' && currentChar != '.') {
if (!(currentChar >= '0' && currentChar <= '9') && currentChar != 'E' && currentChar != 'e' && currentChar != '+' && currentChar != '-' && currentChar != 'D' && currentChar != 'd' && currentChar != 'F' && currentChar != 'f' && currentChar != 'L' && currentChar != 'l' && currentChar != 'B' && currentChar != 'b' && currentChar != '.') {
modeStack.pop();
currentMode = modeStack.peek();

Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/realtimetech/kson/test/TestObject.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ public class TestObject {
private TestEnum enumType1;
private TestEnum enumType2;

private double floating;

private String[] emptyArray;

@Ignore
Expand Down Expand Up @@ -196,6 +198,8 @@ public TestObject(Test test) {
this.intArray = new int[] { 1, 2, 3, 4 };
this.integer = 1;

this.floating = 5.136898340781836E-5;

this.emptyArray = new String[0];
this.stringArray = new String[] { "A", "B", "C" };
this.string = "ABC";
Expand Down

0 comments on commit 0769bab

Please sign in to comment.