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/20 14:59:01 UTC
[Bug 1042] New - DefaultReaderFactory.createReader does not honor EntityResolver SystemID
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=1042
*** shadow/1042 Tue Mar 20 05:59:01 2001
--- shadow/1042.tmp.10938 Tue Mar 20 05:59:01 2001
***************
*** 0 ****
--- 1,69 ----
+ +============================================================================+
+ | DefaultReaderFactory.createReader does not honor EntityResolver SystemID |
+ +----------------------------------------------------------------------------+
+ | Bug #: 1042 Product: Xerces-J |
+ | Status: NEW Version: 1.2.3 |
+ | Resolution: Platform: All |
+ | Severity: Normal OS/Version: All |
+ | Priority: Component: Core |
+ +----------------------------------------------------------------------------+
+ | Assigned To: xerces-j-dev@xml.apache.org |
+ | Reported By: kcritz@mathworks.com |
+ | CC list: Cc: |
+ +----------------------------------------------------------------------------+
+ | URL: |
+ +============================================================================+
+ | DESCRIPTION |
+ I am experiencing a bug when using EntityResolvers with Xerces.
+
+
+ In DefaultEntityHandler.startReadingFromExternalEntity, fResolver
+ is given the chance to resolve an InputSource. Fair enough.
+
+
+ But for some reason in the call to fReaderFactory.createReader, the
+ original (unresolved) SystemID is passed in. If the InputSource
+ created by the resolver has a null getByteStream, the original
+ unresolved SystemID is used to open the byte stream.
+
+
+ This is the only place in createReader where the systemID is used.
+ Doesn't it make more sense to use InputSource.getSystemID here instead?
+
+
+ I am trying to use my EntityResolver to redirect http:// references
+ to file:// references when I know that a local copy of a resource
+ exists. It makes sense that I should just be able to resolve
+ the SystemID. Currently, I am forced to open a ByteStream inside
+ the EntityResolver as a workaround.
+
+
+ -------------------------------------------------------
+ Suggested Bug Fix:
+
+
+ in DefaultReaderFactory.createReader:
+
+
+ change this:
+ if (is == null) {
+
+
+ // create url and open the stream
+ URL url = new URL(systemId);
+ is = url.openStream();
+ }
+
+
+ to this:
+
+
+ if (is == null) {
+
+
+ // create url and open the stream
+ String urlSystemID = source.getSystemID();
+ if (urlSystemID == null) urlSystemID = systemID;
+ URL url = new URL(urlSystemId);
+ is = url.openStream();
+ }
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org