On Thu, 2006-06-01 at 13:26 -0400, Thomas Fitzsimmons wrote:
> Lillian Angel wrote:
> > This fixes the classloading problem with a lot of applets.
> > 
> > 2006-06-01  Lillian Angel  <[EMAIL PROTECTED]>
> > 
> >         * tools/gnu/classpath/tools/appletviewer/AppletTag.java
> >         (prependCodebase): Fixed check. No dirname was ever considered 
> >     to be a file, so every applet fell into the if-statement 
> >     causing a lot of classloading problems with the applets.
> > 
> > 
> > 
> > ------------------------------------------------------------------------
> > 
> > Index: tools/gnu/classpath/tools/appletviewer/AppletTag.java
> > ===================================================================
> > RCS file: 
> > /cvsroot/classpath/classpath/tools/gnu/classpath/tools/appletviewer/AppletTag.java,v
> > retrieving revision 1.2
> > retrieving revision 1.3
> > diff -u -r1.2 -r1.3
> > --- tools/gnu/classpath/tools/appletviewer/AppletTag.java   24 May 2006 
> > 20:14:22 -0000      1.2
> > +++ tools/gnu/classpath/tools/appletviewer/AppletTag.java   1 Jun 2006 
> > 16:40:11 -0000       1.3
> > @@ -451,7 +451,7 @@
> >          else
> >            {
> >              String dirname = documentbase.getFile();
> > -            if (!new File(dirname).isFile())
> > +            if (dirname.indexOf(".") < 0)
> >                fullcodebase = new URL(documentbase + File.separator);
> 
> This is fine for now, but I'm thinking we may be working around a general 
> problem with our URL class.  Shouldn't http://gnu.org/software/classpath and 
> http://gnu.org/software/classpath/ resolve to the same location when passed 
> to 
> the URL constructor?

In prependCodebase, we pass in a directory name to create the
documentbase URL. It assumes the directory is everything from the first
character to the last File separator (/):
dirname = dirname.substring(0, dirname.lastIndexOf(File.separatorChar) +
1);

This is a bad assumption, because the directory can be the entire
documentbase.


Therefore, the code in URL is not wrong. This is how we handle it in the
AppletTag class ATM. This check I added is a work-around, but it is the
best way to handle this. We need to check if the entire documentbase is
the parent directory to the applet's main class.

Lillian

> 
> Tom
> 


Reply via email to