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

ClassCastException in jre 1.6 but not in 1.5

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 6
    • xml
    • b59
    • 6
    • x86
    • windows_2003

      FULL PRODUCT VERSION :
      java version "1.6.0-ea"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.6.0-ea-b58)
      Java HotSpot(TM) Client VM (build 1.6.0-ea-b58, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Windows 2003 SP1

      A DESCRIPTION OF THE PROBLEM :
       public static XMLReader createXMLReader (String className)
      throws SAXException
      {
          try {
               return (XMLReader)(Class.forName(className).newInstance());
          } catch (ClassNotFoundException e1) {
               throw new SAXException("SAX2 driver class " + className +
      " not found", e1);
          } catch (IllegalAccessException e2) {
               throw new SAXException("SAX2 driver class " + className +
      " found but cannot be loaded", e2);
          } catch (InstantiationException e3) {
      throw new SAXException("SAX2 driver class " + className +
      " loaded but cannot be instantiated (no empty public constructor?)",
      e3);
          } catch (ClassCastException e4) {
               throw new SAXException("SAX2 driver class " + className +
      " does not implement XMLReader", e4);
          }
      }

      This is code from Xerces. ClassCastException is being always trown on jre 1.6.0ea

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      download http://sunsite.icm.edu.pl/pub/www/apache/dist/xml/batik/batik-1.6.zip,
      unzip, cd batik-1.6, java -jar batik-squiggle.jar
      The exception is thrown

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
        Program should work without exceptions
      ACTUAL -
      java.io.IOException: SAX2 driver class org.apache.xerces.parsers.SAXParser does not implement XMLReader


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      java.io.IOException: SAX2 driver class org.apache.xerces.parsers.SAXParser does not implement XMLReader
      at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(Unknown Source)
      at org.apache.batik.dom.util.SAXDocumentFactory.createDocument(Unknown Source)
      at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createDocument(Unknown Source)
      at org.apache.batik.dom.svg.SAXSVGDocumentFactory.createSVGDocument(Unknown Source)
      at org.apache.batik.bridge.DocumentLoader.loadDocument(Unknown Source)
      at org.apache.batik.swing.svg.SVGDocumentLoader.run(Unknown Source)


      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public static XMLReader createXMLReader (String className)
      throws SAXException
      {
          try {
               return (XMLReader)(Class.forName(className).newInstance());
          } catch (ClassNotFoundException e1) {
               throw new SAXException("SAX2 driver class " + className +
      " not found", e1);
          } catch (IllegalAccessException e2) {
               throw new SAXException("SAX2 driver class " + className +
      " found but cannot be loaded", e2);
          } catch (InstantiationException e3) {
      throw new SAXException("SAX2 driver class " + className +
      " loaded but cannot be instantiated (no empty public constructor?)",
      e3);
          } catch (ClassCastException e4) {
               throw new SAXException("SAX2 driver class " + className +
      " does not implement XMLReader", e4);
          }
      }

      This is code from Xerces. http://xerces.apache.org/
      ---------- END SOURCE ----------

            jsuttorsunw Jeff Suttor (Inactive)
            ndcosta Nelson Dcosta (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: