[JAVA-2937] Decimal128 throws AssertionError instead of NumberFormatException Created: 22/Aug/18 Updated: 27/Oct/23 Resolved: 01/Oct/18 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | BSON |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Andrei Sereda | Assignee: | Jeffrey Yemin |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Description |
|
According to documentation NumberFormatException should be thrown when BigDecimal is out of range for Decimal128 but looking at the code AssertionError is being used instead :
|
| Comments |
| Comment by Andrei Sereda [ 29/Sep/18 ] | |||||||
|
Ross, I have tried to simulate assertion error manually but unfortunately couldn't. All the checks insideĀ clampAndRound / ensureExactRounding methods are throwing NumberFormatException (which is expected behaviour). If I observe AssertionError will post the exact value here. | |||||||
| Comment by Ross Lawley [ 19/Sep/18 ] | |||||||
|
asereda could you provide the engineering string representation of the BigDecimal that triggers the Assertion error? | |||||||
| Comment by Andrei Sereda [ 22/Aug/18 ] | |||||||
|
By inspection (and tests). We have custom Codec for BigDecimal which fallsback to String if Decimal128 can't be used :
| |||||||
| Comment by Jeffrey Yemin [ 22/Aug/18 ] | |||||||
|
Hi asereda Thanks for the report. Can you let us know how this is impacting you? Is it something you encountered while running an application, or did you find it by inspection? |