Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2982

Decimal128 is throwing AssertionError instead of NumberFormatException

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 3.8.1
    • Component/s: Error Handling
    • None

      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

       

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            wan.bachtiar@mongodb.com Wan Bachtiar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: