You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2001/03/03 21:57:00 UTC

[Bug 832] New - Unchecked ClassCastException in org.apache.xerces.parsers.DOMParser

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=832

*** shadow/832	Sat Mar  3 12:57:00 2001
--- shadow/832.tmp.8296	Sat Mar  3 12:57:00 2001
***************
*** 0 ****
--- 1,36 ----
+ +============================================================================+
+ | Unchecked ClassCastException in org.apache.xerces.parsers.DOMParser        |
+ +----------------------------------------------------------------------------+
+ |        Bug #: 832                         Product: Xerces-J                |
+ |       Status: NEW                         Version: 1.3.0                   |
+ |   Resolution:                            Platform: PC                      |
+ |     Severity: Normal                   OS/Version: Linux                   |
+ |     Priority:                           Component: DOM                     |
+ +----------------------------------------------------------------------------+
+ |  Assigned To: xerces-j-dev@xml.apache.org                                  |
+ |  Reported By: ari@iln.net                                                  |
+ |      CC list: Cc:                                                          |
+ +----------------------------------------------------------------------------+
+ |          URL:                                                              |
+ +============================================================================+
+ |                              DESCRIPTION                                   |
+ DOMParser assumes an org.w3c.domAttr to be an org.apache.xerces.dom.AttrImpl
+ (line 1078):
+ 
+     if (!xmlAttrList.isSpecified(attrHandle)) {
+         ((AttrImpl)e.getAttributeNode(attrName))
+             .setSpecified(false);
+     }
+ 
+ This assumption does not hold true when the value of
+ http://apache.org/xml/properties/dom/document-class-name is not the default
+ org.apache.xerces.dom.DocumentImpl, that is when building documents for
+ non-Xerces implementations.
+ 
+ In this case, the code consistently throws ClassCastExceptions.
+ 
+ Attr.setSpecified(boolean) is not a standard DOM method.
+ 
+ A quick fix would be an empty catch block. This is probably appropriate, because
+ other implementations cannot be expected to provide an equivalent for this
+ method.