Skip to content

Commit

Permalink
Merge branch '2.17'
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Dec 15, 2023
2 parents d0ce656 + b982f07 commit 7f7c868
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1757,7 +1757,10 @@ public int getTextLength() throws JacksonException
|| (_currToken == JsonToken.VALUE_NUMBER_FLOAT)) {
return getNumberValue().toString().length();
}
return _currToken.asCharArray().length;
final char[] ch = _currToken.asCharArray();
if (ch != null) {
return ch.length;
}
}
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,8 @@ public char[] getTextCharacters() throws JacksonException {

@Override
public int getTextLength() throws JacksonException {
return getText().length();
String str = getText();
return (str == null) ? 0 : str.length();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1439,13 +1439,15 @@ public int getTextLength() throws JacksonException
return _textBuffer.size();
case PROPERTY_NAME:
return _streamReadContext.currentName().length();
// fall through
case VALUE_NUMBER_INT:
case VALUE_NUMBER_FLOAT:
return getNumberValue().toString().length();

default:
return _currToken.asCharArray().length;
// fall through
}
final char[] ch = _currToken.asCharArray();
if (ch != null) {
return ch.length;
}
}
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1435,7 +1435,10 @@ public int getTextLength() throws JacksonException
// TODO: optimize
return getNumberValue().toString().length();
}
return _currToken.asCharArray().length;
final char[] ch = _currToken.asCharArray();
if (ch != null) {
return ch.length;
}
}
return 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,11 @@ public int getTextLength() throws JacksonException
case JsonTokenId.ID_NOT_AVAILABLE:
return 0; // or throw exception?
default:
return _currToken.asCharArray().length;
final char[] ch = _currToken.asCharArray();
if (ch != null) {
return ch.length;
}
return 0;
}
}

Expand Down

0 comments on commit 7f7c868

Please sign in to comment.