I think if found a possible workaround...
It involves using the URL.setURLStreamHandlerFactory(..) method to implement
custom Protocol handlers for file and jar.
We just encode the URL ' ' with '+''es..
I'm going to clean up a bit and post some source in a little bit..
Regards,
Hiram
>From: "Scott M Stark" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: <[EMAIL PROTECTED]>
>Subject: Re: [JBoss-dev] (no subject)
>Date: Fri, 24 Aug 2001 15:46:16 -0700
>
>This may due to existing bug report on File.toURL() not escaping chars
>correctly. Here is a trival example that demonstrates the problem:
>
>Space Here 1162>ls
>ASerializable.java ser.jar tstMO.class tstMO.java
>Space Here 1163>pwd
>/tmp/Space Here
>Space Here 1164>java tstMO
>cwd = file:/tmp/Space Here/./
>serializable class = class java.lang.Class
>serializable codesource = null
>Exception in thread "main" java.net.MalformedURLException: no protocol:
>Here/./ser.jar
> at java.net.URL.<init>(URL.java:473)
> at java.net.URL.<init>(URL.java:376)
> at java.net.URL.<init>(URL.java:330)
> at sun.rmi.server.LoaderHandler.pathToURLs(LoaderHandler.java:387)
> at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:132)
> at
>sun.rmi.server.MarshalInputStream.resolveClass(MarshalInputStream.java:143)
> at
>java.io.ObjectInputStream.inputClassDescriptor(ObjectInputStream.java:918)
> at
>java.io.ObjectInputStream.readObject(ObjectInputStream.java:366)
> at
>java.io.ObjectInputStream.readObject(ObjectInputStream.java:350)
> at
>java.io.ObjectInputStream.readObject(ObjectInputStream.java:236)
> at java.rmi.MarshalledObject.get(MarshalledObject.java:138)
> at tstMO.main(tstMO.java:21)
>Space Here 1165>cat tstMO.java
>import java.io.*;
>import java.net.*;
>import java.rmi.*;
>import java.security.*;
>
>class tstMO
>{
> public static void main(String[] args) throws Exception
> {
> File cwd = new File(".");
> File jarFile = new File(cwd, "ser.jar");
> System.out.println("cwd = "+cwd.toURL());
> URL[] urls = {jarFile.toURL()};
> URLClassLoader cl = new URLClassLoader(urls);
> Object serializable = cl.loadClass("ASerializable");
> Class sc = serializable.getClass();
> System.out.println("serializable class = "+sc);
> CodeSource cs = sc.getProtectionDomain().getCodeSource();
> System.out.println("serializable codesource = "+cs);
> MarshalledObject mo = new MarshalledObject(serializable);
> System.out.println("mo.get() ->"+mo.get());
> }
>}
>
>Space Here 1166>cat ASerializable.java
>
>public class ASerializable implements java.io.Serializable
>{
>}
>Space Here 1167>jar -tf ser.jar
>META-INF/
>META-INF/MANIFEST.MF
>ASerializable.class
>Space Here 1168>
>
>----- Original Message -----
>From: "Scott M Stark" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Friday, August 24, 2001 3:07 PM
>Subject: Re: [JBoss-dev] (no subject)
>
>
> > This looks to be a bug in the sun.rmi.server.LoaderHandler class as
> > it takes the URLs from the class's URLClassLoader and converts these
> > into a space seperated list of url strings for use as the codebase, but
> > these are not x-www-form-urlencoded string and so they will contain
> > spaces if the file url contains a space. Thus, when the codebase is
>parsed
> > into url strings by spaces the result is invalid url strings.
> >
> > The only workaround I can see at this point is to not install the server
>in
> > a directory with spaces.
> >
>
>
>
>_______________________________________________
>Jboss-development mailing list
>[EMAIL PROTECTED]
>http://lists.sourceforge.net/lists/listinfo/jboss-development
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/jboss-development