Nina Rinskaya wrote:
Hi all,

Could anyone please review the problem description and the fix
suggested for https://issues.apache.org/jira/browse/HARMONY-1858#action_12442838?
Although the problem reported is not reproducible with the fix, I
suspect that the issue might need more thorough investigation and a
better fix. Thank you in advance!
Oh, yes, I noticed same problem yesterday, and committed a fix(maybe a work around) at r464582 in another way, I updated the Ln.249 of JarURLConnection in following way:
   -        }else{
   +        }else if(fileString != null){

My understanding of JarURLConnection.findJarFile() is as follows:
1. If the url's protocol is "file", tries to create JarFile directly and return
2. Else if useCaches is true, tries to get it from cache and return
3. Else try to get InputStream from that URLConnection, and write the contents to a temp file, then construct a JarFile based on that temp file and return
4. Else, throw IOException

The original implementation pass null as file name to openJarFile() in step 2, so that if the useCaches is false, NPE will be thrown, this is definitely a bug, as HARMONY-1858 shows. The patch for HARMONY-1858 tried to pass a externalForm as file name to openJarFile() instead, but if the url's protocol is not "file", there is no way to create a JarFile on that URL, so that the attempt will always throw IOException, findJarFile() will catch this exception and go into step 3. I thought the IOException thrown/catch is not necessary, instead I add a condition checking to openJarFile(), so that if the fileString is null, just return from openJarFile() and go into step 3. Comments?

I also think these two methods, findJarFile()/openJarFile(), need some refactory to make them easier to understand, I will look at it when I get a little more time.


Best regards,
Nina Rinskaya

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




--
Paulex Yang
China Software Development Lab
IBM


---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to