Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6354958

Missing javax.xml.DatatypeFactory.newDurationDayTime with BigDecimal seconds

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 5.0
    • Fix Version/s: 5.0
    • Component/s: xml
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_xp

      Description

      A DESCRIPTION OF THE REQUEST :
      The javax.xml.DatatypeFactory interface allows for creation of durations with BigDecimal seconds but only allows BigInteger seconds for day-time durations. It needs to have the following method:
      Duration newDurationDayTime(boolean isPositive, BigInteger day, BigInteger hour, BigInteger minute, BigDecimal second)

      JUSTIFICATION :
      Having a BigInteger instead of a BigDecimal argument is inconsistent with both the newDuration constructor (that does take a BigDecimal seconds) and the documented behaviour of Duration.getField, which returns BigDecimal for the seconds field. It also makes it impossible to correctly implement a downcast from duration to day-time duration according to the XPath2 spec and without prior knowledge of implementation precision limitations.


      CUSTOMER SUBMITTED WORKAROUND :
      The only way to create a day-time duration with fractional seconds at the moment is to use the newDurationDayTime(long millis) factory method.

        Attachments

          Activity

            People

            • Assignee:
              joehw Joe Wang
              Reporter:
              gmanwanisunw Girish Manwani (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported:
                Indexed: