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

Duration.getXMLSchemaType throws UnsupportedOperationException

XMLWordPrintable

    • 1.3
    • generic
    • generic
    • Verified

        Name: erR10175 Date: 05/19/2004



         The following method of the class javax.xml.datatype.Duration

        public abstract QName getXMLSchemaType()

        throws UnsupportedOperationException.

        The javadoc of the method specifies only IllegalStateException which to be thrown if
        the combination of set fields of the Duration instance does not match one of
        the XML Schema date/time datatypes.

        In the test (see below) the Duration instance corresponds to DatatypeConstants.DURATION,
        so neither IllegalStateException nor UnsupportedOperationException is expected.

        This bug affects new test in JCK 1.5
          api/javax_xml/datatype/Duration/index.html#GetXMLSchemaType[GetXMLSchemaType001]

        The bug is found in jdk1.5.0/beta/b51.

        To reproduce the bug compile and run test.java as shown in the log below:
        ------------------------------------------ test.java
        import javax.xml.datatype.DatatypeFactory;
        import javax.xml.datatype.Duration;

        public class test {
            public static void main(String [] args) throws Exception {
                DatatypeFactory df = DatatypeFactory.newInstance();
                Duration d = df.newDuration("P1Y1M1DT1H1M1S");
                System.out.println("Passed: " + d.getXMLSchemaType());
            }
        }
        ----------------------------------------------------

        ------------------------------------------------ log
        $javac test.java && java -cp . -showversion test
        java version "1.5.0-beta2"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta2-b51)
        Java HotSpot(TM) Client VM (build 1.5.0-beta2-b51, mixed mode)

        Exception in thread "main" java.lang.UnsupportedOperationException: com.sun.org.apache.xerces.internal.jaxp.datatype.DurationImpl#getXMLSchemaType() not implemented.
                at com.sun.org.apache.xerces.internal.jaxp.datatype.DurationImpl.getXMLSchemaType(DurationImpl.java:227)
                at test.main(test.java:8)
        ----------------------------------------------------

        ======================================================================

              jsuttorsunw Jeff Suttor (Inactive)
              reysunw Rey Rey (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: