summaryrefslogtreecommitdiff
path: root/ext/java/except.php
diff options
context:
space:
mode:
Diffstat (limited to 'ext/java/except.php')
-rw-r--r--ext/java/except.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/ext/java/except.php b/ext/java/except.php
new file mode 100644
index 0000000000..a7e6a79c08
--- /dev/null
+++ b/ext/java/except.php
@@ -0,0 +1,23 @@
+<?
+ $stack=new Java("java.util.Stack");
+ $stack->push(1);
+
+ #
+ # Should succeed and print out "1"
+ #
+ $result = $stack->pop();
+ $ex = java_last_exception_get();
+ if (!$ex) print "$result\n";
+
+ #
+ # Should fail - note the "@" eliminates the warning
+ #
+ $result=@$stack->pop();
+ $ex=java_last_exception_get();
+ if ($ex) print $ex->toString();
+
+ #
+ # Reset last exception
+ #
+ java_last_exception_clear();
+?>