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

REGRESSION: Windows-style filename in returned StreamSource.systemID URI

    XMLWordPrintable

    Details

      Backports

        Description



        Name: erR10175 Date: 06/11/2004



         The method getSystemId() of the class javax.xml.transform.stream.StreamSource
        returns URI with Windows-style filename (with backslashes) when the StreamSource
        instance is constructed with File argument or the setSystemId(File) is applied
        (see test.java sample and log below).

        The backslash symbol isn't admittable in URI (pp 26-27, RFC 2396 "URI Generic Syntax",
        August 1998 ; http://www.ietf.org/rfc/rfc2396.txt )

        Bug on the same issue was filed against JAXP 1.2

        4473224 Windows-style filename in returned systemID URI

        and number of StreamSource, StreamResult tests in JAXP TCK 1.2 were affected by
        this bug. The bug #4473224 was verified in jdk1.5.0-b51 and jaxp1.2-b21, but it
        appears again in jaxp1.3 and is reproducible with jaxp1.3-b18 on jdk 1.3.1.
        This bug is created to track the issue in jaxp1.3.

        The bug affects JAXP TCK 1.3 tests:

          api/javax_xml/transform/stream/StreamSource/index.html#Ctor[Ctor007]
          api/javax_xml/transform/stream/StreamSource/index.html#setGet[setGet006]

        the same tests in JAXP TCK 1.2 failed due to the bug #4473224.

        To reproduce the bug compile and run test.java on Windows as shown
        in the log below:
        --------------------------------- test.java
        import java.io.File;
        import javax.xml.transform.stream.StreamSource;

        public class test {
            public static void main(String argv[]) {
                File f = new File("C:\\tmp", "test.xml");
                StreamSource ss = new StreamSource(f);
                String sysID = ss.getSystemId();
                System.out.print("Step 1: ");
                if (sysID.indexOf("\\") == -1) {
                    System.out.println("Passed.");
                } else {
                    System.out.println("Failed, SystemId contains '\\': " + sysID);
                }

                ss = new StreamSource();
                f = new File("C:\\tmp", "test.xml");
                ss.setSystemId(f);
                sysID = ss.getSystemId();
                System.out.print("Step 2: ");
                if (sysID.indexOf("\\") == -1) {
                    System.out.println("Passed.");
                } else {
                    System.out.println("Failed, SystemId contains '\\': " + sysID);
                }
             }
        }
        -------------------------------------------

        -------------------------------------- log
        C:\>set CLASSPATH=.;jaxp-1.3-beta-b18-09_jun_2004\dom.jar;jaxp-1.3-beta-b18-09_jun_2004\jaxp-api.jar;jaxp-1.3-beta-b18-09_jun_2004\sax.jar;jaxp-1.3-beta-b18-09_jun_2004\xalan.jar;jaxp-1.3-beta-b18-09_jun_2004\xercesImpl.jar

        C:\>javac test.java

        C:\>java -showversion test
        java version "1.3.0"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
        Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

        Step 1: Failed, SystemId contains '\': file:///C:\tmp\test.xml
        Step 2: Failed, SystemId contains '\': file:///C:\tmp\test.xml
        ------------------------------------------


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

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                rmandavasunw Ramesh Mandava (Inactive)
                Reporter:
                reysunw Rey Rey (Inactive)
                Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: