diff options
author | Chris Burdess <dog@bluezoo.org> | 2005-02-10 17:21:23 +0000 |
---|---|---|
committer | Chris Burdess <dog@bluezoo.org> | 2005-02-10 17:21:23 +0000 |
commit | 9a2b1bbd94c1bd1cbbc0e0fd0b2d2fe2d3877d70 (patch) | |
tree | 5a275e8443f9cef3baa7968343df6138ce74e1f2 /gnu | |
parent | 637f44881200f2d69087808b064948e828930a6d (diff) | |
download | classpath-9a2b1bbd94c1bd1cbbc0e0fd0b2d2fe2d3877d70.tar.gz |
2005-02-10 Chris Burdess <dog@gnu.org>
* gnu/xml/dom/DomAttr.java,
gnu/xml/dom/DomCDATA.java,
gnu/xml/dom/DomCDATASection.java,
gnu/xml/dom/DomCharacterData.java,
gnu/xml/dom/DomDOMException.java,
gnu/xml/dom/DomDoctype.java,
gnu/xml/dom/DomDocument.java,
gnu/xml/dom/DomDocumentConfiguration.java,
gnu/xml/dom/DomDocumentFragment.java,
gnu/xml/dom/DomElement.java,
gnu/xml/dom/DomEx.java,
gnu/xml/dom/DomFragment.java,
gnu/xml/dom/DomImpl.java,
gnu/xml/dom/DomIterator.java,
gnu/xml/dom/DomNamedNodeMap.java,
gnu/xml/dom/DomNode.java,
gnu/xml/dom/DomNsNode.java,
gnu/xml/dom/DomPI.java,
gnu/xml/dom/DomProcessingInstruction.java,
gnu/xml/dom/DomText.java,
gnu/xml/dom/DomLSEx.java,
gnu/xml/dom/DomLSException.java,
gnu/xml/dom/DomLSParser.java,
gnu/xml/dom/DomLSSerializer.java: Refactoring of exception and DOM
implementation class names to conform to Classpath guidelines. Make
DomLSException use JDK 1.4+ exception chaining.
* gnu/xml/util/SAXNullTransformerFactory.java,
gnu/xml/xpath/Predicate.java: Use constants relative to declaring
class or interface.
Diffstat (limited to 'gnu')
21 files changed, 204 insertions, 186 deletions
diff --git a/gnu/xml/dom/DomAttr.java b/gnu/xml/dom/DomAttr.java index 2890430e3..555902e3e 100644 --- a/gnu/xml/dom/DomAttr.java +++ b/gnu/xml/dom/DomAttr.java @@ -38,6 +38,7 @@ exception statement from your version. */ package gnu.xml.dom; import org.w3c.dom.Attr; +import org.w3c.dom.DOMException; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.TypeInfo; @@ -194,7 +195,7 @@ public class DomAttr { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } if (value == null) { @@ -284,11 +285,11 @@ public class DomAttr { if (parent != null) { - throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR); } if (!(e instanceof DomElement)) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR); } parent = (DomElement) e; depth = parent.depth + 1; diff --git a/gnu/xml/dom/DomCDATA.java b/gnu/xml/dom/DomCDATASection.java index f6f471c68..4b4dcb571 100644 --- a/gnu/xml/dom/DomCDATA.java +++ b/gnu/xml/dom/DomCDATASection.java @@ -1,4 +1,4 @@ -/* DomCDATA.java -- +/* DomCDATASection.java -- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -54,7 +54,7 @@ import org.w3c.dom.CDATASection; * @author David Brownell * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> */ -public class DomCDATA +public class DomCDATASection extends DomText implements CDATASection { @@ -68,12 +68,12 @@ public class DomCDATA * similarly used in a "Sub-DOM" style layer. * */ - protected DomCDATA(DomDocument owner, String value) + protected DomCDATASection(DomDocument owner, String value) { super(CDATA_SECTION_NODE, owner, value); } - protected DomCDATA(DomDocument owner, char buf [], int off, int len) + protected DomCDATASection(DomDocument owner, char buf [], int off, int len) { super(CDATA_SECTION_NODE, owner, buf, off, len); } @@ -84,7 +84,7 @@ public class DomCDATA */ final public String getNodeName() { - return "#cdata-section"; + return "#cdata-section"; } } diff --git a/gnu/xml/dom/DomCharacterData.java b/gnu/xml/dom/DomCharacterData.java index 48ccb82d6..fc4313e5f 100644 --- a/gnu/xml/dom/DomCharacterData.java +++ b/gnu/xml/dom/DomCharacterData.java @@ -38,6 +38,7 @@ exception statement from your version. */ package gnu.xml.dom; import org.w3c.dom.CharacterData; +import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.w3c.dom.events.MutationEvent; @@ -82,7 +83,7 @@ public abstract class DomCharacterData { if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } String value = text + arg; mutating(value); @@ -98,12 +99,12 @@ public abstract class DomCharacterData { if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); if (offset < 0 || count < 0 || offset > raw.length) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } if ((offset + count) > raw.length) { @@ -125,7 +126,7 @@ public abstract class DomCharacterData } catch (IndexOutOfBoundsException x) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } } @@ -164,7 +165,7 @@ public abstract class DomCharacterData { if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); char[] tmp = arg.toCharArray (); @@ -182,7 +183,7 @@ public abstract class DomCharacterData } catch (IndexOutOfBoundsException x) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } } @@ -195,14 +196,14 @@ public abstract class DomCharacterData { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } char[] raw = text.toCharArray(); // deleteData if (offset < 0 || count < 0 || offset > raw.length) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } if ((offset + count) > raw.length) { @@ -228,7 +229,7 @@ public abstract class DomCharacterData } catch (IndexOutOfBoundsException x) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } } @@ -241,7 +242,7 @@ public abstract class DomCharacterData { if (isReadonly()) { - throw new DomEx (DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } if (value == null) { @@ -276,7 +277,7 @@ public abstract class DomCharacterData { return text.substring(offset); } - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } } diff --git a/gnu/xml/dom/DomEx.java b/gnu/xml/dom/DomDOMException.java index aacac9689..a56814cff 100644 --- a/gnu/xml/dom/DomEx.java +++ b/gnu/xml/dom/DomDOMException.java @@ -1,4 +1,4 @@ -/* DomEx.java -- +/* DomDOMException.java -- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,7 +50,7 @@ import org.w3c.dom.Node; * * @author David Brownell */ -public class DomEx +public class DomDOMException extends DOMException { @@ -67,7 +67,7 @@ public class DomEx * Constructs an exception, with the diagnostic message * corresponding to the specified code. */ - public DomEx(short code) + public DomDOMException(short code) { super(code, diagnostic(code)); } @@ -77,7 +77,7 @@ public class DomEx * corresponding to the specified code and additional * information as provided. */ - public DomEx(short code, String data, Node node, int value) + public DomDOMException(short code, String data, Node node, int value) { super(code, diagnostic(code)); this.data = data; diff --git a/gnu/xml/dom/DomDoctype.java b/gnu/xml/dom/DomDoctype.java index 35fb613e5..8c760a531 100644 --- a/gnu/xml/dom/DomDoctype.java +++ b/gnu/xml/dom/DomDoctype.java @@ -39,6 +39,7 @@ package gnu.xml.dom; import java.util.HashMap; import org.w3c.dom.DocumentType; +import org.w3c.dom.DOMException; import org.w3c.dom.DOMImplementation; import org.w3c.dom.Entity; import org.w3c.dom.NamedNodeMap; @@ -194,7 +195,7 @@ public class DomDoctype } if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } getEntities(); @@ -250,7 +251,7 @@ public class DomDoctype if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } getNotations(); diff --git a/gnu/xml/dom/DomDocument.java b/gnu/xml/dom/DomDocument.java index 10693ae1d..908857168 100644 --- a/gnu/xml/dom/DomDocument.java +++ b/gnu/xml/dom/DomDocument.java @@ -292,16 +292,16 @@ public class DomDocument if (newChild.getNodeType() == ELEMENT_NODE && getDocumentElement() != null) { - throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR, - "document element already present: " + - getDocumentElement(), newChild, 0); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR, + "document element already present: " + + getDocumentElement(), newChild, 0); } if (newChild.getNodeType() == DOCUMENT_TYPE_NODE && getDoctype() != null) { - throw new DomEx (DomEx.HIERARCHY_REQUEST_ERR, - "document type already present: " + - getDoctype(), newChild, 0); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR, + "document type already present: " + + getDoctype(), newChild, 0); } } @@ -376,12 +376,12 @@ public class DomDocument { if (name == null) { - throw new DomEx (DomEx.NAMESPACE_ERR, name, null, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, name, null, 0); } int len = name.length(); if (len == 0) { - throw new DomEx (DomEx.NAMESPACE_ERR, name, null, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, name, null, 0); } // dog: rewritten to use the rules for XML 1.0 and 1.1 @@ -407,7 +407,8 @@ public class DomDocument (c < 0xfdf0 || c > 0xfffd) && (c < 0x10000 || c > 0xeffff)) { - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + name, null, c); } } else @@ -425,14 +426,16 @@ public class DomDocument (c >= 0x20dd && c <= 0x20e0)) { // Compatibility area and Unicode 2.0 exclusions - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + name, null, c); } break; default: if (c != ':' && c != '_' && (c < 0x02bb || c > 0x02c1) && c != 0x0559 && c != 0x06e5 && c != 0x06e6) { - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + name, null, c); } } } @@ -464,7 +467,8 @@ public class DomDocument (c < 0x0300 || c > 0x036f) && (c < 0x203f || c > 0x2040)) { - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, name, + null, c); } } else @@ -487,7 +491,8 @@ public class DomDocument (c >= 0x20dd && c <= 0x20e0)) { // Compatibility area and Unicode 2.0 exclusions - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + name, null, c); } break; default: @@ -495,7 +500,8 @@ public class DomDocument c != 0x0387 && (c < 0x02bb || c > 0x02c1) && c != 0x0559 && c != 0x06e5 && c != 0x06e6 && c != 0x00b7) { - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, name, null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + name, null, c); } } } @@ -517,7 +523,8 @@ public class DomDocument if (index == 0 || index == (len - 1) || name.lastIndexOf(':') != index) { - throw new DomEx(DomEx.NAMESPACE_ERR, name, null, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + name, null, 0); } } } @@ -552,8 +559,8 @@ public class DomDocument continue; } } - throw new DomEx(DomEx.INVALID_CHARACTER_ERR, - new String(buf, off, len), null, c); + throw new DomDOMException(DOMException.INVALID_CHARACTER_ERR, + new String(buf, off, len), null, c); } } @@ -602,22 +609,23 @@ public class DomDocument if (namespaceURI != null && !XMLConstants.XML_NS_URI.equals(namespaceURI)) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xml namespace is always " + - XMLConstants.XML_NS_URI, this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xml namespace is always " + + XMLConstants.XML_NS_URI, this, 0); } namespaceURI = XMLConstants.XML_NS_URI; } else if (XMLConstants.XMLNS_ATTRIBUTE.equals(name) || name.startsWith("xmlns:")) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xmlns is reserved", this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xmlns is reserved", this, 0); } else if (namespaceURI == null && name.indexOf(':') != -1) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "prefixed name '" + name + "' needs a URI", this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "prefixed name '" + name + + "' needs a URI", this, 0); } Element element = new DomElement(this, namespaceURI, name); @@ -660,7 +668,7 @@ public class DomDocument */ public DocumentFragment createDocumentFragment() { - return new DomFragment(this); + return new DomDocumentFragment(this); } /** @@ -711,7 +719,7 @@ public class DomDocument { checkChar(value, "1.1".equals(version)); } - return new DomCDATA(this, value); + return new DomCDATASection(this, value); } /** @@ -723,7 +731,7 @@ public class DomDocument { checkChar(buf, off, len, "1.1".equals(version)); } - return new DomCDATA(this, buf, off, len); + return new DomCDATASection(this, buf, off, len); } /** @@ -739,12 +747,13 @@ public class DomDocument checkName(target, xml11); if ("xml".equalsIgnoreCase(target)) { - throw new DomEx(DomEx.SYNTAX_ERR, - "illegal PI target name", this, 0); + throw new DomDOMException(DOMException.SYNTAX_ERR, + "illegal PI target name", + this, 0); } checkChar(data, xml11); } - return new DomPI(this, target, data); + return new DomProcessingInstruction(this, target, data); } /** @@ -796,9 +805,10 @@ public class DomDocument } else if (!XMLConstants.XML_NS_URI.equals(namespaceURI)) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xml namespace is always " + - XMLConstants.XML_NS_URI, this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xml namespace is always " + + XMLConstants.XML_NS_URI, + this, 0); } } else if (XMLConstants.XMLNS_ATTRIBUTE.equals(name) || @@ -810,14 +820,15 @@ public class DomDocument } else if (!XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xmlns namespace must be " + - XMLConstants.XMLNS_ATTRIBUTE_NS_URI, this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xmlns namespace must be " + + XMLConstants.XMLNS_ATTRIBUTE_NS_URI, + this, 0); } } else if (namespaceURI == null && name.indexOf(':') != -1) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "prefixed name needs a URI: " + name, this, 0); } return new DomAttr(this, namespaceURI, name); @@ -913,7 +924,7 @@ public class DomDocument dst = createEntityReference(src.getNodeName()); break; case DOCUMENT_FRAGMENT_NODE: - dst = new DomFragment(this); + dst = new DomDocumentFragment(this); if (deep) { for (Node ctx = src.getFirstChild(); ctx != null; @@ -988,7 +999,7 @@ public class DomDocument // FALLTHROUGH // can't import unrecognized or nonstandard nodes default: - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, null, src, 0); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, null, src, 0); } // FIXME cleanup a bit -- for deep copies, copy those @@ -1083,7 +1094,7 @@ public class DomDocument } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } } @@ -1149,10 +1160,10 @@ public class DomDocument { case DOCUMENT_NODE: case DOCUMENT_TYPE_NODE: - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); case ENTITY_NODE: case NOTATION_NODE: - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } if (source instanceof DomNode) { @@ -1284,11 +1295,12 @@ public class DomDocument DomNsNode src = (DomNsNode) n; if (src == null) { - throw new DomEx(DomEx.NOT_FOUND_ERR); + throw new DomDOMException(DOMException.NOT_FOUND_ERR); } if (src.owner != this) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, null, src, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, src, 0); } boolean xml11 = "1.1".equals(version); checkName(qualifiedName, xml11); @@ -1305,7 +1317,7 @@ public class DomDocument if (XMLConstants.XML_NS_PREFIX.equals(prefix) && !XMLConstants.XML_NS_URI.equals(namespaceURI)) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "xml namespace must be " + XMLConstants.XML_NS_URI, src, 0); } @@ -1314,14 +1326,14 @@ public class DomDocument XMLConstants.XMLNS_ATTRIBUTE.equals(qualifiedName)) && !XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals(namespaceURI)) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "xmlns namespace must be " + XMLConstants.XMLNS_ATTRIBUTE_NS_URI, src, 0); } if (XMLConstants.XML_NS_URI.equals(namespaceURI) && !XMLConstants.XML_NS_PREFIX.equals(prefix)) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "xml namespace must be " + XMLConstants.XML_NS_URI, src, 0); } @@ -1330,7 +1342,7 @@ public class DomDocument !(XMLConstants.XMLNS_ATTRIBUTE.equals(prefix) || XMLConstants.XMLNS_ATTRIBUTE.equals(qualifiedName))) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "xmlns namespace must be " + XMLConstants.XMLNS_ATTRIBUTE_NS_URI, src, 0); } @@ -1343,7 +1355,7 @@ public class DomDocument // DOMElementNameChanged or DOMAttributeNameChanged return src; } - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, null, n, 0); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, null, n, 0); } // -- XPathEvaluator -- diff --git a/gnu/xml/dom/DomDocumentConfiguration.java b/gnu/xml/dom/DomDocumentConfiguration.java index eebee09bb..38d6e6d7b 100644 --- a/gnu/xml/dom/DomDocumentConfiguration.java +++ b/gnu/xml/dom/DomDocumentConfiguration.java @@ -99,8 +99,8 @@ class DomDocumentConfiguration } catch (ClassCastException e) { - throw new DomEx(DomEx.TYPE_MISMATCH_ERR, - value.getClass().getName(), null, 0); + throw new DomDOMException(DOMException.TYPE_MISMATCH_ERR, + value.getClass().getName(), null, 0); } } else if ("namespace-declarations".equals(name)) @@ -140,7 +140,8 @@ class DomDocumentConfiguration } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, name, null, 0); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, + name, null, 0); } } @@ -197,7 +198,7 @@ class DomDocumentConfiguration namespaceDeclarations == true && comments == true) ? Boolean.TRUE : Boolean.FALSE; } - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, name, null, 0); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, name, null, 0); } public boolean canSetParameter(String name, Object value) diff --git a/gnu/xml/dom/DomFragment.java b/gnu/xml/dom/DomDocumentFragment.java index 44763a956..f54b2a7eb 100644 --- a/gnu/xml/dom/DomFragment.java +++ b/gnu/xml/dom/DomDocumentFragment.java @@ -1,4 +1,4 @@ -/* DomFragment.java -- +/* DomDocumentFragment.java -- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -45,7 +45,7 @@ import org.w3c.dom.DocumentFragment; * @author David Brownell * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> */ -public class DomFragment +public class DomDocumentFragment extends DomNode implements DocumentFragment { @@ -58,7 +58,7 @@ public class DomFragment * its createDocumentFragment functionality, or through a subclass which * is similarly used in a "Sub-DOM" style layer. */ - protected DomFragment(DomDocument owner) + protected DomDocumentFragment(DomDocument owner) { super(DOCUMENT_FRAGMENT_NODE, owner); } diff --git a/gnu/xml/dom/DomElement.java b/gnu/xml/dom/DomElement.java index fb04638af..535608343 100644 --- a/gnu/xml/dom/DomElement.java +++ b/gnu/xml/dom/DomElement.java @@ -42,6 +42,7 @@ import java.util.Set; import javax.xml.XMLConstants; import org.w3c.dom.Attr; +import org.w3c.dom.DOMException; import org.w3c.dom.Element; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -262,7 +263,7 @@ public class DomElement if (("xmlns".equals (aname) || aname.startsWith ("xmlns:")) && !XMLConstants.XMLNS_ATTRIBUTE_NS_URI.equals (uri)) { - throw new DomEx(DomEx.NAMESPACE_ERR, + throw new DomDOMException(DOMException.NAMESPACE_ERR, "setting xmlns attribute to illegal value", this, 0); } @@ -318,9 +319,9 @@ public class DomElement { attributes.removeNamedItem(name); } - catch (DomEx e) + catch (DomDOMException e) { - if (e.code != DomEx.NOT_FOUND_ERR) + if (e.code != DOMException.NOT_FOUND_ERR) { throw e; } @@ -340,7 +341,7 @@ public class DomElement { if (attributes == null) { - throw new DomEx(DomEx.NOT_FOUND_ERR, null, node, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, null, node, 0); } return (Attr) attributes.removeNamedItem(node.getNodeName()); } @@ -358,7 +359,7 @@ public class DomElement { if (attributes == null) { - throw new DomEx(DomEx.NOT_FOUND_ERR, localPart, null, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, localPart, null, 0); } attributes.removeNamedItemNS (namespace, localPart); } @@ -487,11 +488,11 @@ public class DomElement { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } if (attr == null || attr.getOwnerElement() != this) { - throw new DomEx(DomEx.NOT_FOUND_ERR); + throw new DomDOMException(DOMException.NOT_FOUND_ERR); } if (isId) { diff --git a/gnu/xml/dom/DomImpl.java b/gnu/xml/dom/DomImpl.java index 1a16de325..feb7ea703 100644 --- a/gnu/xml/dom/DomImpl.java +++ b/gnu/xml/dom/DomImpl.java @@ -207,7 +207,8 @@ public class DomImpl root = doc.createElementNS(namespaceURI, rootName); if (rootName.startsWith("xmlns:")) { - throw new DomEx(DomEx.NAMESPACE_ERR, "xmlns is reserved", null, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xmlns is reserved", null, 0); } } // Bleech -- L2 seemingly _requires_ omission of xmlns attributes. diff --git a/gnu/xml/dom/DomIterator.java b/gnu/xml/dom/DomIterator.java index 3dfd96403..fb05d9308 100644 --- a/gnu/xml/dom/DomIterator.java +++ b/gnu/xml/dom/DomIterator.java @@ -39,6 +39,7 @@ package gnu.xml.dom; import java.util.Vector; +import org.w3c.dom.DOMException; import org.w3c.dom.Node; import org.w3c.dom.events.Event; import org.w3c.dom.events.EventListener; @@ -76,7 +77,7 @@ public final class DomIterator { if (!root.isSupported("MutationEvents", "2.0")) { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, "Iterator needs mutation events", root, 0); } @@ -154,7 +155,7 @@ public final class DomIterator { if (done) { - throw new DomEx(DomEx.INVALID_STATE_ERR); + throw new DomDOMException(DOMException.INVALID_STATE_ERR); } right = true; return walk(true); @@ -171,7 +172,7 @@ public final class DomIterator { if (done) { - throw new DomEx(DomEx.INVALID_STATE_ERR); + throw new DomDOMException(DOMException.INVALID_STATE_ERR); } Node previous = reference; right = false; diff --git a/gnu/xml/dom/DomNamedNodeMap.java b/gnu/xml/dom/DomNamedNodeMap.java index af7594249..2b1106e64 100644 --- a/gnu/xml/dom/DomNamedNodeMap.java +++ b/gnu/xml/dom/DomNamedNodeMap.java @@ -37,6 +37,7 @@ exception statement from your version. */ package gnu.xml.dom; +import org.w3c.dom.DOMException; import org.w3c.dom.NamedNodeMap; import org.w3c.dom.Node; @@ -166,24 +167,24 @@ public class DomNamedNodeMap { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } DomNode node = (DomNode) arg; if (node.owner != owner.owner) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR); } if (node.nodeType != type) { - throw new DomEx(DomEx.HIERARCHY_REQUEST_ERR); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR); } if (node.nodeType == Node.ATTRIBUTE_NODE) { DomNode element = node.parent; if (element != null && element != owner) { - throw new DomEx(DomEx.INUSE_ATTRIBUTE_ERR); + throw new DomDOMException(DOMException.INUSE_ATTRIBUTE_ERR); } node.parent = owner; node.depth = owner.depth + 1; @@ -302,7 +303,7 @@ public class DomNamedNodeMap { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } // report attribute REMOVAL event? @@ -369,7 +370,7 @@ public class DomNamedNodeMap return ctx; } } - throw new DomEx(DomEx.NOT_FOUND_ERR); + throw new DomDOMException(DOMException.NOT_FOUND_ERR); } String getDefaultValue(String name) diff --git a/gnu/xml/dom/DomNode.java b/gnu/xml/dom/DomNode.java index 3858fe8bb..74535eef6 100644 --- a/gnu/xml/dom/DomNode.java +++ b/gnu/xml/dom/DomNode.java @@ -308,15 +308,16 @@ public abstract class DomNode { if (readonly && !owner.building) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR, - null, this, 0); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, + null, this, 0); } for (DomNode ctx = this; ctx != null; ctx = ctx.parent) { if (child == ctx) { - throw new DomEx(DomEx.HIERARCHY_REQUEST_ERR, - "can't make ancestor into a child", this, 0); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR, + "can't make ancestor into a child", + this, 0); } } @@ -330,8 +331,8 @@ public abstract class DomNode // new in DOM L2, this case -- patch it up later, in reparent() if (!(childNodeType == DOCUMENT_TYPE_NODE && childOwner == null)) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, - null, child, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, child, 0); } } @@ -376,10 +377,12 @@ public abstract class DomNode } if (owner.checkingWellformedness) { - throw new DomEx(DomEx.HIERARCHY_REQUEST_ERR, - "can't append " + nodeTypeToString(childNodeType) + - " to node of type " + nodeTypeToString(nodeType), - this, 0); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR, + "can't append " + + nodeTypeToString(childNodeType) + + " to node of type " + + nodeTypeToString(nodeType), + this, 0); } } @@ -578,8 +581,8 @@ public abstract class DomNode } catch (ClassCastException e) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, - null, newChild, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, newChild, 0); } } @@ -630,12 +633,14 @@ public abstract class DomNode checkMisc(child); if (ref == null || ref.parent != this) { - throw new DomEx(DomEx.NOT_FOUND_ERR, null, ref, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, + null, ref, 0); } if (ref == child) { - throw new DomEx(DomEx.HIERARCHY_REQUEST_ERR, - "can't insert node before itself", ref, 0); + throw new DomDOMException(DOMException.HIERARCHY_REQUEST_ERR, + "can't insert node before itself", + ref, 0); } if (child.parent != null) @@ -672,8 +677,8 @@ public abstract class DomNode } catch (ClassCastException e) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, - null, newChild, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, newChild, 0); } } @@ -721,7 +726,8 @@ public abstract class DomNode } if (ref == null || ref.parent != this) { - throw new DomEx(DomEx.NOT_FOUND_ERR, null, ref, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, + null, ref, 0); } if (reportMutations) @@ -784,7 +790,8 @@ public abstract class DomNode checkMisc(child); if (ref == null || ref.parent != this) { - throw new DomEx(DomEx.NOT_FOUND_ERR, null, ref, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, + null, ref, 0); } if (reportMutations) @@ -837,8 +844,8 @@ public abstract class DomNode } catch (ClassCastException e) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, - null, newChild, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, newChild, 0); } } @@ -860,12 +867,13 @@ public abstract class DomNode if (ref == null || ref.parent != this) { - throw new DomEx(DomEx.NOT_FOUND_ERR, null, ref, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, + null, ref, 0); } if (readonly && !owner.building) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR, - null, this, 0); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, + null, this, 0); } for (DomNode child = first; child != null; child = child.next) @@ -909,13 +917,13 @@ public abstract class DomNode return ref; } } - throw new DomEx(DomEx.NOT_FOUND_ERR, - "that's no child of mine", refChild, 0); + throw new DomDOMException(DOMException.NOT_FOUND_ERR, + "that's no child of mine", refChild, 0); } catch (ClassCastException e) { - throw new DomEx(DomEx.WRONG_DOCUMENT_ERR, - null, refChild, 0); + throw new DomDOMException(DOMException.WRONG_DOCUMENT_ERR, + null, refChild, 0); } } @@ -1446,8 +1454,8 @@ public abstract class DomNode // mouse events - throw new DomEx(DomEx.NOT_SUPPORTED_ERR, - eventType, null, 0); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR, + eventType, null, 0); } /** diff --git a/gnu/xml/dom/DomNsNode.java b/gnu/xml/dom/DomNsNode.java index ea41fff6b..15b2fb542 100644 --- a/gnu/xml/dom/DomNsNode.java +++ b/gnu/xml/dom/DomNsNode.java @@ -38,6 +38,7 @@ exception statement from your version. */ package gnu.xml.dom; import javax.xml.XMLConstants; +import org.w3c.dom.DOMException; /** * <p> Abstract implemention of namespace support. This facilitates @@ -135,7 +136,7 @@ public abstract class DomNsNode { if (readonly) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } if (prefix == null) @@ -145,40 +146,42 @@ public abstract class DomNsNode } else if (namespace == null) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "can't set prefix, node has no namespace URI", - this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "can't set prefix, node has no namespace URI", + this, 0); } DomDocument.checkName(prefix, "1.1".equals(owner.getXmlVersion())); if (prefix.indexOf (':') != -1) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "illegal prefix " + prefix, this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "illegal prefix " + prefix, this, 0); } if (XMLConstants.XML_NS_PREFIX.equals(prefix) && !XMLConstants.XML_NS_URI.equals(namespace)) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xml namespace is always " + - XMLConstants.XML_NS_URI, this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xml namespace is always " + + XMLConstants.XML_NS_URI, this, 0); } if (XMLConstants.XMLNS_ATTRIBUTE.equals(prefix)) { if (namespace != null || getNodeType() != ATTRIBUTE_NODE) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "xmlns attribute prefix is reserved", this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "xmlns attribute prefix is reserved", + this, 0); } } else if (getNodeType () == ATTRIBUTE_NODE && (XMLConstants.XMLNS_ATTRIBUTE.equals(name) || name.startsWith("xmlns:"))) { - throw new DomEx(DomEx.NAMESPACE_ERR, - "namespace declarations can't change names", this, 0); + throw new DomDOMException(DOMException.NAMESPACE_ERR, + "namespace declarations can't change names", + this, 0); } this.prefix = prefix.intern(); diff --git a/gnu/xml/dom/DomPI.java b/gnu/xml/dom/DomProcessingInstruction.java index dedf37515..9697f33f7 100644 --- a/gnu/xml/dom/DomPI.java +++ b/gnu/xml/dom/DomProcessingInstruction.java @@ -1,4 +1,4 @@ -/* DomPI.java -- +/* DomProcessingInstruction.java -- Copyright (C) 1999,2000,2001,2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,6 +37,7 @@ exception statement from your version. */ package gnu.xml.dom; +import org.w3c.dom.DOMException; import org.w3c.dom.ProcessingInstruction; /** @@ -57,7 +58,7 @@ import org.w3c.dom.ProcessingInstruction; * @author David Brownell * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> */ -public class DomPI +public class DomProcessingInstruction extends DomNode implements ProcessingInstruction { @@ -73,7 +74,8 @@ public class DomPI * part of its createProcessingInstruction functionality, or through * a subclass which is similarly used in a "Sub-DOM" style layer. */ - protected DomPI(DomDocument owner, String target, String data) + protected DomProcessingInstruction(DomDocument owner, + String target, String data) { super(PROCESSING_INSTRUCTION_NODE, owner); this.target = target; @@ -136,7 +138,7 @@ public class DomPI { if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } this.data = data; } diff --git a/gnu/xml/dom/DomText.java b/gnu/xml/dom/DomText.java index d714655e6..dc2d50a8e 100644 --- a/gnu/xml/dom/DomText.java +++ b/gnu/xml/dom/DomText.java @@ -102,7 +102,7 @@ public class DomText { if (isReadonly()) { - throw new DomEx(DomEx.NO_MODIFICATION_ALLOWED_ERR); + throw new DomDOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR); } try { @@ -134,7 +134,7 @@ public class DomText } catch (IndexOutOfBoundsException x) { - throw new DomEx(DomEx.INDEX_SIZE_ERR); + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); } } diff --git a/gnu/xml/dom/ls/DomLSEx.java b/gnu/xml/dom/ls/DomLSException.java index 5bf159536..7b9d13e5b 100644 --- a/gnu/xml/dom/ls/DomLSEx.java +++ b/gnu/xml/dom/ls/DomLSException.java @@ -1,4 +1,4 @@ -/* DomLSEx.java -- +/* DomLSException.java -- Copyright (C) 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -46,30 +46,14 @@ import org.w3c.dom.ls.LSException; * * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> */ -public class DomLSEx +public class DomLSException extends LSException { - private final Exception cause2; - - public DomLSEx(short type, Exception cause) + public DomLSException(short type, Exception cause) { - super(type, cause.getMessage()); - cause2 = cause; + super(type, (cause == null) ? null : cause.getMessage()); + initCause(cause); } - public void printStackTrace(PrintStream out) - { - super.printStackTrace(out); - out.print("caused by "); - cause2.printStackTrace(out); - } - - public void printStackTrace(PrintWriter out) - { - super.printStackTrace(out); - out.print("caused by "); - cause2.printStackTrace(out); - } - } diff --git a/gnu/xml/dom/ls/DomLSParser.java b/gnu/xml/dom/ls/DomLSParser.java index b050b99a1..489777fc9 100644 --- a/gnu/xml/dom/ls/DomLSParser.java +++ b/gnu/xml/dom/ls/DomLSParser.java @@ -65,7 +65,7 @@ import org.xml.sax.SAXNotRecognizedException; import org.xml.sax.SAXParseException; import org.xml.sax.XMLReader; import gnu.xml.dom.DomDocument; -import gnu.xml.dom.DomEx; +import gnu.xml.dom.DomDOMException; /** * Parser implementation for GNU DOM. @@ -117,7 +117,7 @@ public class DomLSParser async = false; break; default: - throw new DomEx(DOMException.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } // TODO schemaType this.schemaType = schemaType; @@ -307,13 +307,13 @@ public class DomLSParser { reader = null; eventSink = null; - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } catch (IOException e) { reader = null; eventSink = null; - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } // return document Document ret = eventSink.doc; @@ -341,11 +341,11 @@ public class DomLSParser } catch (ParserConfigurationException e) { - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } catch (SAXException e) { - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } } return reader; @@ -371,11 +371,11 @@ public class DomLSParser } catch (SAXException e) { - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } catch (IOException e) { - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } } if (source == null) @@ -403,7 +403,7 @@ public class DomLSParser } catch (IOException e) { - throw new DomLSEx(LSException.PARSE_ERR, e); + throw new DomLSException(LSException.PARSE_ERR, e); } } return source; @@ -457,7 +457,7 @@ public class DomLSParser } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } // invalidate reader, a new one will be created reader = null; @@ -509,7 +509,7 @@ public class DomLSParser } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } } diff --git a/gnu/xml/dom/ls/DomLSSerializer.java b/gnu/xml/dom/ls/DomLSSerializer.java index 91a01c96e..ec27c5de6 100644 --- a/gnu/xml/dom/ls/DomLSSerializer.java +++ b/gnu/xml/dom/ls/DomLSSerializer.java @@ -58,7 +58,7 @@ import org.w3c.dom.ls.LSOutput; import org.w3c.dom.ls.LSSerializer; import org.w3c.dom.ls.LSSerializerFilter; import org.w3c.dom.traversal.NodeFilter; -import gnu.xml.dom.DomEx; +import gnu.xml.dom.DomDOMException; import gnu.xml.transform.StreamSerializer; /** @@ -147,7 +147,7 @@ public class DomLSSerializer } catch (IOException e) { - throw new DomLSEx(LSException.SERIALIZE_ERR, e); + throw new DomLSException(LSException.SERIALIZE_ERR, e); } } @@ -302,7 +302,7 @@ public class DomLSSerializer } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } } @@ -319,7 +319,7 @@ public class DomLSSerializer } else { - throw new DomEx(DomEx.NOT_SUPPORTED_ERR); + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); } } diff --git a/gnu/xml/util/SAXNullTransformerFactory.java b/gnu/xml/util/SAXNullTransformerFactory.java index 3b199f6dc..ef03d42fc 100644 --- a/gnu/xml/util/SAXNullTransformerFactory.java +++ b/gnu/xml/util/SAXNullTransformerFactory.java @@ -635,7 +635,8 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory // preserve original namespace prefixes try { - producer.setFeature(handler.FEATURE_URI + "namespace-prefixes", + producer.setFeature(EventFilter.FEATURE_URI + + "namespace-prefixes", true); } catch (Exception e) @@ -646,7 +647,7 @@ public class SAXNullTransformerFactory extends SAXTransformerFactory // arrange the output handler.setResult (out); - handler.bind (producer, handler); + EventFilter.bind (producer, handler); // then parse ... single element pipeline producer.parse (input); diff --git a/gnu/xml/xpath/Predicate.java b/gnu/xml/xpath/Predicate.java index 81e1755fb..a857c16bb 100644 --- a/gnu/xml/xpath/Predicate.java +++ b/gnu/xml/xpath/Predicate.java @@ -63,7 +63,7 @@ class Predicate // Same as [position() = x] return ((Double) ret).intValue() == pos; } - return expr._boolean(node, expr.evaluate(node, pos, len)); + return Expr._boolean(node, expr.evaluate(node, pos, len)); } public Test clone(Object context) |