[rfc][icedtea-web] Ignore invalid .jar files in applets [resubmit]

Adam Domurad adomurad at redhat.com
Wed Jul 4 08:57:34 PDT 2012


Here is a version with ResourceNotFoundException renamed to
IllegalResourceDescriptorException.
On Wed, 2012-07-04 at 10:31 -0400, Adam Domurad wrote:
> I took the approach of making the tracker throw a new type of exception,
> ResourceNotFoundException extends IllegalArgumentException.
> C&C welcome. I can easily take a different approach. Point taken @
> IllegalArgumentException. 
> 
> Thanks,
> Adam
> On Wed, 2012-07-04 at 13:13 +0200, Jiri Vanek wrote:
> > On 07/03/2012 09:40 PM, Adam Domurad wrote:
> > > On Tue, 2012-07-03 at 20:59 +0200, Jiri Vanek wrote:
> > >> >  On 06/18/2012 04:42 PM, Adam Domurad wrote:
> > ...
> > >> >
> > >> >  this removed line scares me a bit....
> > > It was moved to the top. Confirmed OK with Omair.
> > 
> > yy.
> > 
> > >>> >  >
> > >>> >  >                 try {
> > >>> >  >                     jcv = verifyJars(initialJars);
> > >>> >  >  @@ -533,6 +583,7 @@ public class JNLPClassLoader extends URL
> > >>> >  >
> > >>> >  >             for (JARDesc jarDesc : file.getResources().getJARs()) {
> > >>> >  >                 try {
> > >>> >  >  +
> > >>> >  >                     File cachedFile = tracker.getCacheFile(jarDesc.getLocation());
> > >>> >  >
> > >>> >  >                     if (cachedFile == null) {
> > >>> >  >  @@ -570,6 +621,10 @@ public class JNLPClassLoader extends URL
> > >>> >  >                     jarLocationSecurityMap.put(jarDesc.getLocation(), jarSecurity);
> > >>> >  >                 } catch (MalformedURLException mfe) {
> > >>> >  >                     System.err.println(mfe.getMessage());
> > >>> >  >  +            } catch (IllegalArgumentException iae){
> > >> >
> > >> >  Do you think it is possible to caught this exception on better place and rethrow our custom one, which will be then catches here? IllegalaRgument one is pretty common one.
> > >> >
> > >>> >  >  +                //Caused by ignored resource being removed due to not being valid
> > >> >
> > >> >  this should be in debug mode or message should go from Message.properties.
> > >> >
> > >>> >  >  +                System.err.println("JAR " + jarDesc.getLocation() + " is not a valid jar file. Continuing.");
> > >>> >  >  +                continue;
> > > This seems consistent with the follow message slightly at the
> > > top:
> > > if(cachedFile == null) {
> > >   System.err.println("JAR " + jarDesc.getLocation() + " not found.
> > > Continuing.");
> > >   continue; // JAR not found. Keep going.
> > > }
> > >
> > > If the other message makes sense, this makes sense... Both or none imo
> > Then I'm  definitely for both. Print out stacktraces in debug mode, and localised message to stdout anywhay.
> > >
> > >>> >  >                 }
> > >>> >  >             }
> > >>> >  >             activateJars(initialJars);
> > >> >
> > >
> > > I have fixed the locality of the exception. It is now clearly to handle
> > > an exception in getting the resource, which was removed. Good catch.
> > >
> > >
> > Although the place looks much more better now, I wanted the transformation even deeper.
> > 
> > eg in ResourceTracker.getCacheFile or even deeper cough the particular isolated IllegalArgumentException, transform it to your own exception and then, on place like now, cough your new exception. IAE is really very common. Can came from anywhere.
> > 
> > 
> > J.
> > 
> > 
> > 
> > 
> 

-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-attempt-6.patch
Type: text/x-patch
Size: 12572 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/distro-pkg-dev/attachments/20120704/f8722c41/patch-attempt-6.patch 


More information about the distro-pkg-dev mailing list