If you want to revert this , go ahead. I didn't intend to commit it yet. However, this code is correct :-) The problem is that the URLs that are coming in are invalid. I'm pretty sure that they are created with file.toURL() which is deprecated because it is really broken. You're supposed to use file.toURI().toURL() which will properly encode the spaces.
I attached a patch to OPENEJB-1252 to try to fix up all the file to URL conversions but I haven't got a successful build yet. thanks david jencks On Apr 19, 2010, at 7:47 PM, Kevan Miller wrote: > > On Apr 4, 2010, at 6:33 PM, [email protected] wrote: > >> Author: djencks >> Date: Sun Apr 4 22:33:42 2010 >> New Revision: 930761 >> >> URL: http://svn.apache.org/viewvc?rev=930761&view=rev >> Log: >> OPENEJB-1253 allow mdbs to call isCallerInRole() >> >> Modified: >> >> openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/core/mdb/MdbContext.java >> >> openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/URLs.java >> >> openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/EntityBean.java >> >> openejb/trunk/openejb3/container/openejb-jee/src/main/java/org/apache/openejb/jee/SessionBean.java > > <snip> > >> >> Modified: >> openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/URLs.java >> URL: >> http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/URLs.java?rev=930761&r1=930760&r2=930761&view=diff >> ============================================================================== >> --- >> openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/URLs.java >> (original) >> +++ >> openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/util/URLs.java >> Sun Apr 4 22:33:42 2010 >> @@ -16,10 +16,9 @@ >> */ >> package org.apache.openejb.util; >> >> -import static org.apache.openejb.loader.JarLocation.decode; >> - >> import java.io.File; >> import java.net.MalformedURLException; >> +import java.net.URISyntaxException; >> import java.net.URL; >> >> /** >> @@ -43,7 +42,11 @@ public class URLs { >> throw new IllegalStateException(e); >> } >> } else if ("file".equals(url.getProtocol())) { >> - return new File(decode(url.getFile())); >> + try { >> + return new File(url.toURI().getPath()); >> + } catch (URISyntaxException e) { >> + throw new IllegalArgumentException("bad url " + >> url.toExternalForm(), e); >> + } >> } else { >> throw new IllegalArgumentException("Unsupported URL scheme: " + >> url.toExternalForm()); >> } > > Was this an intentional change? This is breaking deployments on Geronimo 2.2 > on Windows machine in directories containing space characters. Were you > fixing a problem? Or did you not like the code? Doesn't seem to fit with the > rest of your commit. > > Since this is causing obvious problems, I'm going to revert this portion of > your change tomorrow -- unless you can explain why I shouldn't. > > --kevan
