code review request: 7054428: test/java/security/SecureClassLoader/DefineClassByteBuffer.java error

Alan Bateman Alan.Bateman at oracle.com
Wed Jun 15 03:56:29 PDT 2011


Weijun Wang wrote:
> Without L104, array is empty, and L108 and L112 fill zeros into buffers.
>
> I also just noticed that the dummy class loaders are only used in 
> samevm. When running as othervm or standalone, findClass() method is 
> never called.
>
> It seems in othervm mode, the TestClass.class is in the same directory 
> as the main class and it's loaded directly by the URLClassLoader (?).
>
> I've updated the code changes to first rename the compiled file, so 
> that the URLClassLoader will be find it. The new test runs OK for both 
> samevm and othervm. I've even added a counter to make sure dummy class 
> loader get used.
>
> http://cr.openjdk.java.net/~weijun/7054428/webrev.01
I assume the original author just didn't realize that delegation meant 
that TestClass was being loaded by the parent loader.

Anyway, the changes look okay to me. I guess an alternative would be to 
compile TestClass into a different directory rather than renaming it.

Now back to the original issue. My guess is that it was failing in 
samevm mode because readClassFile leaves the file open and it would be 
good to fix that. We might also need to do something with the file mapping.

-Alan



More information about the security-dev mailing list