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 16, 2023
2 parents c81c579 + 1f76529 commit 55adaf1
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions cbor/src/main/java/tools/jackson/dataformat/cbor/CBORParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -2137,30 +2137,30 @@ protected void convertNumberToInt() throws JacksonException
// Let's verify it's lossless conversion by simple roundtrip
int result = (int) _numberLong;
if (((long) result) != _numberLong) {
_reportError("Numeric value ("+getText()+") out of range of int");
_reportOverflowInt(String.valueOf(_numberLong));
}
_numberInt = result;
} else if ((_numTypesValid & NR_BIGINT) != 0) {
if (BI_MIN_INT.compareTo(_numberBigInt) > 0
|| BI_MAX_INT.compareTo(_numberBigInt) < 0) {
_reportOverflowInt();
_reportOverflowInt(String.valueOf(_numberBigInt));
}
_numberInt = _numberBigInt.intValue();
} else if ((_numTypesValid & NR_DOUBLE) != 0) {
// Need to check boundaries
if (_numberDouble < MIN_INT_D || _numberDouble > MAX_INT_D) {
_reportOverflowInt();
_reportOverflowInt(String.valueOf(_numberDouble));
}
_numberInt = (int) _numberDouble;
} else if ((_numTypesValid & NR_FLOAT) != 0) {
if (_numberFloat < MIN_INT_D || _numberFloat > MAX_INT_D) {
_reportOverflowInt();
_reportOverflowInt(String.valueOf(_numberFloat));
}
_numberInt = (int) _numberFloat;
} else if ((_numTypesValid & NR_BIGDECIMAL) != 0) {
if (BD_MIN_INT.compareTo(_numberBigDecimal) > 0
|| BD_MAX_INT.compareTo(_numberBigDecimal) < 0) {
_reportOverflowInt();
_reportOverflowInt(String.valueOf(_numberBigDecimal));
}
_numberInt = _numberBigDecimal.intValue();
} else {
Expand All @@ -2177,23 +2177,23 @@ protected void convertNumberToLong() throws JacksonException
} else if ((_numTypesValid & NR_BIGINT) != 0) {
if (BI_MIN_LONG.compareTo(_numberBigInt) > 0
|| BI_MAX_LONG.compareTo(_numberBigInt) < 0) {
_reportOverflowLong();
_reportOverflowLong(String.valueOf(_numberBigInt));
}
_numberLong = _numberBigInt.longValue();
} else if ((_numTypesValid & NR_DOUBLE) != 0) {
if (_numberDouble < MIN_LONG_D || _numberDouble > MAX_LONG_D) {
_reportOverflowLong();
_reportOverflowLong(String.valueOf(_numberDouble));
}
_numberLong = (long) _numberDouble;
} else if ((_numTypesValid & NR_FLOAT) != 0) {
if (_numberFloat < MIN_LONG_D || _numberFloat > MAX_LONG_D) {
_reportOverflowInt();
_reportOverflowLong(String.valueOf(_numberFloat));
}
_numberLong = (long) _numberFloat;
} else if ((_numTypesValid & NR_BIGDECIMAL) != 0) {
if (BD_MIN_LONG.compareTo(_numberBigDecimal) > 0
|| BD_MAX_LONG.compareTo(_numberBigDecimal) < 0) {
_reportOverflowLong();
_reportOverflowLong(String.valueOf(_numberBigDecimal));
}
_numberLong = _numberBigDecimal.longValue();
} else {
Expand Down

0 comments on commit 55adaf1

Please sign in to comment.