summaryrefslogtreecommitdiffstats
path: root/tests/bugs153
diff options
context:
space:
mode:
authormwebster <mwebster>2006-07-11 12:57:44 +0000
committermwebster <mwebster>2006-07-11 12:57:44 +0000
commite22244ba499571a43caf518567cba3717e4b5ce3 (patch)
treea75d6ab64319f67c014021928136618ba2576b86 /tests/bugs153
parent1a36c97b022e35906fcf5ed0981a2ca95800ea84 (diff)
downloadaspectj-e22244ba499571a43caf518567cba3717e4b5ce3.tar.gz
aspectj-e22244ba499571a43caf518567cba3717e4b5ce3.zip
Testcases for 145442 "The line number is missing for an advised class."
Diffstat (limited to 'tests/bugs153')
-rw-r--r--tests/bugs153/pr145442/hello/HelloWorld.java44
-rw-r--r--tests/bugs153/pr145442/hello/ThrowExceptionAfter.aj8
-rw-r--r--tests/bugs153/pr145442/hello/ThrowExceptionAround.aj8
-rw-r--r--tests/bugs153/pr145442/hello/ThrowExceptionBefore.aj8
4 files changed, 68 insertions, 0 deletions
diff --git a/tests/bugs153/pr145442/hello/HelloWorld.java b/tests/bugs153/pr145442/hello/HelloWorld.java
new file mode 100644
index 000000000..a2bb9b072
--- /dev/null
+++ b/tests/bugs153/pr145442/hello/HelloWorld.java
@@ -0,0 +1,44 @@
+package hello;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+
+public class HelloWorld {
+
+ public void println () {
+ System.out.println("Hello World!");
+ }
+
+ private void testStackTrace () throws IOException {
+ try {
+ println();
+ }
+ catch (Exception ex) {
+ printRelevantStackEntries(ex,getClass().getName());
+ }
+ }
+
+ private static void printRelevantStackEntries (Exception ex, String className) throws IOException {
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+ PrintStream ps = new PrintStream(baos);
+ ex.printStackTrace(ps);
+ ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+ BufferedReader br = new BufferedReader(new InputStreamReader(bais));
+ String entry;
+ while ((entry = br.readLine()) != null) {
+ if (entry.indexOf(className) != -1) {
+ System.err.println(entry);
+ }
+ }
+ }
+
+ public static void main(String[] args) throws Exception {
+ new HelloWorld().testStackTrace();
+ }
+
+}
diff --git a/tests/bugs153/pr145442/hello/ThrowExceptionAfter.aj b/tests/bugs153/pr145442/hello/ThrowExceptionAfter.aj
new file mode 100644
index 000000000..f9d58fb11
--- /dev/null
+++ b/tests/bugs153/pr145442/hello/ThrowExceptionAfter.aj
@@ -0,0 +1,8 @@
+package hello;
+
+public aspect ThrowExceptionAfter {
+
+ after () : execution(public void println()) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/tests/bugs153/pr145442/hello/ThrowExceptionAround.aj b/tests/bugs153/pr145442/hello/ThrowExceptionAround.aj
new file mode 100644
index 000000000..a30cf0ec4
--- /dev/null
+++ b/tests/bugs153/pr145442/hello/ThrowExceptionAround.aj
@@ -0,0 +1,8 @@
+package hello;
+
+public aspect ThrowExceptionAround {
+
+ void around () : execution(public void println()) {
+ throw new UnsupportedOperationException();
+ }
+}
diff --git a/tests/bugs153/pr145442/hello/ThrowExceptionBefore.aj b/tests/bugs153/pr145442/hello/ThrowExceptionBefore.aj
new file mode 100644
index 000000000..f4dc9cb2c
--- /dev/null
+++ b/tests/bugs153/pr145442/hello/ThrowExceptionBefore.aj
@@ -0,0 +1,8 @@
+package hello;
+
+public aspect ThrowExceptionBefore {
+
+ before () : execution(public void println()) {
+ throw new UnsupportedOperationException();
+ }
+}