[jboss-cvs] JBossAS SVN: r69658 - in projects/aop/trunk: asintegration/src/main/org/jboss/aop/deployers and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Feb 6 11:17:07 EST 2008
Author: kabir.khan at jboss.com
Date: 2008-02-06 11:17:07 -0500 (Wed, 06 Feb 2008)
New Revision: 69658
Modified:
projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/PortableAnnotationElement.java
projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AbstractAspectManager.java
Log:
[JBAS-5218] NPE trying to read annotations when shutting down server. Set a flag in PortableAnnotationElement
Modified: projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/PortableAnnotationElement.java
===================================================================
--- projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/PortableAnnotationElement.java 2008-02-06 16:01:33 UTC (rev 69657)
+++ projects/aop/trunk/aop/src/main/org/jboss/aop/annotation/PortableAnnotationElement.java 2008-02-06 16:17:07 UTC (rev 69658)
@@ -50,15 +50,29 @@
*/
public class PortableAnnotationElement
{
+ private static transient boolean closingDownManager;
+
+ public static void setClosingDownManager(boolean closing)
+ {
+ closingDownManager = closing;
+ }
+
public static boolean isInvisibleAnnotationPresent(Field field, String annotation) throws Exception
{
+ if (closingDownManager)
+ {
+ return false;
+ }
CtField ctMethod = ReflectToJavassist.fieldToJavassist(field);
return AnnotationElement.isInvisibleAnnotationPresent(ctMethod, annotation);
-
}
public static boolean isInvisibleAnnotationPresent(CtField field, String annotation)
{
+ if (closingDownManager)
+ {
+ return false;
+ }
FieldInfo mi = field.getFieldInfo2();
AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
@@ -69,6 +83,10 @@
public static boolean isVisibleAnnotationPresent(CtField field, String annotation)
{
+ if (closingDownManager)
+ {
+ return false;
+ }
FieldInfo mi = field.getFieldInfo2();
AnnotationsAttribute visible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.visibleTag);
@@ -79,6 +97,10 @@
public static boolean isAnyAnnotationPresent(CtField ctField, String annotation)
{
+ if (closingDownManager)
+ {
+ return false;
+ }
FieldInfo mi = ctField.getFieldInfo2();
AnnotationsAttribute visible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.visibleTag);
@@ -98,6 +120,10 @@
public static boolean isInvisibleAnnotationPresent(Method method, String annotation) throws Exception
{
+ if (closingDownManager)
+ {
+ return false;
+ }
CtMethod ctMethod = ReflectToJavassist.methodToJavassist(method);
if (ctMethod == null) return false;
MethodInfo mi = ctMethod.getMethodInfo2();
@@ -112,6 +138,10 @@
public static boolean isAnyAnnotationPresent(Field field, String annotation) throws Exception
{
+ if (closingDownManager)
+ {
+ return false;
+ }
CtField ctField = ReflectToJavassist.fieldToJavassist(field);
return AnnotationElement.isAnyAnnotationPresent(ctField, annotation);
@@ -119,6 +149,10 @@
public static boolean isAnyAnnotationPresent(Method method, String annotation) throws Exception
{
+ if (closingDownManager)
+ {
+ return false;
+ }
CtMethod ctMethod = ReflectToJavassist.methodToJavassist(method);
if (ctMethod == null) return false;
boolean present = AnnotationElement.isAnyAnnotationPresent(ctMethod, annotation);
@@ -128,6 +162,10 @@
public static boolean isAnyAnnotationPresent(CtMethod ctMethod, String annotation)
{
+ if (closingDownManager)
+ {
+ return false;
+ }
MethodInfo mi = ctMethod.getMethodInfo2();
AnnotationsAttribute visible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.visibleTag);
@@ -147,17 +185,22 @@
public static boolean isInvisibleAnnotationPresent(Constructor con, String annotation) throws Exception
{
+ if (closingDownManager)
+ {
+ return false;
+ }
CtConstructor ctMethod = ReflectToJavassist.constructorToJavassist(con);
return AnnotationElement.isInvisibleAnnotationPresent(ctMethod, annotation);
-
-
}
public static boolean isInvisibleAnnotationPresent(CtConstructor ctMethod, String annotation)
{
+ if (closingDownManager)
+ {
+ return false;
+ }
MethodInfo mi = ctMethod.getMethodInfo2();
-
AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
if (invisible == null) return false;
@@ -166,6 +209,10 @@
public static boolean isVisibleAnnotationPresent(CtConstructor ctMethod, String annotation)
{
+ if (closingDownManager)
+ {
+ return false;
+ }
MethodInfo mi = ctMethod.getMethodInfo2();
@@ -177,13 +224,20 @@
public static boolean isAnyAnnotationPresent(Constructor con, String annotation) throws Exception
{
+ if (closingDownManager)
+ {
+ return false;
+ }
CtConstructor ctMethod = ReflectToJavassist.constructorToJavassist(con);
return AnnotationElement.isAnyAnnotationPresent(ctMethod, annotation);
-
}
public static boolean isAnyAnnotationPresent(CtConstructor ctMethod, String annotation)
{
+ if (closingDownManager)
+ {
+ return false;
+ }
MethodInfo mi = ctMethod.getMethodInfo2();
AnnotationsAttribute visible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.visibleTag);
@@ -203,6 +257,10 @@
public static boolean isInvisibleAnnotationPresent(Class clazz, String annotation) throws Exception
{
+ if (closingDownManager)
+ {
+ return false;
+ }
if (clazz == Void.TYPE) return false;
ClassFile cf = AnnotationElement.getClassFile(clazz);
@@ -214,6 +272,10 @@
public static boolean isAnyAnnotationPresent(CtClass clazz, String annotation) throws Exception
{
+ if (closingDownManager)
+ {
+ return false;
+ }
try
{
if (clazz == CtClass.voidType) return false;
@@ -250,6 +312,10 @@
public static boolean isAnyAnnotationPresent(Class clazz, String annotation) throws Exception
{
+ if (closingDownManager)
+ {
+ return false;
+ }
if (clazz == Void.TYPE) return false;
ClassFile cf = AnnotationElement.getClassFile(clazz);
AnnotationsAttribute visible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.visibleTag);
@@ -285,6 +351,10 @@
public static Object getInvisibleAnnotation(Method method, Class annotation)
{
+ if (closingDownManager)
+ {
+ return false;
+ }
try
{
CtMethod ctMethod = ReflectToJavassist.methodToJavassist(method);
@@ -307,6 +377,10 @@
public static Object getInvisibleAnnotation(Constructor con, Class annotation)
{
+ if (closingDownManager)
+ {
+ return false;
+ }
try
{
CtConstructor ctMethod = ReflectToJavassist.constructorToJavassist(con);
@@ -326,6 +400,10 @@
public static Object getInvisibleAnnotation(Field field, Class annotation)
{
+ if (closingDownManager)
+ {
+ return false;
+ }
try
{
CtField ctField = ReflectToJavassist.fieldToJavassist(field);
@@ -345,6 +423,10 @@
public static Object getInvisibleAnnotation(Class clazz, Class annotation)
{
+ if (closingDownManager)
+ {
+ return false;
+ }
try
{
if (clazz == Void.TYPE) return null;
@@ -407,6 +489,10 @@
public static boolean isAnyAnnotationPresent(Field field, Class annotation) throws Exception
{
if (AnnotationElement.isVisibleAnnotationPresent(field, annotation)) return true;
+ if (closingDownManager)
+ {
+ return false;
+ }
CtField ctMethod = ReflectToJavassist.fieldToJavassist(field);
return isInvisibleAnnotationPresent(ctMethod, annotation.getName());
}
@@ -415,6 +501,10 @@
{
if (clazz == Void.TYPE) return false;
if (AnnotationElement.isVisibleAnnotationPresent(clazz, annotation)) return true;
+ if (closingDownManager)
+ {
+ return false;
+ }
ClassFile cf = getClassFile(clazz);
AnnotationsAttribute invisible = (AnnotationsAttribute) cf.getAttribute(AnnotationsAttribute.invisibleTag);
@@ -426,20 +516,25 @@
public static boolean isAnyAnnotationPresent(Constructor con, Class annotation) throws Exception
{
if (AnnotationElement.isVisibleAnnotationPresent(con, annotation)) return true;
+ if (closingDownManager)
+ {
+ return false;
+ }
CtConstructor ctMethod = ReflectToJavassist.constructorToJavassist(con);
return isVisibleAnnotationPresent(ctMethod, annotation.getName());
-
-
}
public static boolean isAnyAnnotationPresent(Method method, Class annotation) throws Exception
{
if (AnnotationElement.isVisibleAnnotationPresent(method, annotation)) return true;
+ if (closingDownManager)
+ {
+ return false;
+ }
CtMethod ctMethod = ReflectToJavassist.methodToJavassist(method);
if (ctMethod == null) return false;
MethodInfo mi = ctMethod.getMethodInfo2();
-
AnnotationsAttribute invisible = (AnnotationsAttribute) mi.getAttribute(AnnotationsAttribute.invisibleTag);
if (invisible == null) return false;
@@ -448,12 +543,20 @@
public static boolean isVisibleAnnotationPresent(Field field, String annotation) throws Exception
{
+ if (closingDownManager)
+ {
+ return false;
+ }
CtField ctMethod = ReflectToJavassist.fieldToJavassist(field);
return isVisibleAnnotationPresent(ctMethod, annotation);
}
public static boolean isVisibleAnnotationPresent(Class clazz, String annotation) throws Exception
{
+ if (closingDownManager)
+ {
+ return false;
+ }
if (clazz == Void.TYPE) return false;
ClassFile cf = getClassFile(clazz);
@@ -466,14 +569,20 @@
public static boolean isVisibleAnnotationPresent(Constructor con, String annotation) throws Exception
{
+ if (closingDownManager)
+ {
+ return false;
+ }
CtConstructor ctMethod = ReflectToJavassist.constructorToJavassist(con);
return isVisibleAnnotationPresent(ctMethod, annotation);
-
-
}
public static boolean isVisibleAnnotationPresent(Method method, String annotation) throws Exception
{
+ if (closingDownManager)
+ {
+ return false;
+ }
CtMethod ctMethod = ReflectToJavassist.methodToJavassist(method);
if (ctMethod == null) return false;
MethodInfo mi = ctMethod.getMethodInfo2();
Modified: projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AbstractAspectManager.java
===================================================================
--- projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AbstractAspectManager.java 2008-02-06 16:01:33 UTC (rev 69657)
+++ projects/aop/trunk/asintegration/src/main/org/jboss/aop/deployers/AbstractAspectManager.java 2008-02-06 16:17:07 UTC (rev 69658)
@@ -37,6 +37,7 @@
import org.jboss.aop.AspectManager;
import org.jboss.aop.AspectXmlLoader;
+import org.jboss.aop.annotation.PortableAnnotationElement;
import org.jboss.aop.asintegration.JBossIntegration;
import org.jboss.aop.deployment.AspectManagerService;
import org.jboss.deployment.DeploymentInfo;
@@ -167,6 +168,7 @@
Document doc = AspectXmlLoader.loadDocument(new BufferedInputStream(in));
AspectXmlLoader loader = new AspectXmlLoader();
loader.setManager(getAspectManager());
+ PortableAnnotationElement.setClosingDownManager(true);
loader.undeployXML(doc, null);
}
finally
More information about the jboss-cvs-commits
mailing list