geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Kenji Nakamura" <nakamura.ke...@gmail.com>
Subject Double URLEncoding in RMIClassLoaderSpiImpl?
Date Fri, 08 Dec 2006 18:29:08 GMT
Hi,

I wrote a GBean that uses RMI via Spring remote. It works fine if I install
Geronimo-1.0 RELEASE in the path without whitespace, but got the following
error when I install it under the path with whitespace (e.g. c:\Documents
and Settings\...) on Windows.

Caused by: java.lang.ClassNotFoundException:
org.springframework.remoting.rmi.Rm
iInvocationWrapper_Stub
        at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
        at java.security.AccessController.doPrivileged (Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:219)
        at sun.rmi.server.LoaderHandler.loadClass (LoaderHandler.java:430)
        at sun.rmi.server.LoaderHandler.loadClass(LoaderHandler.java:165)
        at java.rmi.server.RMIClassLoader$2.loadClass(RMIClassLoader.java
:631)
        at org.apache.geronimo.system.rmi.RMIClassLoaderSpiImpl.loadClass(RMICla
ssLoaderSpiImpl.java:48)
        at java.rmi.server.RMIClassLoader.loadClass(RMIClassLoader.java:257)
        at sun.rmi.server.MarshalInputStream.resolveClass(
MarshalInputStream.jav
a:200)
        at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java
:151
3)
        at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java
:1435)
        at java.io.ObjectInputStream.readOrdinaryObject(
ObjectInputStream.java :1
626)
        at java.io.ObjectInputStream.readObject0(ObjectInputStream.java
:1274)
        at java.io.ObjectInputStream.readObject(ObjectInputStream.java:322)
        ... 9 more

I noticed org.apache.geronimo.system.rmi.RMIClassLoaderSpiImpl#normalizeURL()
espaces against already escaped URL.
First, normalizeCodebase() returns the encoded (e.g. whitespace -> %20) URL.
Then, normalizeURL() take the URL and encodes again (e.g. %20 -> %2520)

Here is the test program and the result.

------------------------------------- code
---------------------------------------
package org.apache.geronimo.system.rmi;
import java.net.*;
public class RMIClassLoaderSpiImplTest {

    public static void main(String[] args) throws Exception {
        String result =
RMIClassLoaderSpiImpl.normalizeCodebase("file:/c:/Documents
and Settings/Administrator/classes/ file:/c:/Foo bar");
        System.out.println("Normalized codebase: " + ((result == null) ?
"null" : result));
        RMIClassLoaderSpiImpl spi = new RMIClassLoaderSpiImpl();
        URL normalized = spi.normalizeURL(new URL(result));
        System.out.println("Normalized URL: " + normalized.toString());
    }
}

------------------------------------- output
----------------------------------------
Normalized codebase:
file:/c:/Documents%20and%20Settings/Administrator/classes f
ile:/c:/Foo%20bar
Normalized URL:
file:/c:/Documents%2520and%2520Settings/Administrator/classes%20
file:/c:/Foo%2520bar



I haven't tested on Geronimo-1.1.1, but as far as I read the code, the logic
hasn't changed so this may be applicable.

Is this intended behavior, or a bug?

Thanks,

-- 
Kenji Nakamura

Mime
View raw message