public inbox for mauve-discuss@sourceware.org
 help / color / mirror / Atom feed
* Re: classpath ./ChangeLog ./THANKYOU ./configure.in...
       [not found] <m3istrt1zv.fsf@lyta.haphazard.org>
@ 2003-04-07 16:09 ` Stephen Crawley
  2003-04-07 22:59   ` Raif S. Naffah
  0 siblings, 1 reply; 3+ messages in thread
From: Stephen Crawley @ 2003-04-07 16:09 UTC (permalink / raw)
  To: Brian Jones; +Cc: Stephen Crawley, classpath, Raif S. Naffah, Mauve



> Stephen Crawley <crawley@dstc.edu.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!

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.  I have fixed
the Mauve testcases, and add a 'hint' to SimpleTestHarness to point
people in the right direction in future.

Three issues remain:

  *  There is a bug in the implementation of Class.getConstructor in
     the Jikes RVM.  It should not return a constructor unless it is
     declared as 'public'.

  *  We need more comprehensive Mauve testcases for the the Java 
     APIs for reflective programming,

  *  There is a problem with Kissme's implementation of stack traces
     when an exception is thrown in a native method.  It is getting
     the source line number wildly wrong.

-- Steve

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: classpath ./ChangeLog ./THANKYOU ./configure.in...
  2003-04-07 16:09 ` classpath ./ChangeLog ./THANKYOU ./configure.in Stephen Crawley
@ 2003-04-07 22:59   ` Raif S. Naffah
  2003-04-07 23:32     ` Stephen Crawley
  0 siblings, 1 reply; 3+ messages in thread
From: Raif S. Naffah @ 2003-04-07 22:59 UTC (permalink / raw)
  To: Stephen Crawley, Brian Jones; +Cc: Stephen Crawley, classpath, Mauve

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

hello Steve,

On Tue, 8 Apr 2003 02:09 am, Stephen Crawley wrote:
> > Stephen Crawley <crawley@dstc.edu.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-----

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: classpath ./ChangeLog ./THANKYOU ./configure.in...
  2003-04-07 22:59   ` Raif S. Naffah
@ 2003-04-07 23:32     ` Stephen Crawley
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Crawley @ 2003-04-07 23:32 UTC (permalink / raw)
  To: raif; +Cc: Stephen Crawley, Brian Jones, classpath, Mauve, crawley


> > 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?  

Good questions.  The JDK javadoc is not entirely clear on either of 
them.  I'll try some experiments with various Sun JDKs

-- Steve


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2003-04-07 23:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <m3istrt1zv.fsf@lyta.haphazard.org>
2003-04-07 16:09 ` classpath ./ChangeLog ./THANKYOU ./configure.in Stephen Crawley
2003-04-07 22:59   ` Raif S. Naffah
2003-04-07 23:32     ` Stephen Crawley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).