This is the mail archive of the mauve-discuss@sources.redhat.com mailing list for the Mauve project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: classpath ./ChangeLog ./THANKYOU ./configure.in...


-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160

hello Steve,

On Tue, 8 Apr 2003 02:09 am, Stephen Crawley wrote:
> > Stephen Crawley <crawley at dstc dot edu dot au> writes:
> > > I can confirm that there really is a problem running some of the
> > > Mauve security testlets under the latest Kissme, Classpath and
> > > Mauve.  It appears to be a Kissme class loading problem, rather
> > > than the fault of the Classpath security implementation.  I'm
> > > trying to get to the bottom of it ...
>
> The "bottom of it" is that the problem was not in Kissme or Classpath
> at all!

good catch!  mea culpa.


> The problem was that the failing test cases' constructors were not
> declared public.  On Kissme, this (correctly IMO) caused the call to
> 'Class.newInstance' to throw an InstantiationException...

shouldnt this be an IllegalAccessException?  as the docs states this 
exception is thrown "...if the class or its nullary constructor is not 
accessible."

also, is it legal for a JVM to try altering the accessibility of a 
non-public, but nullary ctor, before bailing out, and then and only 
then throw an InstantiationException?  the accessibility of a ctor can 
be altered as follows:

/** Instantiate a class with a 0-arguments ctor. */
private static Object makeNewInstance0(String className) {
   Class c = null;
   Constructor ctor = null;
   Object result = null;
   try {
      c = Class.forName(className);
      ctor = c.getConstructor(null);
      result = c.newInstance();
   } catch (IllegalAccessException x) {
      System.out.println("  * no --IllegalAccessException;"
            +"will attempt altering Accessibility...");
      boolean accessible = ctor.isAccessible();
      if (accessible)
         System.out.println("  * no --unable to, "
               +"although it's accessible...");
      else {
         try {
            ctor.setAccessible(true);
            result = ctor.newInstance(null);
         } catch (SecurityException y) {
            System.out.println("  * no --a SecurityManager "
                  +"is forbidding us to...");
         } catch (Exception y) { // should not happen
            y.printStackTrace(System.err);
         }
      }
   } catch (Exception x) {
      x.printStackTrace(System.err);
   }
   return result;
}

cheers;
rsn
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.7 (GNU/Linux)
Comment: Que du magnifique

iD8DBQE+kgE++e1AKnsTRiERA6JpAKDHogUsoAjDsHjq7buP+ahhO0warQCg349t
3sxj20HEsX47Y/UPdfrJsng=
=KNJD
-----END PGP SIGNATURE-----


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]