public inbox for java-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug libgcj/24638]  New: inconsistent use of Jv_FindClass causing too weak error condition
@ 2005-11-02 16:35 thebohemian at gmx dot net
  2005-11-16 16:50 ` [Bug libgcj/24638] " thebohemian at gmx dot net
  2006-02-01 13:49 ` thebohemian at gmx dot net
  0 siblings, 2 replies; 3+ messages in thread
From: thebohemian at gmx dot net @ 2005-11-02 16:35 UTC (permalink / raw)
  To: java-prs

Jv_FindClass throws a ClassNotFoundException in case the requested class cannot
be resolved (regardless of whether the bytecode missing or a further dependency
cannot be resolved).

This causes problems because in case of serious bytecode errors (eg. the class
of a field is missing) where a NoClassDefFoundError should reach the user code.

I found code in several places in gcj where the caller of Jv_FindClass expected
NULL to be returned. This affects Jv_FindClassFromSignature too because it
depends on the former function.

Obviously such code will not be executed (unless the Jv_FindClass takes a
special codepath where it call Jv_FindClassInCache).

- link.cc: around line 1000, look for:
if (target_class == NULL)
        throw new java::lang::NoClassDefFoundError 
          (_Jv_NewStringUTF (sym.class_name->chars()));

- verify.cc: around 387, look for
          data.klass = _Jv_FindClassFromSignature (data.name->chars(), loader);
          if (data.klass == NULL)
            throw new java::lang::NoClassDefFoundError(data.name->toString());

I want to hear what the experts have to say about that. My suggestion would be
to introduce a special variant of Jv_FindClass which does not throw a
ClassNotFoundException (by swallowing it) and then carefully adjusting the code
location where the old variant was used.


-- 
           Summary: inconsistent use of Jv_FindClass causing too weak error
                    condition
           Product: gcc
           Version: 4.0.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libgcj
        AssignedTo: thebohemian at gmx dot net
        ReportedBy: thebohemian at gmx dot net


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24638


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

* [Bug libgcj/24638] inconsistent use of Jv_FindClass causing too weak error condition
  2005-11-02 16:35 [Bug libgcj/24638] New: inconsistent use of Jv_FindClass causing too weak error condition thebohemian at gmx dot net
@ 2005-11-16 16:50 ` thebohemian at gmx dot net
  2006-02-01 13:49 ` thebohemian at gmx dot net
  1 sibling, 0 replies; 3+ messages in thread
From: thebohemian at gmx dot net @ 2005-11-16 16:50 UTC (permalink / raw)
  To: java-prs



------- Comment #1 from thebohemian at gmx dot net  2005-11-16 16:50 -------
By working on PR 24616 I found out that this belongs together.


-- 

thebohemian at gmx dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  BugsThisDependsOn|                            |24616


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24638


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

* [Bug libgcj/24638] inconsistent use of Jv_FindClass causing too weak error condition
  2005-11-02 16:35 [Bug libgcj/24638] New: inconsistent use of Jv_FindClass causing too weak error condition thebohemian at gmx dot net
  2005-11-16 16:50 ` [Bug libgcj/24638] " thebohemian at gmx dot net
@ 2006-02-01 13:49 ` thebohemian at gmx dot net
  1 sibling, 0 replies; 3+ messages in thread
From: thebohemian at gmx dot net @ 2006-02-01 13:49 UTC (permalink / raw)
  To: java-prs



------- Comment #2 from thebohemian at gmx dot net  2006-02-01 13:49 -------
The patch for PR 24616 contains variants of the methods I was talking here that
do not throw any exception and instead make the caller responsible for throwing
the correct exception or error:
http://gcc.gnu.org/ml/java-patches/2006-q1/msg00124.html


-- 

thebohemian at gmx dot net changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|                            |FIXED
   Target Milestone|---                         |4.2.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=24638


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

end of thread, other threads:[~2006-02-01 13:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-11-02 16:35 [Bug libgcj/24638] New: inconsistent use of Jv_FindClass causing too weak error condition thebohemian at gmx dot net
2005-11-16 16:50 ` [Bug libgcj/24638] " thebohemian at gmx dot net
2006-02-01 13:49 ` thebohemian at gmx dot net

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).