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

XMLInputFactory.createXMLStreamReader() throws NPE

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 6
    • 1.4.0
    • xml
    • b50
    • generic
    • generic

      XMLInputFactory.createXMLStreamReader() throws NPE

      ----------------------------------------------------------------------------
      same is the case with XMLInputFactory.createXMLEventReader()
      XMLInputFactory.createXMLEventReader() also throws NPE
      ----------------------------------------------------------------------------


      this issue appeared from jaxp1.4 july30 nightly build onwards , was working with july29 nightly build !

      Testcase to reproduce this issue - Test1.java

      --------------------------------- Test1.java ---------------------------------------
      import java.io.*;
      import javax.xml.stream.*;
      import javax.xml.stream.events.*;
      import javax.xml.transform.*;
      import javax.xml.transform.stax.*;


      public class Test1 {

          XMLInputFactory ifac = XMLInputFactory.newInstance();
          XMLOutputFactory ofac = XMLOutputFactory.newInstance();
          
          public static void main(String args[]){
           // try{
              Test1 t1 = new Test1();
              t1.test05();
          }

          /* createXMLStreamReader(new FileInputStream()) */
          public void test05() {
              try{
                  System.out.println("before ifac.createXMLStreamReader");
                  XMLStreamReader reader = ifac.createXMLStreamReader(new FileInputStream("cities.xml"));
                  System.out.println("after ifac.createXMLStreamReader");
               
              }
              catch(Exception e){
                  System.out.println("Exception " + e);
              }
          }


      }
      ------------------------------- cities.xml -------------------------------------------
      <?xml version="1.0" standalone="yes" ?>
      <cities>
      <city name="Paris" country="France"/>
      <city name="Roma" country="Italia"/>
      <city name="Nice" country="France"/>
      <city name="Madrid" country="Espana"/>
      <city name="Milano" country="Italia"/>
      <city name="Firenze" country="Italia"/>
      <city name="Napoli" country="Italia"/>
      <city name="Lyon" country="France"/>
      <city name="Barcelona" country="Espana"/>
      </cities>
      ------------------------------------------------------------------------------------------

            sreddysunw Sunitha Reddy (Inactive)
            saksunw Sreejith Ak (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: