Skip to content

Commit

Permalink
change getInt semantics
Browse files Browse the repository at this point in the history
  • Loading branch information
Kasper Jeppesen committed May 4, 2017
1 parent 1518d7f commit da1f712
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/main/java/me/doubledutch/lazyjson/LazyNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,9 @@ protected int getIntValue() throws LazyException{
int i=startIndex;
boolean sign=false;
int value=0;
if(type==VALUE_STRING || type==VALUE_ESTRING){
if(type==VALUE_FLOAT){
return (int)getDoubleValue();
}else if(type==VALUE_STRING || type==VALUE_ESTRING){
// Attempt to parse as an int, throw if impossible
if(dirty){
if(dirtyBuf.charAt(i)=='-'){
Expand Down Expand Up @@ -303,7 +305,9 @@ protected long getLongValue() throws LazyException{
int i=startIndex;
boolean sign=false;
long value=0;
if(type==VALUE_STRING || type==VALUE_ESTRING){
if(type==VALUE_FLOAT){
return (long)getDoubleValue();
}else if(type==VALUE_STRING || type==VALUE_ESTRING){
// Attempt to parse as an int, throw if impossible
if(dirty){
if(dirtyBuf.charAt(i)=='-'){
Expand Down
6 changes: 3 additions & 3 deletions src/main/resources/lazyjson_version.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#Wed May 03 14:15:00 PDT 2017
#Wed May 03 16:52:48 PDT 2017
BUILD_VERSION=2.2.1
BUILD_DATE=2017-05-03T21\:15\:00Z
BUILD_NUMBER=993
BUILD_DATE=2017-05-03T23\:52\:48Z
BUILD_NUMBER=1042

0 comments on commit da1f712

Please sign in to comment.