[JAVA-2982] Decimal128 is throwing AssertionError instead of NumberFormatException Created: 19/Sep/18  Updated: 06/Nov/18  Resolved: 19/Sep/18

Status: Closed
Project: Java Driver
Component/s: Error Handling
Affects Version/s: 3.8.1
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Wan Bachtiar Assignee: Ross Lawley
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates JAVA-2937 Decimal128 throws AssertionError inst... Closed
Related

 Description   

The method description states that NumberFormatException is thrown if value is out of the Decimal128 range:

https://github.com/mongodb/mongo-java-driver/blob/r3.8.1/bson/src/main/org/bson/types/Decimal128.java#L105

However, later on when it's checking for exponent is throwing AssertionError

https://github.com/mongodb/mongo-java-driver/blob/r3.8.1/bson/src/main/org/bson/types/Decimal128.java#L174

Need to throw NumberFormatException as similarly performed in clampAndRound() method ?

https://github.com/mongodb/mongo-java-driver/blob/r3.8.1/bson/src/main/org/bson/types/Decimal128.java#L214

 


Generated at Thu Feb 08 08:58:31 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.