jaxb
  1. jaxb
  2. JAXB-644

Re-implementation of DatatypeConverterImpl._parseInt() for correct conversion.

    Details

    • Type: Task Task
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Won't Fix
    • Affects Version/s: 2.1.11
    • Fix Version/s: not determined
    • Component/s: runtime
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      644

      Description

      Current implementation of com.sun.xml.bind.DatatypeConverterImpl._parseInt()
      accepts and converts invalid values:
      "1 23" to "123"
      "1+23" to "123"
      "1-23" to "-123"
      "123-" to "-123"
      etc.

      I guess the original implementation of _parseInt() is ad-hoc code in the early
      stage of development. I don't see a reason the approach for int should be
      different for the approach taken for long.
      The patch that I am attaching reimplements _parseInt() similar to _parseLong().

      http://www.w3.org/TR/xmlschema-2/#int
      http://www.w3.org/TR/xmlschema-2/datatypes.xsd

        Activity

        Hide
        tkobayas added a comment -

        Created an attachment (id=310)
        patch for DatatypeConverterImpl._parseInt()

        Show
        tkobayas added a comment - Created an attachment (id=310) patch for DatatypeConverterImpl._parseInt()
        Hide
        tkobayas added a comment -

        Created an attachment (id=311)
        testcase for DatatypeConverterImpl.parseInt()

        Show
        tkobayas added a comment - Created an attachment (id=311) testcase for DatatypeConverterImpl.parseInt()
        Hide
        Martin Grebac added a comment -

        I'll certainly look at this, but making incompatible changes in DTC is highly unlikely.

        Show
        Martin Grebac added a comment - I'll certainly look at this, but making incompatible changes in DTC is highly unlikely.
        Hide
        Martin Grebac added a comment -

        Due to compatibility we won't fix this even though agree there's an issue with the code. The workaround is to set your own DatatypeConverter.

        Show
        Martin Grebac added a comment - Due to compatibility we won't fix this even though agree there's an issue with the code. The workaround is to set your own DatatypeConverter.

          People

          • Assignee:
            Martin Grebac
            Reporter:
            tkobayas
          • Votes:
            2 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: