Skip to content

Commit

Permalink
Fix #2189
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Jan 17, 2019
1 parent 1f437f2 commit 6ef8665
Show file tree
Hide file tree
Showing 5 changed files with 126 additions and 248 deletions.
4 changes: 4 additions & 0 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -845,3 +845,7 @@ René Kschamer (flawi@github)
Christoph Breitkopf (bokesan@github)
* Reported #2217: Suboptimal memory allocation in `TextNode.getBinaryValue()`
(2.10.0)

Alexander Saites (saites@github)
* Reported #2189: `TreeTraversingParser` does not check int bounds
(2.10.0)
2 changes: 2 additions & 0 deletions release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Project: jackson-databind
#2126: `DeserializationContext.instantiationException()` throws `InvalidDefinitionException`
#2153: Add `JsonMapper` to replace generic `ObjectMapper` usage
#2187: Make `JsonNode.toString()` use shared `ObjectMapper` to produce valid json
#2189: `TreeTraversingParser` does not check int bounds
(reported by Alexander S)
#2196: Type safety for `readValue()` with `TypeReference`
(suggested by nguyenfilip@github)
#2204: Add `JsonNode.isEmpty()` as convenience alias
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -273,47 +273,55 @@ public boolean hasTextCharacters() {
/**********************************************************
*/

//public byte getByteValue() throws IOException, JsonParseException
//public byte getByteValue() throws IOException

@Override
public NumberType getNumberType() throws IOException, JsonParseException {
public NumberType getNumberType() throws IOException {
JsonNode n = currentNumericNode();
return (n == null) ? null : n.numberType();
}

@Override
public BigInteger getBigIntegerValue() throws IOException, JsonParseException
public BigInteger getBigIntegerValue() throws IOException
{
return currentNumericNode().bigIntegerValue();
}

@Override
public BigDecimal getDecimalValue() throws IOException, JsonParseException {
public BigDecimal getDecimalValue() throws IOException {
return currentNumericNode().decimalValue();
}

@Override
public double getDoubleValue() throws IOException, JsonParseException {
public double getDoubleValue() throws IOException {
return currentNumericNode().doubleValue();
}

@Override
public float getFloatValue() throws IOException, JsonParseException {
public float getFloatValue() throws IOException {
return (float) currentNumericNode().doubleValue();
}

@Override
public long getLongValue() throws IOException, JsonParseException {
return currentNumericNode().longValue();
public int getIntValue() throws IOException {
final NumericNode node = (NumericNode) currentNumericNode();
if (!node.canConvertToInt()) {
reportOverflowInt();
}
return node.intValue();
}

@Override
public int getIntValue() throws IOException, JsonParseException {
return currentNumericNode().intValue();
public long getLongValue() throws IOException {
final NumericNode node = (NumericNode) currentNumericNode();
if (!node.canConvertToInt()) {
reportOverflowLong();
}
return node.longValue();
}

@Override
public Number getNumberValue() throws IOException, JsonParseException {
public Number getNumberValue() throws IOException {
return currentNumericNode().numberValue();
}

Expand Down

This file was deleted.

Loading

0 comments on commit 6ef8665

Please sign in to comment.