Bug 27294 - gij throws NullPointerException, when the interpreter is not enabled
Summary: gij throws NullPointerException, when the interpreter is not enabled
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: libgcj (show other bugs)
Version: 4.1.1
: P3 normal
Target Milestone: 4.2.0
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-24 21:26 UTC by Debian GCC Maintainers
Modified: 2006-05-05 15:06 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-05-04 18:10:30


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Debian GCC Maintainers 2006-04-24 21:26:54 UTC
gij-4.1 \
            -classpath build/bootstrap/ecj.jar:/usr/share/ant/lib/ant.jar \
            org.eclipse.jdt.internal.compiler.batch.Main \
            -bootclasspath /usr/share/java/libgcj-4.1.jar \
            build/bin

Exception in thread "main" java.lang.NullPointerException
   at java.lang.ClassLoader.defineClass (ClassLoader.java:451)
   at java.security.SecureClassLoader.defineClass (SecureClassLoader.java:108)
   at java.net.URLClassLoader.findClass (URLClassLoader.java:1166)
   at java.lang.ClassLoader.loadClass (ClassLoader.java:317)
   at java.lang.ClassLoader.loadClass (ClassLoader.java:260)
   at java.lang.Class.forName (natClass.cc:88)
   at gnu.java.lang.MainThread.run (MainThread.java:95)
make: *** [build/stamp] Error 1

>>>>> "Martin" == Martin Michlmayr <tbm@cyrius.com> writes:

Hmm.  We probably ought to throw a different exception here.  Would
you mind filing a bug for this?

Martin> Exception in thread "main" java.lang.NullPointerException
Martin>    at java.lang.ClassLoader.defineClass (ClassLoader.java:451)

What this most likely means is that there is an attempt to define a
class from bytecode, and the attempt failed.

Looking at libjava/configure.host, I see that the interpreter is not
enabled for the MIPS port.  So, an exception here is to be expected.

[testing the latter, just the bug report for the NullPointerException]
Comment 1 Tom Tromey 2006-05-04 18:10:30 UTC
It isn't clear what exception we ought to throw here.

What is happening is that we've found a .class file for a class
we're searching for, but libgcj is not configured to properly
handle class files.

VirtualMachineError would be ok from a spec. point of view.
But it is a bit unfriendly.  This is what I'm leaning toward.

ClassFormatError would also be legal but it is a bit of a lie.

Comment 2 Tom Tromey 2006-05-05 15:05:30 UTC
Subject: Bug 27294

Author: tromey
Date: Fri May  5 15:05:20 2006
New Revision: 113554

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=113554
Log:
	PR libgcj/27294:
	* java/lang/natVMClassLoader.cc (defineClass): Throw
	VirtualMachineError if no interpreter configured.

Modified:
    trunk/libjava/ChangeLog
    trunk/libjava/java/lang/natVMClassLoader.cc

Comment 3 Tom Tromey 2006-05-05 15:06:24 UTC
Now we print something nicer:

opsy. gij t
Exception in thread "main" java.lang.VirtualMachineError: found class file for class t, but no interpreter configured in this libgcj