libgcj/133: Simple Java application fails to exit
dey@nc.fnc.fujitsu.com
dey@nc.fnc.fujitsu.com
Tue Jan 11 12:30:00 GMT 2000
>Number: 133
>Category: libgcj
>Synopsis: Simple Java application fails to exit
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: tromey
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Tue Jan 11 12:30:00 PST 2000
>Closed-Date:
>Last-Modified:
>Originator: David E. Young
>Release: libgcj 2.95.1
>Organization:
>Environment:
sparc ultra 30
solaris 7
256mb ram
gcj 2.95.2
gnu ld 2.9.1
libgcj 2.95.1 (posix threads enabled)
>Description:
I've written a simple Java application that fails to exit given certain conditions.
The source code is attached; simply stated, if I comment out the annotated
call to System.exit() causes the process to "hang"; compiling it in results
in expected behavior (i.e. the process exits after return from main().
I compiled the program like this:
gcj --main=Rocky -o rocky Rocky.java -lrt
Just in case the file attachment didn't work, here's the source:
public class Rocky {
public static void main(String argv[])
{
String name;
if (argv.length == 0) {
name = "Rocket J. Squirrel";
} else {
name = argv[0];
}
new Rocky(name).identifySelf();
System.out.println("goodbye");
//System.exit(0);
}
public Rocky (String name)
{
v_name = name;
}
public void identifySelf()
{
System.out.println("This is a Rocky instance named " + v_name);
System.out.println("Leaving identifySelf()...");
}
private String v_name;
}
>How-To-Repeat:
Just compile and run the enclosed program.
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="Rocky.java"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="Rocky.java"
CnB1YmxpYyBjbGFzcyBSb2NreSB7CiAgICBwdWJsaWMgc3RhdGljIHZvaWQgbWFpbihTdHJpbmcg
YXJndltdKQogICAgewogICAgICAgIFN0cmluZyBuYW1lOwoKICAgICAgICBpZiAoYXJndi5sZW5n
dGggPT0gMCkgewogICAgICAgICAgICBuYW1lID0gIlJvY2tldCBKLiBTcXVpcnJlbCI7CiAgICAg
ICAgfSBlbHNlIHsKICAgICAgICAgICAgbmFtZSA9IGFyZ3ZbMF07CiAgICAgICAgfQoKICAgICAg
ICBuZXcgUm9ja3kobmFtZSkuaWRlbnRpZnlTZWxmKCk7CiAgICAgICAgU3lzdGVtLm91dC5wcmlu
dGxuKCJnb29kYnllIik7CgogICAgICAgIC8vU3lzdGVtLmV4aXQoMCk7CiAgICB9CgogICAgcHVi
bGljIFJvY2t5IChTdHJpbmcgbmFtZSkKICAgIHsKICAgICAgICB2X25hbWUgPSBuYW1lOwogICAg
fQogICAgCiAgICBwdWJsaWMgdm9pZCBpZGVudGlmeVNlbGYoKQogICAgewogICAgICAgIFN5c3Rl
bS5vdXQucHJpbnRsbigiVGhpcyBpcyBhIFJvY2t5IGluc3RhbmNlIG5hbWVkICIgKyB2X25hbWUp
OwogICAgICAgIFN5c3RlbS5vdXQucHJpbnRsbigiTGVhdmluZyBpZGVudGlmeVNlbGYoKS4uLiIp
OwogICAgfQoKICAgIHByaXZhdGUgU3RyaW5nIHZfbmFtZTsKfQo=
More information about the Java-prs
mailing list