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

saxparser.parse(uri, handler) throws NPE on windows XP when the 'uri' is blank or non-existant

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • 6
    • 5.0
    • xml
    • b61
    • x86
    • windows_xp

      saxparser.parse(uri, handler) throws NPE on windows XP when the 'uri' is blank or non-existant


      To reproduce the failure :
      --------------------------
      copy dom.jar xalan.jar & xercesImpl.jar from wspack1.5
      nightly build promoted sept 22


      setenv JAVA_HOME /home/sa122568/Jaxp/jdk1.4.2_04/win
      setenv PATH .:$JAVA_HOME/bin:$PATH

      setenv CLASSPATH .:./dom.jar:./xalan.jar:./xercesImpl.jar

      Testcase attached - Test.java

      javac Test.java
      java Test

      when the 'uri' is blank or non-existant
      saxparser.parse(uri, handler);
      should throw IOException

      but throws NPE on windows XP
      works properly on Solsparc

      From the comment in the testcase it looks this was fixed earlier
      "// GTM added this for WinXP platform which throws null ptr here"

      -------------------------------Test.java-------------------------------------
      import javax.xml.parsers.SAXParserFactory;
      import javax.xml.parsers.SAXParser;
      import javax.xml.parsers.ParserConfigurationException;
      import javax.xml.parsers.FactoryConfigurationError;

      import org.xml.sax.SAXException;
      import org.xml.sax.Parser;

      import org.xml.sax.helpers.DefaultHandler;

      import java.io.IOException;

      public class Test {

      public static void main(String args[]){
      Test test = new Test();
      test.parse08();

      }
      //==========================================================================
          /* Testcase with non-existant uri, parsing should fail and throw
           * IOException
           */
          private void parse08() {
      SAXParserFactory spf = null;
      SAXParser saxparser = null;
      String uri = " ";
      DefaultHandler handler= null;

      try {
      spf = SAXParserFactory.newInstance();
      saxparser = spf.newSAXParser();
      handler = new DefaultHandler();
      } catch (ParserConfigurationException e){
                 System.out.println("ParserConfigurationException");
      } catch (SAXException e){
                 System.out.println("SAXException");

      }

      try {
      saxparser.parse(uri, handler);
      } catch (IOException e) {
                 System.out.println("IOE thrown");
      } catch (IllegalArgumentException e) {
                 System.out.println("IAE thrown");
      } catch (SAXException e) {
                 System.out.println("SAXE thrown");
      } catch (NullPointerException e) {
      // GTM added this for WinXP platform which throws null ptr here
      System.out.println("NPE thrown");
      }


          } //parse08 end
      }
      --------------------------------------------------------------------------
      ###@###.### 9/23/04 08:44 GMT

            jsuttorsunw Jeff Suttor (Inactive)
            saksunw Sreejith Ak (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: