[jboss-cvs] JBossAS SVN: r107349 - projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Tue Aug 3 10:01:23 EDT 2010


Author: kabir.khan at jboss.com
Date: 2010-08-03 10:01:22 -0400 (Tue, 03 Aug 2010)
New Revision: 107349

Modified:
   projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java
Log:
[JBREFLECT-137] Better logging

Modified: projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java
===================================================================
--- projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java	2010-08-03 10:20:40 UTC (rev 107348)
+++ projects/jboss-reflect/trunk/src/main/java/org/jboss/reflect/plugins/introspection/IntrospectionTypeInfoFactoryImpl.java	2010-08-03 14:01:22 UTC (rev 107349)
@@ -34,6 +34,8 @@
 import java.lang.reflect.WildcardType;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
@@ -606,20 +608,34 @@
 
    private Annotation[] readAnnotations(final AnnotatedElement ao)
    {
-      if (System.getSecurityManager() == null)
-         return ao.getAnnotations();
-      else
+      try
       {
-         PrivilegedAction<Annotation[]> action = new PrivilegedAction<Annotation[]>()
+         if (System.getSecurityManager() == null)
+            return ao.getAnnotations();
+         else
          {
-            public Annotation[] run()
+            try
             {
-               return ao.getAnnotations();
+               PrivilegedExceptionAction<Annotation[]> action = new PrivilegedExceptionAction<Annotation[]>()
+               {
+                  public Annotation[] run()
+                  {
+                     return ao.getAnnotations();
+                  }
+               };
+               
+               return AccessController.doPrivileged(action);
             }
-         };
-         
-         return AccessController.doPrivileged(action);
+            catch (PrivilegedActionException e)
+            {
+               throw e.getCause();
+            }
+         }
       }
+      catch (Throwable e)
+      {
+         throw new RuntimeException("Could not read annotations for " + ao, e);
+      }
    }
 
    protected AnnotationValue[][] getParameterAnnotations(Annotation[][] annotations)



More information about the jboss-cvs-commits mailing list