ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 19829] New: - Entity Reference not expanding ../ in <!Entity. No Protocol
Date Sun, 11 May 2003 03:54:14 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19829>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=19829

Entity Reference not expanding ../ in <!Entity. No Protocol

           Summary: Entity Reference not expanding ../ in <!Entity. No
                    Protocol
           Product: Ant
           Version: 1.5.2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: dwat001@hotmail.com


in some situations ProjectHelperImpl.RootHandler.resolveEntity is being called
with ../common/targets.xml instead of file:c:/path/to/project/common/targers.xml
causing a No Protocol Error.

steps to reproduce.
down load jwsdp1.1 including the tutorial.
copy C:\jwsdp-1.1\docs\tutorial\examples\jaxrpc to another directory [in my case
C:\Documents and Settings\USER.DOMAIN\My Documents\Projects]

cd into new directory
>cd hello
>ant

OUTPUT:
Buildfile: build.xml

BUILD FAILED
Error reading project file: no protocol: ../common/targets.xml

Total time: 1 second

>ant -debug

ERROR-STREAM


BUILD FAILED
Error reading project file: no protocol: ../common/targets.xml
	at org.apache.tools.ant.helper.ProjectHelperImpl.parse(ProjectHelperImpl.java:183)
	at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:117)
	at org.apache.tools.ant.Main.runBuild(Main.java:597)
	at org.apache.tools.ant.Main.start(Main.java:196)
	at org.apache.tools.ant.Main.main(Main.java:235)
Caused by: java.net.MalformedURLException: no protocol: ../common/targets.xml
	at java.net.URL.<init>(URL.java:579)
	at java.net.URL.<init>(URL.java:476)
	at java.net.URL.<init>(URL.java:425)
	at org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:881)
	at org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:792)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEntityReference(XMLDocumentFragmentScannerImpl.java:1159)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1577)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:346)
	at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:529)
	at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:585)
	at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1142)
	at org.apache.tools.ant.helper.ProjectHelperImpl.parse(ProjectHelperImpl.java:155)
	... 4 more
--- Nested Exception ---
java.net.MalformedURLException: no protocol: ../common/targets.xml
	at java.net.URL.<init>(URL.java:579)
	at java.net.URL.<init>(URL.java:476)
	at java.net.URL.<init>(URL.java:425)
	at org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:881)
	at org.apache.xerces.impl.XMLEntityManager.startEntity(XMLEntityManager.java:792)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEntityReference(XMLDocumentFragmentScannerImpl.java:1159)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(XMLDocumentFragmentScannerImpl.java:1577)
	at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:346)
	at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:529)
	at org.apache.xerces.parsers.DTDConfiguration.parse(DTDConfiguration.java:585)
	at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:152)
	at org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1142)
	at org.apache.tools.ant.helper.ProjectHelperImpl.parse(ProjectHelperImpl.java:155)
	at org.apache.tools.ant.ProjectHelper.configureProject(ProjectHelper.java:117)
	at org.apache.tools.ant.Main.runBuild(Main.java:597)
	at org.apache.tools.ant.Main.start(Main.java:196)
	at org.apache.tools.ant.Main.main(Main.java:235)

Total time: 1 second

STANDARD OUT
...
...
resolving systemId: ../common/targets.xml



when run from the install location the same line of the debug out put says
resolving systemId:
file:c:/jwsdp-1.1/docs/tutorial/examples/jaxrpc/common/targets.xml


I did what I suspect is a nasty fix

public InputSource resolveEntity(String publicId,
                                         String systemId) {

	   
	    helperImpl.project.log("resolving systemId: " + e.getStackTrace(),
Project.MSG_VERBOSE);
	    
	    
	    if(systemId.startsWith("../")){
	        String path = systemId.substring(2);
		path = helperImpl.getBuildFileParent().getParent().replace('\\', '/') + path;
		path = "file:" + path;
		helperImpl.project.log("Translating systemId ["+systemId+"]-->["+path+"] ",
Project.MSG_VERBOSE);
		systemId = path;
	    }
		    

	    helperImpl.project.log("resolving systemId : " + systemId ,
Project.MSG_VERBOSE);

Mime
View raw message