[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug classpath/35589] New: Bug in SAXParser.java / XMLParser.java
From: |
bstroesser at fujitsu-siemens dot com |
Subject: |
[Bug classpath/35589] New: Bug in SAXParser.java / XMLParser.java |
Date: |
14 Mar 2008 17:46:28 -0000 |
When gnu/xml/stream/SAXParser.resolveEntity() calls
entityResolver.resolveEntity(publicId, systemId), an object InputSource is
returned, which may "contain" an ByteStream (InputStream) or CharacterStream
(Reader). Unfortunately, the code doesn't handle the case of CharacterStream.
Thus, EntityResolvers don't work, if they use an CharacterStream in
InputSource.
The problem shows up, when using STAF/STAX on an openSuse 10.3, containing
classpath-0.95. AFAICS, there is no change in newer versions of classpath.
Here is a patch, that fixes the problem for me. I don't know, whether this is a
consistent change, but at least it will help to explain the problem.
Best Regards
Bodo
================================================================================
--- classpath-0.95/gnu/xml/stream/SAXParser.java.orig 2008-03-14
12:09:07.000000000 +0100
+++ classpath-0.95/gnu/xml/stream/SAXParser.java 2008-03-14
12:11:08.000000000 +0100
@@ -914,6 +914,9 @@ public class SAXParser
entityResolver.resolveEntity(publicId, systemId);
if (input != null)
{
+ Reader r = input.getCharacterStream();
+ if (r != null)
+ return r;
InputStream in = input.getByteStream();
if (in == null)
{
--- classpath-0.95/gnu/xml/stream/XMLParser.java.orig 2008-03-14
16:45:00.000000000 +0100
+++ classpath-0.95/gnu/xml/stream/XMLParser.java 2008-03-14
16:50:28.000000000 +0100
@@ -1555,19 +1555,23 @@
if (name == null || "".equals(name))
report = false;
InputStream in = null;
+ Reader r = null;
if (resolver != null)
{
Object obj = resolver.resolveEntity(ids.publicId, url, getXMLBase(),
null);
if (obj instanceof InputStream)
in = (InputStream) obj;
+ if (obj instanceof Reader)
+ r = (Reader) obj;
}
- if (in == null)
+ if (in == null && r == null) {
in = resolve(url);
- if (in == null)
- error("unable to resolve external entity",
- (ids.systemId != null) ? ids.systemId : ids.publicId);
- pushInput(new Input(in, null, ids.publicId, url, name, null, report,
+ if (in == null)
+ error("unable to resolve external entity",
+ (ids.systemId != null) ? ids.systemId : ids.publicId);
+ }
+ pushInput(new Input(in, r, ids.publicId, url, name, null, report,
normalize));
input.init();
if (tryRead(TEST_XML_DECL))
--
Summary: Bug in SAXParser.java / XMLParser.java
Product: classpath
Version: unspecified
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: classpath
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bstroesser at fujitsu-siemens dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35589
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Bug classpath/35589] New: Bug in SAXParser.java / XMLParser.java,
bstroesser at fujitsu-siemens dot com <=