This is the mail archive of the
java-patches@sourceware.cygnus.com
mailing list for the Java project.
More new test code
- To: java-patches at sourceware dot cygnus dot com
- Subject: More new test code
- From: Anthony Green <green at cygnus dot com>
- Date: Sun, 16 Jan 2000 11:54:27 -0800
More test code...
2000-01-16 Anthony Green <green@cygnus.com>
* libjava.lang/pr83.out: New file.
* libjava.lang/pr83.java: New file.
Index: libjava/testsuite/libjava.lang/pr83.java
===================================================================
RCS file: pr83.java
diff -N pr83.java
--- /dev/null Tue May 5 13:32:27 1998
+++ pr83.java Sun Jan 16 11:53:39 2000
@@ -0,0 +1,39 @@
+// PR 83
+
+/*
+ * test that caught null pointers exceptions in finalizers work correctly
+ * and that local variables are accessible in null pointer exception handlers.
+ */
+import java.io.*;
+
+public class pr83 {
+
+ static String s;
+
+ public static void main(String[] args) {
+ System.out.println(tryfinally() + s);
+ }
+
+ public static String tryfinally() {
+ String yuck = null;
+ String local_s = null;
+
+ try {
+ return "This is ";
+ } finally {
+ try {
+ local_s = "Perfect";
+ /* trigger null pointer exception */
+ String x = yuck.toLowerCase();
+ } catch (Exception _) {
+ /*
+ * when the null pointer exception is caught, we must still
+ * be able to access local_s.
+ * Our return address for the finally clause must also still
+ * be intact.
+ */
+ s = local_s;
+ }
+ }
+ }
+}
Index: libjava/testsuite/libjava.lang/pr83.out
===================================================================
RCS file: pr83.out
diff -N pr83.out
--- /dev/null Tue May 5 13:32:27 1998
+++ pr83.out Sun Jan 16 11:53:39 2000
@@ -0,0 +1 @@
+This is Perfect