diff options
author | aclement <aclement> | 2005-01-11 11:22:15 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-01-11 11:22:15 +0000 |
commit | 603b063ecd2943e20f099712d9b754b19a380fee (patch) | |
tree | a3649ac5aa4e1a0ab475d5bee2a653785249f168 /tests/bugs150 | |
parent | 797b6a6afb75b14dc530bc0831566e110da3ae91 (diff) | |
download | aspectj-603b063ecd2943e20f099712d9b754b19a380fee.tar.gz aspectj-603b063ecd2943e20f099712d9b754b19a380fee.zip |
Fixes for 78021, 79554 - both to do with us breaking the exception table for a method on weaving *if* finally blocks are involved.
Diffstat (limited to 'tests/bugs150')
-rw-r--r-- | tests/bugs150/PR78021.java | 45 | ||||
-rw-r--r-- | tests/bugs150/PR79554.java | 41 |
2 files changed, 86 insertions, 0 deletions
diff --git a/tests/bugs150/PR78021.java b/tests/bugs150/PR78021.java new file mode 100644 index 000000000..66c86d339 --- /dev/null +++ b/tests/bugs150/PR78021.java @@ -0,0 +1,45 @@ +public class PR78021 { + + protected static Integer counter = new Integer(4); + + public static void main(String[] args) throws Exception { + try { + doSomething(); + System.err.println("TEST HAS PASSED"); + } catch (Exception e) { + System.err.println("TEST HAS FAILED: Exception thrown by doSomething: " +e.getMessage()); + throw e; + } + } + + public static void doSomething() { + int i = 0; + while (i++<1) { + counter=null; + try { + counter = new Integer(4); + // The inclusion of the next line changes the weaving ! If it is included the woven code is wrong and the exception escapes + if (counter == null) { break; } + commit(); + } catch (Throwable e) { + System.err.println("Caught exception " + e); + } finally { + System.err.println("In finally block"); + } + } + } + + protected static void commit() throws MyException { + System.err.println("Main.commit"); + } +} + +class MyException extends Exception { MyException(String s,String s2) { super(s); } } + +aspect SimpleExceptionThrowingAspect { + pointcut commitOperation() : call (* PR78021+.commit(..)); + + before() throws MyException : commitOperation() { + throw new MyException("Dummy My Exception", "55102"); + } +}
\ No newline at end of file diff --git a/tests/bugs150/PR79554.java b/tests/bugs150/PR79554.java new file mode 100644 index 000000000..5bab1d270 --- /dev/null +++ b/tests/bugs150/PR79554.java @@ -0,0 +1,41 @@ +/* + * Created on 22.10.2004 + */ + +/** + * @author Thomas Knauth + */ +public class PR79554 +{ + public static void main(String[] args) + { + try + { + if ( args.length < 0 ) + { + System.out.println("Usage!"); + return; + } + + throw new Exception(); + } + catch ( Throwable e ) + { + System.out.println( "exception caught!" ); + //e.printStackTrace(); + } + finally + { + System.out.println("finally block entered!"); + } + } +} + +aspect Aspect { + + pointcut main(): execution(void main(String[])); + + after(): main(){ + System.out.println("Aspect calling after main!"); + } +} |