Strange behaviour of try..finally
Laurent Bossavit
morendil at micronet.fr
Mon Jul 6 20:41:03 PDT 1998
Hello all,
Me again. Still trying to get somewhere with Kaffe on FreeBSD. I've
gotten past the 'classes.zip' problem; removed the hard-coded call to
"initializeSystemClass" (I'm using a classes.zip which doesn't have
it; a good fix would be to only call that initializer if it actually
exists). Passed all the tests in 'make test'. Now getting ready to
use it on a real-world application, Sun's Java Web Server.
I'm running into a very weird behaviour with a try..finally construct
which catches an exception in the finally block. The problem boils
down to the following test case :
import java.io.*;
public class FinalTest {
public static void main(String[] args) {
new FinalTest();
}
public FinalTest() {
System.out.println(tryfinally());
}
public String tryfinally()
{
String yuck = null;
String good = "Perfect";
try {
try {
return good.toLowerCase();
}
catch (Exception e) {
}
return "I can handle that";
}
finally {
try {
String x = yuck.toLowerCase();
}
catch (Exception e) {}
}
}
Compile and run under JRE or JDK; this outputs "perfect". Compile
and run under Kaffe; this dies with a NullPointerException which the
try..catch construct in the finally block does *not* catch.
I'll be diving into the code forthwith; naturally though, I'll be
glad if anybody can come up with some idea of why this happens.
Thanks,
=====================================================
Laurent Bossavit
NetDIVE Paris offices (o o)
-------------------------------- -oOO--( )--OOo-
http://www.netdive.com/
NetDIVE: the leader in virtual meeting technology
=====================================================
More information about the kaffe
mailing list