Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 316584

Summary: Jetty fails to start when temporary directory path contains space and extractWAR=false
Product: [RT] Jetty Reporter: Cédric Chabanois <cchabanois>
Component: serverAssignee: Michael Gorovoy <mgorovoy>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: jetty-inbox, mgorovoy
Version: unspecified   
Target Milestone: 7.0.2.RC0   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Cédric Chabanois CLA 2010-06-11 06:07:37 EDT
Build Identifier: 

This bug is very similar to https://bugs.eclipse.org/bugs/show_bug.cgi?id=285906 which has been closed but it only occurs when extractWAR=false

2010-06-11 12:04:02.890:INFO::jetty-7.1.3.v20100526
2010-06-11 12:04:02.906:INFO::Deployment monitor D:\server\jetty-distribution-7.
1.3.v20100526\contexts at interval 5
2010-06-11 12:04:02.906:INFO::Deployable added: D:\server\jetty-distribution-7.1
.3.v20100526\contexts\test.xml
2010-06-11 12:04:02.952:INFO::Copying WEB-INF/lib jar:file:/D:/server/jetty-dist
ribution-7.1.3.v20100526/webapps/test.war!/WEB-INF/lib/ to C:\Documents and Sett
ings\cedric.ENTROPYSOFT\Local Settings\Temp\Jetty_0_0_0_0_8080_test.war____.hcx1
33\webinf\WEB-INF\lib
2010-06-11 12:04:02.984:INFO::Copying WEB-INF/classes from jar:file:/D:/server/j
etty-distribution-7.1.3.v20100526/webapps/test.war!/WEB-INF/classes/ to C:\Docum
ents and Settings\cedric.ENTROPYSOFT\Local Settings\Temp\Jetty_0_0_0_0_8080_test
.war____.hcx133\webinf\WEB-INF\classes
2010-06-11 12:04:03.015:WARN::Failed startup of context WebAppContext@d6c16c@d6c
16c/,file:/C:/Documents and Settings/cedric.ENTROPYSOFT/Local Settings/Temp/Jett
y_0_0_0_0_8080_test.war____.hcx133/webinf/;jar:file:/D:/server/jetty-distributio
n-7.1.3.v20100526/webapps/test.war!/;,D:\server\jetty-distribution-7.1.3.v201005
26/webapps/test.war
java.lang.RuntimeException: java.net.URISyntaxException: Illegal character in pa
th at index 18: file:/C:/Documents and Settings/cedric.ENTROPYSOFT/Local Setting
s/Temp/Jetty_0_0_0_0_8080_test.war____.hcx133/webinf/WEB-INF/lib/jetty-client-7.
1.3.v20100526.jar
        at org.eclipse.jetty.util.resource.Resource.getURI(Resource.java:358)
        at org.eclipse.jetty.webapp.WebInfConfiguration.preConfigure(WebInfConfi
guration.java:107)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:379
)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLife
Cycle.java:55)
        at org.eclipse.jetty.deploy.bindings.StandardStarter.processBinding(Stan
dardStarter.java:36)
        at org.eclipse.jetty.deploy.AppLifeCycle.runBindings(AppLifeCycle.java:1
82)
        at org.eclipse.jetty.deploy.DeploymentManager.requestAppGoal(DeploymentM
anager.java:497)
        at org.eclipse.jetty.deploy.DeploymentManager.addApp(DeploymentManager.j
ava:135)
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider$1.fileAdded(Sc
anningAppProvider.java:61)
        at org.eclipse.jetty.util.Scanner.reportAddition(Scanner.java:436)
        at org.eclipse.jetty.util.Scanner.reportDifferences(Scanner.java:349)
        at org.eclipse.jetty.util.Scanner.scan(Scanner.java:306)
        at org.eclipse.jetty.util.Scanner.start(Scanner.java:242)
        at org.eclipse.jetty.deploy.providers.ScanningAppProvider.doStart(Scanni
ngAppProvider.java:136)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLife
Cycle.java:55)
        at org.eclipse.jetty.deploy.DeploymentManager.startAppProvider(Deploymen
tManager.java:562)
        at org.eclipse.jetty.deploy.DeploymentManager.doStart(DeploymentManager.
java:212)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLife
Cycle.java:55)
        at org.eclipse.jetty.server.Server.doStart(Server.java:209)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLife
Cycle.java:55)
        at org.eclipse.jetty.xml.XmlConfiguration$1.run(XmlConfiguration.java:10
18)
        at java.security.AccessController.doPrivileged(Native Method)
        at org.eclipse.jetty.xml.XmlConfiguration.main(XmlConfiguration.java:983
)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at org.eclipse.jetty.start.Main.invokeMain(Main.java:447)
        at org.eclipse.jetty.start.Main.start(Main.java:605)
        at org.eclipse.jetty.start.Main.parseCommandLine(Main.java:238)
        at org.eclipse.jetty.start.Main.main(Main.java:77)

Reproducible: Always

Steps to Reproduce:
1. extract jetty-distribution-7.1.3.v20100526.zip
2. set temp directory to a directory with space (by default mine had spaces )
3. Modify contexts/test.xml and set "extractWAR" to false
4. java -jar start.jar
Comment 1 Michael Gorovoy CLA 2010-06-14 23:16:48 EDT
It took me a while to track this one down because I've been initially chasing it in the wrong direction (lesson learned...) but at the end of the day (literally...) it turned out to be a very simple fix by replacing a call to File.toUrl() with a call to File.getCanonicalPath() that ultimately takes advantage of path encoding by Resource.newResource() implementation.

Committed r2002.