diff options
author | mwebster <mwebster> | 2006-07-11 12:57:44 +0000 |
---|---|---|
committer | mwebster <mwebster> | 2006-07-11 12:57:44 +0000 |
commit | e22244ba499571a43caf518567cba3717e4b5ce3 (patch) | |
tree | a75d6ab64319f67c014021928136618ba2576b86 /tests/bugs153/pr145442/hello/HelloWorld.java | |
parent | 1a36c97b022e35906fcf5ed0981a2ca95800ea84 (diff) | |
download | aspectj-e22244ba499571a43caf518567cba3717e4b5ce3.tar.gz aspectj-e22244ba499571a43caf518567cba3717e4b5ce3.zip |
Testcases for 145442 "The line number is missing for an advised class."
Diffstat (limited to 'tests/bugs153/pr145442/hello/HelloWorld.java')
-rw-r--r-- | tests/bugs153/pr145442/hello/HelloWorld.java | 44 |
1 files changed, 44 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(); + } + +} |