Re: JarURLConnection doesn't work useCaches property

2009-08-27 Thread Jack Cai
I spent quite some time to look at this problem. I tested the JDK's behavior
and agree with David that the spec and RI together didn't do a good job to
explain the indication of useCaches=false. Currently SUN JDK also returns
the same JarFile instance if getJarFile() is called upon the same
JarURLConnection whose useCaches is set false. This behavior is not
faithfully following the spec...

Anyway I created a patch and attached to the JIRA. It should apply to both
the 2.1 and 2.2 branches. I didn't take care of NestedJarFile 
UnpackedJarFile as I suppose they are not used by JarFileUrlConnection - I
did a little experiment, adding a hook in the JarFileUrlConnection to check
the type of JarFiles that are passed in. I started the server and deploy an
ear, and didn't see instances of NestedJarFile  UnpackedJarFile passed into
JarFileConnection. But I could miss something...

-Jack

On Wed, Aug 5, 2009 at 9:25 PM, Masayoshi Yamashita ymstm...@gmail.comwrote:

 Hello David,

 I did open a jira entry GERONIMO-4671.

 It seems that many class must be modified to fix this bug, so I'm
 sorry I cannot fix.

 At present, I temporarily solve by modifying my program.

 thanks,

 
 Masayoshi Yamashita



Re: JarURLConnection doesn't work useCaches property

2009-08-05 Thread Masayoshi Yamashita
Hello David,

I did open a jira entry GERONIMO-4671.

It seems that many class must be modified to fix this bug, so I'm
sorry I cannot fix.

At present, I temporarily solve by modifying my program.

thanks,


Masayoshi Yamashita


Re: JarURLConnection doesn't work useCaches property

2009-08-04 Thread Masayoshi Yamashita
Hello Jack,

I want to achieve handling JarFile and JarEntry in some programs.
Each program gets JarFile with false useCaches, and calls
JarFile#getInputStream and JarFile#close methods.
However, when JarFile instances are same, first program closes tha
JarFile, so second program can't handle the JarFile.
Therefore I hope to get different instances.

Also, it is described in the javadoc of useCaches field as follows.
If false, the protocol must always try to get a fresh copy of the object.

I think that getJarFile method of
org.apache.geronimo.kernel.classloader.JarFileUrlConnection must
return a different instance, when useCaches is false.

I'm using Geronimo in Windows XP.

Best regards,


Masayoshi Yamashita


Re: JarURLConnection doesn't work useCaches property

2009-08-03 Thread Jack Cai
The context class loader when running in Geronimo is not the system class
loader. So it's not strange that the behavior is different.

What OS are you running these on? What do you want to achieve exactly?
Update jar files constantly?

-Jack

On Sun, Aug 2, 2009 at 10:34 PM, Masayoshi Yamashita ymstm...@gmail.comwrote:

 Hello,

 I using Geronimo 2.1.4  Sun JDK 1.5.0.19.

 When executing the following code on Geronimo server,

 =
 ClassLoader loader = Thread.currentThread().getContextClassLoader();
 URL url = loader.getResource(javax/servlet/http/);

 JarURLConnection conn1 = (JarURLConnection) url.openConnection();
 conn1.setUseCaches(false);
 JarFile jarFile1 = conn1.getJarFile();

 JarURLConnection conn2 = (JarURLConnection) url.openConnection();
 conn2.setUseCaches(false);
 JarFile jarFile2 = conn2.getJarFile();

 System.out.println(jarFile1);
 System.out.println(jarFile2);
 =

 there is a problem that jarFile1 and jarFile2 are same instances.

 When executing on Eclipse console, the variables are difference instances.
 (In addition, when useCaches property is true, those are same instances.)

 How should there be this problem?

 Best regards,

 
 Masayoshi Yamashita



JarURLConnection doesn't work useCaches property

2009-08-02 Thread Masayoshi Yamashita
Hello,

I using Geronimo 2.1.4  Sun JDK 1.5.0.19.

When executing the following code on Geronimo server,

=
ClassLoader loader = Thread.currentThread().getContextClassLoader();
URL url = loader.getResource(javax/servlet/http/);

JarURLConnection conn1 = (JarURLConnection) url.openConnection();
conn1.setUseCaches(false);
JarFile jarFile1 = conn1.getJarFile();

JarURLConnection conn2 = (JarURLConnection) url.openConnection();
conn2.setUseCaches(false);
JarFile jarFile2 = conn2.getJarFile();

System.out.println(jarFile1);
System.out.println(jarFile2);
=

there is a problem that jarFile1 and jarFile2 are same instances.

When executing on Eclipse console, the variables are difference instances.
(In addition, when useCaches property is true, those are same instances.)

How should there be this problem?

Best regards,


Masayoshi Yamashita