Skip to content

Commit 1f76529

Browse files
committed
Fix similar convertNumberToInt/Long() issues for CBORParser as well
1 parent 1aebcb3 commit 1f76529

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

cbor/src/main/java/com/fasterxml/jackson/dataformat/cbor/CBORParser.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,30 +2075,30 @@ protected void convertNumberToInt() throws IOException
20752075
// Let's verify it's lossless conversion by simple roundtrip
20762076
int result = (int) _numberLong;
20772077
if (((long) result) != _numberLong) {
2078-
_reportError("Numeric value ("+getText()+") out of range of int");
2078+
reportOverflowInt(String.valueOf(_numberLong));
20792079
}
20802080
_numberInt = result;
20812081
} else if ((_numTypesValid & NR_BIGINT) != 0) {
20822082
if (BI_MIN_INT.compareTo(_numberBigInt) > 0
20832083
|| BI_MAX_INT.compareTo(_numberBigInt) < 0) {
2084-
reportOverflowInt();
2084+
reportOverflowInt(String.valueOf(_numberBigInt));
20852085
}
20862086
_numberInt = _numberBigInt.intValue();
20872087
} else if ((_numTypesValid & NR_DOUBLE) != 0) {
20882088
// Need to check boundaries
20892089
if (_numberDouble < MIN_INT_D || _numberDouble > MAX_INT_D) {
2090-
reportOverflowInt();
2090+
reportOverflowInt(String.valueOf(_numberDouble));
20912091
}
20922092
_numberInt = (int) _numberDouble;
20932093
} else if ((_numTypesValid & NR_FLOAT) != 0) {
20942094
if (_numberFloat < MIN_INT_D || _numberFloat > MAX_INT_D) {
2095-
reportOverflowInt();
2095+
reportOverflowInt(String.valueOf(_numberFloat));
20962096
}
20972097
_numberInt = (int) _numberFloat;
20982098
} else if ((_numTypesValid & NR_BIGDECIMAL) != 0) {
20992099
if (BD_MIN_INT.compareTo(_numberBigDecimal) > 0
21002100
|| BD_MAX_INT.compareTo(_numberBigDecimal) < 0) {
2101-
reportOverflowInt();
2101+
reportOverflowInt(String.valueOf(_numberBigDecimal));
21022102
}
21032103
_numberInt = _numberBigDecimal.intValue();
21042104
} else {
@@ -2114,23 +2114,23 @@ protected void convertNumberToLong() throws IOException
21142114
} else if ((_numTypesValid & NR_BIGINT) != 0) {
21152115
if (BI_MIN_LONG.compareTo(_numberBigInt) > 0
21162116
|| BI_MAX_LONG.compareTo(_numberBigInt) < 0) {
2117-
reportOverflowLong();
2117+
reportOverflowLong(String.valueOf(_numberBigInt));
21182118
}
21192119
_numberLong = _numberBigInt.longValue();
21202120
} else if ((_numTypesValid & NR_DOUBLE) != 0) {
21212121
if (_numberDouble < MIN_LONG_D || _numberDouble > MAX_LONG_D) {
2122-
reportOverflowLong();
2122+
reportOverflowLong(String.valueOf(_numberDouble));
21232123
}
21242124
_numberLong = (long) _numberDouble;
21252125
} else if ((_numTypesValid & NR_FLOAT) != 0) {
21262126
if (_numberFloat < MIN_LONG_D || _numberFloat > MAX_LONG_D) {
2127-
reportOverflowInt();
2127+
reportOverflowLong(String.valueOf(_numberFloat));
21282128
}
21292129
_numberLong = (long) _numberFloat;
21302130
} else if ((_numTypesValid & NR_BIGDECIMAL) != 0) {
21312131
if (BD_MIN_LONG.compareTo(_numberBigDecimal) > 0
21322132
|| BD_MAX_LONG.compareTo(_numberBigDecimal) < 0) {
2133-
reportOverflowLong();
2133+
reportOverflowLong(String.valueOf(_numberBigDecimal));
21342134
}
21352135
_numberLong = _numberBigDecimal.longValue();
21362136
} else {

0 commit comments

Comments
 (0)