From: aclement Date: Wed, 15 Feb 2006 11:10:46 +0000 (+0000) Subject: test and fix for 120527 and test (commented out) for 127299 X-Git-Tag: POST_MEMORY_CHANGES~76 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=9e06d0efc2697c328f95d468631ec009443f8e43;p=aspectj.git test and fix for 120527 and test (commented out) for 127299 --- diff --git a/tests/bugs151/pr127299/ModelErrorConversion.aj b/tests/bugs151/pr127299/ModelErrorConversion.aj new file mode 100644 index 000000000..3366e15ca --- /dev/null +++ b/tests/bugs151/pr127299/ModelErrorConversion.aj @@ -0,0 +1,51 @@ +aspect ModelErrorConversion { + + + // convert exception types + after(Entity entity) throwing (HibernateException e): modelExec(entity) { + convertException(e, entity, thisJoinPoint); + } + after(Entity entity) throwing (ServiceException e): modelExec(entity) { + convertException(e, entity, thisJoinPoint); + } + after(Entity entity) throwing (SOAPException e): modelExec(entity) { + convertException(e, entity, thisJoinPoint); + } + after(Entity entity) throwing (SOAPFaultException e): modelExec(entity) { + convertException(e, entity, thisJoinPoint); + } + + /** execution of any method in the model */ + pointcut modelExecStatic() : + execution(* model..*(..)); + + pointcut modelExec(Entity entity) : + modelExecStatic() && this(entity); + // soften the checked exceptions + declare soft: ServiceException: modelExecStatic(); + declare soft: SOAPException: modelExecStatic(); + + + /** Converts exceptions to model exceptions, storing context */ + private void convertException(Exception e, Entity entity, + JoinPoint jp) { + ModelException me = new ModelException(e); + me.setEntity(entity); + me.setArgs(jp.getArgs()); + // ModelException extends RuntimeException, so this is unchecked + throw me; + } +} + +class HibernateException extends RuntimeException {} +class ServiceException extends Exception {} +class SOAPException extends Exception {} +class SOAPFaultException extends RuntimeException {} + +class Entity {} + +class ModelException extends RuntimeException { + public ModelException(Throwable t) { super(t); } + public void setEntity(Entity entity) {} + public void setArgs(Object[] argz) {} +} diff --git a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java index 4407a8106..b15102fa2 100644 --- a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java @@ -37,6 +37,8 @@ public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testIncorrectlyReferencingPointcuts_pr122452_2() { runTest("incorrectly referencing pointcuts - 2");} public void testInlinevisitorNPE_pr123901() { runTest("inlinevisitor NPE");} //public void testExposingWithintype_enh123423() { runTest("exposing withintype");} + //public void testMissingImport_pr127299() { runTest("missing import gives funny message");} + public void testUnusedInterfaceMessage_pr120527() { runTest("incorrect unused interface message");} public void testMixingNumbersOfTypeParameters_pr125080() { runTest("mixing numbers of type parameters"); diff --git a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml index 10102fc77..140d66e22 100644 --- a/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml +++ b/tests/src/org/aspectj/systemtest/ajc151/ajc151.xml @@ -7,6 +7,14 @@ + + + + + + + +