diff options
author | Chris Burdess <dog@bluezoo.org> | 2007-01-26 19:57:42 +0000 |
---|---|---|
committer | Chris Burdess <dog@bluezoo.org> | 2007-01-26 19:57:42 +0000 |
commit | 8b83f7e509b57379e327b1f134209f172da0b7c7 (patch) | |
tree | 40b436d4ce368fd4cb0e4a99349503128255a969 /gnu/xml | |
parent | 06efa3d42c31119b1a6f0896244f5434853e6f7c (diff) | |
download | classpath-8b83f7e509b57379e327b1f134209f172da0b7c7.tar.gz |
2007-01-26 Chris Burdess <dog@gnu.org>
Fixes #30597
* gnu/xml/dom/DomDocumentBuilder.java: Throw IOException where cause
of LSException is an IOException.
* gnu/xml/dom/ls/DomLSParser.java,
gnu/xml/stream/SAXParser.java: Ensure coalescing feature is set
correctly during LS parsing.
Diffstat (limited to 'gnu/xml')
-rw-r--r-- | gnu/xml/dom/DomDocumentBuilder.java | 55 | ||||
-rw-r--r-- | gnu/xml/dom/ls/DomLSParser.java | 11 | ||||
-rw-r--r-- | gnu/xml/stream/SAXParser.java | 4 |
3 files changed, 63 insertions, 7 deletions
diff --git a/gnu/xml/dom/DomDocumentBuilder.java b/gnu/xml/dom/DomDocumentBuilder.java index 343f48c13..e62ce2076 100644 --- a/gnu/xml/dom/DomDocumentBuilder.java +++ b/gnu/xml/dom/DomDocumentBuilder.java @@ -1,5 +1,5 @@ /* DomDocumentBuilder.java -- - Copyright (C) 2004,2006 Free Software Foundation, Inc. + Copyright (C) 2004,2006,2007 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -48,6 +48,7 @@ import org.w3c.dom.Document; import org.w3c.dom.DOMConfiguration; import org.w3c.dom.DOMImplementation; import org.w3c.dom.ls.DOMImplementationLS; +import org.w3c.dom.ls.LSException; import org.w3c.dom.ls.LSInput; import org.w3c.dom.ls.LSParser; import org.xml.sax.EntityResolver; @@ -122,7 +123,18 @@ class DomDocumentBuilder { LSInput input = ls.createLSInput(); input.setByteStream(in); - return parser.parse(input); + try + { + return parser.parse(input); + } + catch (LSException e) + { + Throwable e2 = e.getCause(); + if (e2 instanceof IOException) + throw (IOException) e2; + else + throw e; + } } public Document parse(InputStream in, String systemId) @@ -131,13 +143,35 @@ class DomDocumentBuilder LSInput input = ls.createLSInput(); input.setByteStream(in); input.setSystemId(systemId); - return parser.parse(input); + try + { + return parser.parse(input); + } + catch (LSException e) + { + Throwable e2 = e.getCause(); + if (e2 instanceof IOException) + throw (IOException) e2; + else + throw e; + } } public Document parse(String systemId) throws SAXException, IOException { - return parser.parseURI(systemId); + try + { + return parser.parseURI(systemId); + } + catch (LSException e) + { + Throwable e2 = e.getCause(); + if (e2 instanceof IOException) + throw (IOException) e2; + else + throw e; + } } public Document parse(InputSource is) @@ -176,7 +210,18 @@ class DomDocumentBuilder input.setPublicId(is.getPublicId()); input.setSystemId(systemId); input.setEncoding(is.getEncoding()); - return parser.parse(input); + try + { + return parser.parse(input); + } + catch (LSException e) + { + Throwable e2 = e.getCause(); + if (e2 instanceof IOException) + throw (IOException) e2; + else + throw e; + } } } diff --git a/gnu/xml/dom/ls/DomLSParser.java b/gnu/xml/dom/ls/DomLSParser.java index 7ac4cc749..02bb29413 100644 --- a/gnu/xml/dom/ls/DomLSParser.java +++ b/gnu/xml/dom/ls/DomLSParser.java @@ -1,5 +1,5 @@ /* DomLSParser.java -- - Copyright (C) 1999,2000,2001 Free Software Foundation, Inc. + Copyright (C) 1999,2000,2001,2007 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -277,6 +277,15 @@ public class DomLSParser validating); try { + reader.setFeature("http://gnu.org/sax/features/coalescing", + coalescing); + } + catch (SAXNotRecognizedException e) + { + // ignore + } + try + { reader.setFeature("http://xml.org/sax/features/use-attributes2", true); } diff --git a/gnu/xml/stream/SAXParser.java b/gnu/xml/stream/SAXParser.java index 1329ab297..af4a6af42 100644 --- a/gnu/xml/stream/SAXParser.java +++ b/gnu/xml/stream/SAXParser.java @@ -1,5 +1,5 @@ /* SAXParser.java -- - Copyright (C) 2005, 2006 Free Software Foundation, Inc. + Copyright (C) 2005, 2006, 2007 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -187,6 +187,8 @@ public class SAXParser lexicalHandler = (LexicalHandler) value; else if ((GNU_FEATURES + "xml-base").equals(name)) baseAware = Boolean.TRUE.equals(value); + else if ((GNU_FEATURES + "coalescing").equals(name)) + coalescing = Boolean.TRUE.equals(value); else throw new SAXNotSupportedException(name); } |