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

javax.xml.datatype.Duration("P1M").isLongerThan("P28D") returns true

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      1.3
    • CPU:
      generic
    • OS:
      generic

      Backports

        Description

        Name: erR10175 Date: 10/22/2003



          Method javax.xml.datatype.Duration.isLongerThan(Duration rhs) incorrectly
        returns 'true' for the following arguments (this and rhs):
        'P1M' and P28D',
        'P1M' and P29D',
        'P5M' and P150D'

        The XML Schema Part 2: Datatypes, table in the Section 3.2.6.2
        Order relation on duration reads:

        "The following table shows the strongest relationship that can be
        determined between example durations. The symbol <> means that the
        order relation is indeterminate. ...

        --------------------------------------------------------
          Relation
        --------------------------------------------------------
        P1Y | >P364D <>P365D <>P366D <P367D
        P1M | >P27D <>P28D <>P29D <>P30D <>P31D <P32D
        P5M | >P149D <>P150D <>P151D <>P152D <>P153D <P154D
        --------------------------------------------------------
        "

        So the method javax.xml.datatype.Duration.isLongerThan(Duration rhs)
        is expected to return false in the mentioned cases.

        This bug affects new test in JCK 1.5 (not yet integrated)
           api/javax_xml/datatype/Duration/index.html#DurationTests[IsLongerThan001]

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

        public class IsLongerThanTest {
            public static void main(String [] args) {
                System.out.println("P1M.isLongerThan(P28D) returns "
                    + new Duration("P1M").isLongerThan(new Duration("P28D")));
                System.out.println("P1M.isLongerThan(P29D) returns "
                    + new Duration("P1M").isLongerThan(new Duration("P29D")));
                System.out.println("P5M.isLongerThan(P150D) returns "
                    + new Duration("P5M").isLongerThan(new Duration("P150D")));
            }
        }
        ----------------------------------------------------

        ------------------------------------------------ log
        $javac IsLongerThanTest.java
        $java -cp . -showversion IsLongerThanTest
        java version "1.5.0-beta"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-beta-b24)
        Java HotSpot(TM) Server VM (build 1.5.0-beta-b24, mixed mode)

        P1M.isLongerThan(P28D) returns true
        P1M.isLongerThan(P29D) returns true
        P5M.isLongerThan(P150D) returns true
        ----------------------------------------------------

        ======================================================================</TEXTAREA>
        </td>
                            </tr>
                            <TR>
                              <TD colspan="2" bgcolor="#BFBFBF"> </td>
                            </tr>

        <a name="comments"></a>
                            <!-- COMMENTS -->
                            <TR>
                              <TD bgcolor="#BFBFBF" align="left" valign="bottom" height="24">
        <img src="/bugz/images/dot.gif" width="10">Comments
        </td>
                              <TD bgcolor="#BFBFBF" align="left" valign="bottom" height="24">
        <!-- BEGIN:TBR Mohan
          <A href="javascript:doDateStampSubmit(document.editbug_general, 'comments');"><font size="-1">[ Date Stamp ]</font></A>
        <img src="/bugz/images/dot.gif" width="18">
        END:TBR -->
        <A href="javascript:doFullPageSubmit(document.editbug_general, 'comments');"><font size="-1">[ Full Page ]</font></a>
        <img src="/bugz/images/dot.gif" width="22">
        <FONT size="-1" color="darkblue">--- Enter SUN Proprietary data here ---</font>
        </td>
                            </tr>

                            <TR>
                              <TD bgcolor="#BFBFBF" colspan="2" nowrap align="left">
        <img src="/bugz/images/dot.gif" width="5">
                                <TEXTAREA rows="6" cols="95" wrap="virtual" name="comments" align="left" bgcolor="white">
        ###@###.### 2003-10-22

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                kkawagucsunw Kohsuke Kawaguchi (Inactive)
                Reporter:
                reysunw Rey Rey (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: