[jboss-cvs] JBossAS SVN: r76057 - projects/aop/trunk/aop/src/main/org/jboss/aop.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 21 07:49:03 EDT 2008
Author: kabir.khan at jboss.com
Date: 2008-07-21 07:49:03 -0400 (Mon, 21 Jul 2008)
New Revision: 76057
Modified:
projects/aop/trunk/aop/src/main/org/jboss/aop/Advisor.java
Log:
Handle exceptions thrown by EJB3s replacement for AnnotationRepository when the class cannot be found
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/Advisor.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/Advisor.java 2008-07-21 11:45:27 UTC (rev 76056)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/Advisor.java 2008-07-21 11:49:03 UTC (rev 76057)
@@ -33,6 +33,7 @@
import java.security.PrivilegedExceptionAction;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -65,6 +66,7 @@
import org.jboss.aop.joinpoint.Joinpoint;
import org.jboss.aop.joinpoint.MethodInvocation;
import org.jboss.aop.metadata.ClassMetaDataBinding;
+import org.jboss.aop.metadata.ClassMetaDataLoader;
import org.jboss.aop.metadata.ConstructorMetaData;
import org.jboss.aop.metadata.FieldMetaData;
import org.jboss.aop.metadata.MethodMetaData;
@@ -216,6 +218,9 @@
*/
protected static Object NULL_ASPECT = new Object();
+ //When resolving annotations from the annotation repository we don't want to hit the annotation repository with the metadata from base-aspects.xml (@security, @transaction etc.)
+ //EJB 3 uses a custom metadata loader that tries to load up all these classes by name, and that will cause errors when loading up the annotations
+
/**
* Constructor.
* <p>
@@ -428,7 +433,15 @@
{
if (introduction.matches(this, clazz))
{
- annotations.addClassAnnotation(introduction.getAnnotation().getIdentifier(), introduction.getOriginalAnnotationExpr());
+ try
+ {
+ annotations.addClassAnnotation(introduction.getAnnotation().getIdentifier(), introduction.getOriginalAnnotationExpr());
+ }
+ catch(Exception ignore)
+ {
+ //When resolving annotations from the annotation repository we don't want to hit the annotation repository with the metadata from base-aspects.xml (@security, @transaction etc.)
+ //EJB 3 uses a custom metadata loader that tries to load up all these classes by name, and that will cause errors when loading up the annotations
+ }
}
Class<?> theClass = clazz;
@@ -439,7 +452,15 @@
{
if (introduction.matches(this, fields[i]))
{
- annotations.addAnnotation(fields[i], introduction.getAnnotation().getIdentifier(), introduction.getOriginalAnnotationExpr());
+ try
+ {
+ annotations.addAnnotation(fields[i], introduction.getAnnotation().getIdentifier(), introduction.getOriginalAnnotationExpr());
+ }
+ catch(Exception ignore)
+ {
+ //When resolving annotations from the annotation repository we don't want to hit the annotation repository with the metadata from base-aspects.xml (@security, @transaction etc.)
+ //EJB 3 uses a custom metadata loader that tries to load up all these classes by name, and that will cause errors when loading up the annotations
+ }
}
}
Constructor<?>[] cons = theClass.getDeclaredConstructors();
@@ -447,7 +468,15 @@
{
if (introduction.matches(this, cons[i]))
{
- annotations.addAnnotation(cons[i], introduction.getAnnotation().getIdentifier(), introduction.getOriginalAnnotationExpr());
+ try
+ {
+ annotations.addAnnotation(cons[i], introduction.getAnnotation().getIdentifier(), introduction.getOriginalAnnotationExpr());
+ }
+ catch(Exception ignore)
+ {
+ //When resolving annotations from the annotation repository we don't want to hit the annotation repository with the metadata from base-aspects.xml (@security, @transaction etc.)
+ //EJB 3 uses a custom metadata loader that tries to load up all these classes by name, and that will cause errors when loading up the annotations
+ }
}
}
}
@@ -485,7 +514,15 @@
{
if (introduction.matches(this, methods[i]))
{
- annotations.addAnnotation(methods[i], introduction.getAnnotation().getIdentifier(), introduction.getOriginalAnnotationExpr());
+ try
+ {
+ annotations.addAnnotation(methods[i], introduction.getAnnotation().getIdentifier(), introduction.getOriginalAnnotationExpr());
+ }
+ catch(Exception ignore)
+ {
+ //When resolving annotations from the annotation repository we don't want to hit the annotation repository with the metadata from base-aspects.xml (@security, @transaction etc.)
+ //EJB 3 uses a custom metadata loader that tries to load up all these classes by name, and that will cause errors when loading up the annotations
+ }
}
}
}
@@ -530,6 +567,7 @@
}
//Need to use the untyped version since that is used by EJB3
+
if (annotations.isDisabled(annotation))
return null;
@@ -611,7 +649,16 @@
if (metadata.isMetaDataPresent(annotation)) return true;
}
- if (annotations.hasClassAnnotation(annotation)) return true;
+ try
+ {
+ if (annotations.hasClassAnnotation(annotation)) return true;
+ }
+ catch(Exception ignore)
+ {
+ //When resolving annotations from the annotation repository we don't want to hit the annotation repository with the metadata from base-aspects.xml (@security, @transaction etc.)
+ //EJB 3 uses a custom metadata loader that tries to load up all these classes by name, and that will cause errors when loading up the annotations
+ }
+
if (tgt == null) return false;
try
{
@@ -833,9 +880,18 @@
}
}
- if (annotations.hasAnnotation(m, annotation)) return true;
try
{
+ if (annotations.hasAnnotation(m, annotation)) return true;
+ }
+ catch(Exception ignore)
+ {
+ //When resolving annotations from the annotation repository we don't want to hit the annotation repository with the metadata from base-aspects.xml (@security, @transaction etc.)
+ //EJB 3 uses a custom metadata loader that tries to load up all these classes by name, and that will cause errors when loading up the annotations
+ }
+
+ try
+ {
if (metadata == null)
{
return AnnotationElement.isAnyAnnotationPresent(m, annotation);
@@ -862,9 +918,18 @@
return true;
}
}
- if (annotations.hasAnnotation(m, annotation)) return true;
try
{
+ if (annotations.hasAnnotation(m, annotation)) return true;
+ }
+ catch(Exception ignore)
+ {
+ //When resolving annotations from the annotation repository we don't want to hit the annotation repository with the metadata from base-aspects.xml (@security, @transaction etc.)
+ //EJB 3 uses a custom metadata loader that tries to load up all these classes by name, and that will cause errors when loading up the annotations
+ }
+
+ try
+ {
if (metadata == null)
{
return AnnotationElement.isAnyAnnotationPresent(m, annotation);
@@ -886,9 +951,18 @@
return true;
}
}
- if (annotations.hasAnnotation(m, annotation)) return true;
try
{
+ if (annotations.hasAnnotation(m, annotation)) return true;
+ }
+ catch(Exception ignore)
+ {
+ //When resolving annotations from the annotation repository we don't want to hit the annotation repository with the metadata from base-aspects.xml (@security, @transaction etc.)
+ //EJB 3 uses a custom metadata loader that tries to load up all these classes by name, and that will cause errors when loading up the annotations
+ }
+
+ try
+ {
if (metadata == null)
{
return AnnotationElement.isAnyAnnotationPresent(m, annotation);
@@ -920,9 +994,18 @@
public boolean hasAnnotation(CtClass clazz, String annotation)
{
- if (annotations.hasClassAnnotation(annotation)) return true;
try
{
+ if (annotations.hasClassAnnotation(annotation)) return true;
+ }
+ catch(Exception ignore)
+ {
+ //When resolving annotations from the annotation repository we don't want to hit the annotation repository with the metadata from base-aspects.xml (@security, @transaction etc.)
+ //EJB 3 uses a custom metadata loader that tries to load up all these classes by name, and that will cause errors when loading up the annotations
+ }
+
+ try
+ {
return AnnotationElement.isAnyAnnotationPresent(clazz, annotation);
}
catch (Exception e)
@@ -934,21 +1017,48 @@
public boolean hasAnnotation(CtMethod member, String annotation)
{
// todo these are here so that we can chain configuration domains
- if (annotations.hasAnnotation(member, annotation)) return true;
+ try
+ {
+ if (annotations.hasAnnotation(member, annotation)) return true;
+ }
+ catch(Exception ignore)
+ {
+ //When resolving annotations from the annotation repository we don't want to hit the annotation repository with the metadata from base-aspects.xml (@security, @transaction etc.)
+ //EJB 3 uses a custom metadata loader that tries to load up all these classes by name, and that will cause errors when loading up the annotations
+ }
+
return AnnotationElement.isAnyAnnotationPresent(member, annotation);
}
public boolean hasAnnotation(CtField member, String annotation)
{
// todo these are here so that we can chain configuration domains
- if (annotations.hasAnnotation(member, annotation)) return true;
+ try
+ {
+ if (annotations.hasAnnotation(member, annotation)) return true;
+ }
+ catch(Exception ignore)
+ {
+ //When resolving annotations from the annotation repository we don't want to hit the annotation repository with the metadata from base-aspects.xml (@security, @transaction etc.)
+ //EJB 3 uses a custom metadata loader that tries to load up all these classes by name, and that will cause errors when loading up the annotations
+ }
+
return AnnotationElement.isAnyAnnotationPresent(member, annotation);
}
public boolean hasAnnotation(CtConstructor member, String annotation)
{
// todo these are here so that we can chain configuration domains
- if (annotations.hasAnnotation(member, annotation)) return true;
+ try
+ {
+ if (annotations.hasAnnotation(member, annotation)) return true;
+ }
+ catch(Exception ignore)
+ {
+ //When resolving annotations from the annotation repository we don't want to hit the annotation repository with the metadata from base-aspects.xml (@security, @transaction etc.)
+ //EJB 3 uses a custom metadata loader that tries to load up all these classes by name, and that will cause errors when loading up the annotations
+ }
+
return AnnotationElement.isAnyAnnotationPresent(member, annotation);
}
More information about the jboss-cvs-commits
mailing list