-
Bug
-
Resolution: Fixed
-
P3
-
6u22
-
b22
-
generic
-
generic
-
Verified
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-2215641 | 8 | Sean Coffey | P3 | Closed | Fixed | b14 |
JDK-2215640 | 7u4 | Sean Coffey | P3 | Closed | Fixed | b02 |
JDK-2217323 | 6u32 | Sean Coffey | P3 | Closed | Fixed | b01 |
JDK-2218091 | 6u31-rev | Sean Coffey | P3 | Closed | Fixed | b21 |
JDK-2217301 | 6u30-rev | Sean Coffey | P3 | Resolved | Fixed | b21 |
SHORT SUMMARY:
Classcast exception when using non-default JAXP parser
INDICATORS:
Exception :
Exception in thread "main" java.lang.ClassCastException:
oracle.xml.parser.v2.DTD cannot be cast to org.w3c.dom.Element
at java.util.XMLUtils.load(XMLUtils.java:61)
COUNTER INDICATORS:
TRIGGERS:
Use of non-default JAXP parser (oracle xml parser xmlparserv2.jar) in this
case while making calls into java.util.XMLUtils.load method
KNOWN WORKAROUND:
Modify the parser used.
PRESENT SINCE:
N/A
HOW TO VERIFY:
Testcase presented in BugDB report. oracle xml parser "xmlparserv2.jar"
should be present in CLASSPATH before running testcase.
NOTES FOR SE:
Logged on jdk 6u22 with linux x86 platform
Fix is simple and suggested by submitter :
==
The error is in the line:
Element propertiesElement = (Element)doc.getChildNodes().item(1);
which is making an incorrect assumption about the in-memory structure
of the parsed XML document. Instead, it should access the document
element of the XML DOM tree using the standard DOM API getDocumentElement():
Element propertiesElement = doc.getDocumentElement();
----
REGRESSION:
No
Classcast exception when using non-default JAXP parser
INDICATORS:
Exception :
Exception in thread "main" java.lang.ClassCastException:
oracle.xml.parser.v2.DTD cannot be cast to org.w3c.dom.Element
at java.util.XMLUtils.load(XMLUtils.java:61)
COUNTER INDICATORS:
TRIGGERS:
Use of non-default JAXP parser (oracle xml parser xmlparserv2.jar) in this
case while making calls into java.util.XMLUtils.load method
KNOWN WORKAROUND:
Modify the parser used.
PRESENT SINCE:
N/A
HOW TO VERIFY:
Testcase presented in BugDB report. oracle xml parser "xmlparserv2.jar"
should be present in CLASSPATH before running testcase.
NOTES FOR SE:
Logged on jdk 6u22 with linux x86 platform
Fix is simple and suggested by submitter :
==
The error is in the line:
Element propertiesElement = (Element)doc.getChildNodes().item(1);
which is making an incorrect assumption about the in-memory structure
of the parsed XML document. Instead, it should access the document
element of the XML DOM tree using the standard DOM API getDocumentElement():
Element propertiesElement = doc.getDocumentElement();
----
REGRESSION:
No
- backported by
-
JDK-2217301 Properties.loadFromXML fails with ClassCastException
-
- Resolved
-
-
JDK-2215640 Properties.loadFromXML fails with ClassCastException
-
- Closed
-
-
JDK-2215641 Properties.loadFromXML fails with ClassCastException
-
- Closed
-
-
JDK-2217323 Properties.loadFromXML fails with ClassCastException
-
- Closed
-
-
JDK-2218091 Properties.loadFromXML fails with ClassCastException
-
- Closed
-