It would also break doing things like.

url.openStream()

Cause it does not expect the file url to be URLEncoded.

Regards,
Hiram


>From: "Dain Sundstrom" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: <[EMAIL PROTECTED]>
>Subject: Re: [JBoss-dev] (no subject)
>Date: Sat, 25 Aug 2001 10:16:47 -0500
>
>Can we just construct the url by hand before it is loaded into the class
>loader?
>
>Here is the code for toURL()
>
>public URL toURL() throws MalformedURLException {
>     String path = getAbsolutePath();
>     if (File.separatorChar != '/') {
>         path = path.replace(File.separatorChar, '/');
>     }
>     if (!path.startsWith("/")) {
>         path = "/" + path;
>     }
>     if (!path.endsWith("/") && isDirectory()) {
>         path = path + "/";
>     }
>     return new URL("file", "", path);
>}
>
>We then just write a new function to do a toURL with the last line changed
>to:
>
>     return new URL("file", "", URLEncoder.encode(path));
>
>Of course this only works if we control the code that constructs the url.
>
>-dain
>
>
>----- Original Message -----
>From: "Hiram Chirino" <[EMAIL PROTECTED]>
>To: <[EMAIL PROTECTED]>
>Sent: Saturday, August 25, 2001 8:40 AM
>Subject: Re: [JBoss-dev] (no subject)
>
>
> >
> > Well, if it's leaving the VM the code base should be going through the
> > WebService.  The WebService URL will not have a space in it, plus it 
>will
> > not be a file: URL and will not be affected by the Fix below.  I think
> > that's why the JRMP test suite was not failing.
> >
> > How about we install this fix via an MBean (maybe the info mbean) into 
>the
> > VM.  We run the testsuite against it and see what happens.
> >
> > Hey, at least it should not not make things MUCH worse, jboss is 
>allready
> > screwed if installed on paths with a space.
> >
> > Regards,
> > Hiram
> >
> > >From: "Scott M Stark" <[EMAIL PROTECTED]>
> > >Reply-To: [EMAIL PROTECTED]
> > >To: <[EMAIL PROTECTED]>
> > >Subject: Re: [JBoss-dev] (no subject)
> > >Date: Sat, 25 Aug 2001 00:31:00 -0700
> > >
> > >This won't work if the codebase leaves the vm, and now what happens if
> > >the path contains a '+' ?
> > >
> > >----- Original Message -----
> > >From: "Hiram Chirino" <[EMAIL PROTECTED]>
> > >To: <[EMAIL PROTECTED]>
> > >Sent: Friday, August 24, 2001 11:54 PM
> > >Subject: Re: [JBoss-dev] (no subject)
> > >
> > >
> > > >
> > > > Ok.. if finished that workaround.  I don't know if it will break
> > >anything
> > > > else, but at least it fixes our test case.  To use it, add the
>following
> > > > line to the top of the tstMO main() method.
> > > >
> > > >    FileURLSpaceFixer.install();
> > > >
> > > > below is the FileURLSpaceFixer.java file.
> > > > -------------------------
> > > > import java.net.URL;
> > > > import java.net.URLStreamHandlerFactory;
> > > > import java.net.URLStreamHandler;
> > > > import java.net.URLConnection;
> > > >
> > > > /**
> > > > * Used to fix the problem with the RMI classloader for
> > > > * when a space appears in the path to where a class
> > > > * should be loaded from.
> > > > *
> > > > * @author: Hiram Chirino
> > > > */
> > > > class FileURLSpaceFixer {
> > > >
> > > >    private static FileHandler fileHander= new FileHandler();
> > > >    private static CustomURLStreamHandlerFactory
> > > > customURLStreamHandlerFactory= new CustomURLStreamHandlerFactory();
> > > >
> > > >    //
> > > >    // This class is used to hook into the URL protocol parsing 
>sysytem
> > > >    //
> > > >    private static class CustomURLStreamHandlerFactory implements
> > > > URLStreamHandlerFactory {
> > > >       public URLStreamHandler createURLStreamHandler(String 
>protocol)
>{
> > > >          if (protocol.equals("file"))
> > > >             return fileHander;
> > > >          return null;
> > > >       }
> > > >    }
> > > >
> > > >    //
> > > >    // This class will override how the file handler is implemented.
> > > >    //
> > > >    private static class FileHandler extends
> > > > sun.net.www.protocol.file.Handler {
> > > >
> > > >       // When we externalize the URL we want to make all the spaces 
>in
> > >the
> > > > file name
> > > >       // a '+' character
> > > >       protected String toExternalForm(URL u) {
> > > >          String s= super.toExternalForm(u);
> > > >          return s.replace(' ', '+');
> > > >       }
> > > >
> > > >       // When we load a URL in we want to convert all the '+'
>characters
> > >in
> > > > the file name
> > > >       // into spaces.
> > > >       protected void parseURL(URL u, String spec, int start, int
>limit)
> > >{
> > > >          super.parseURL(u, spec, start, limit);
> > > >          setURL(u, u.getProtocol(), u.getHost(), u.getPort(),
> > > > u.getFile().replace('+', ' '), u.getRef());
> > > >       }
> > > >    }
> > > >
> > > >    // use this method to install this fix.
> > > >    public static void install() {
> > > >       URL.setURLStreamHandlerFactory(customURLStreamHandlerFactory);
> > > >    }
> > > > }
> > > > -----------------
> > > >
> > > > Regards,
> > > > Hiram
> > > >
> > >
> > >
> > >
> > >_______________________________________________
> > >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
> >
>
>
>_______________________________________________
>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

Reply via email to