Resolved #SWS-61: DomContentHandler throwing NullpointerExption on document

This commit is contained in:
Arjen Poutsma
2006-11-14 12:41:20 +00:00
parent ce6f562937
commit eae86947ac
2 changed files with 34 additions and 10 deletions

View File

@@ -37,11 +37,11 @@ import org.xml.sax.helpers.DefaultHandler;
*/
public class DomContentHandler extends DefaultHandler {
private Document document;
private final Document document;
private List elements = new ArrayList();
private final List elements = new ArrayList();
private Node node;
private final Node node;
/**
* Creates a new instance of the <code>DomContentHandler</code> with the given node.
@@ -54,6 +54,10 @@ public class DomContentHandler extends DefaultHandler {
if (node instanceof Document) {
document = (Document) node;
}
else {
document = node.getOwnerDocument();
}
Assert.notNull(document, "document must not be null");
}
private Node getParent() {