tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r711501 - in /tomcat/tc6.0.x/trunk: STATUS.txt java/org/apache/catalina/util/DefaultAnnotationProcessor.java webapps/docs/changelog.xml
Date Wed, 05 Nov 2008 03:22:32 GMT
Author: markt
Date: Tue Nov  4 19:22:31 2008
New Revision: 711501

URL: http://svn.apache.org/viewvc?rev=711501&view=rev
Log:
* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46096
Support annotation processing whilst running under a security manager

Modified:
    tomcat/tc6.0.x/trunk/STATUS.txt
    tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/DefaultAnnotationProcessor.java
    tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml

Modified: tomcat/tc6.0.x/trunk/STATUS.txt
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/STATUS.txt?rev=711501&r1=711500&r2=711501&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/STATUS.txt (original)
+++ tomcat/tc6.0.x/trunk/STATUS.txt Tue Nov  4 19:22:31 2008
@@ -187,12 +187,6 @@
   +1: fhanik, pero
   -1: 
 
-* Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46096
-  Support annotation processing whilst running under a security manager
-  http://people.apache.org/~markt/patches/2008-10-27-bug46096.patch
-  +1: markt, fhanik, remm
-  -1: 
-
 * Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=46085
   Hard to reproduce thread safety issue with session expiration
   http://svn.apache.org/viewvc?rev=708273&view=rev

Modified: tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/DefaultAnnotationProcessor.java
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/DefaultAnnotationProcessor.java?rev=711501&r1=711500&r2=711501&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/DefaultAnnotationProcessor.java (original)
+++ tomcat/tc6.0.x/trunk/java/org/apache/catalina/util/DefaultAnnotationProcessor.java Tue
Nov  4 19:22:31 2008
@@ -21,6 +21,8 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.lang.reflect.Modifier;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.PreDestroy;
@@ -32,6 +34,7 @@
 import javax.xml.ws.WebServiceRef;
 
 import org.apache.AnnotationProcessor;
+import org.apache.catalina.Globals;
 
 
 /**
@@ -59,7 +62,18 @@
         Class<?> clazz = instance.getClass();
         
         while (clazz != null) {
-            Method[] methods = clazz.getDeclaredMethods();
+            Method[] methods = null;
+            if (Globals.IS_SECURITY_ENABLED) {
+                final Class<?> clazz2 = clazz;
+                methods = AccessController.doPrivileged(
+                        new PrivilegedAction<Method[]>(){
+                    public Method[] run(){
+                        return clazz2.getDeclaredMethods();
+                    }
+                });
+            } else {
+                methods = clazz.getDeclaredMethods();
+            }
             Method postConstruct = null;
             for (int i = 0; i < methods.length; i++) {
                 if (methods[i].isAnnotationPresent(PostConstruct.class)) {
@@ -141,7 +155,18 @@
         
         while (clazz != null) {
             // Initialize fields annotations
-            Field[] fields = clazz.getDeclaredFields();
+            Field[] fields = null;
+            if (Globals.IS_SECURITY_ENABLED) {
+                final Class<?> clazz2 = clazz;
+                fields = AccessController.doPrivileged(
+                        new PrivilegedAction<Field[]>(){
+                    public Field[] run(){
+                        return clazz2.getDeclaredFields();
+                    }
+                });
+            } else {
+                fields = clazz.getDeclaredFields();
+            }
             for (int i = 0; i < fields.length; i++) {
                 if (fields[i].isAnnotationPresent(Resource.class)) {
                     Resource annotation =
@@ -175,7 +200,18 @@
             }
             
             // Initialize methods annotations
-            Method[] methods = clazz.getDeclaredMethods();
+            Method[] methods = null;
+            if (Globals.IS_SECURITY_ENABLED) {
+                final Class<?> clazz2 = clazz;
+                methods = AccessController.doPrivileged(
+                        new PrivilegedAction<Method[]>(){
+                    public Method[] run(){
+                        return clazz2.getDeclaredMethods();
+                    }
+                });
+            } else {
+                methods = clazz.getDeclaredMethods();
+            }
             for (int i = 0; i < methods.length; i++) {
                 if (methods[i].isAnnotationPresent(Resource.class)) {
                     Resource annotation = methods[i].getAnnotation(Resource.class);

Modified: tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml
URL: http://svn.apache.org/viewvc/tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml?rev=711501&r1=711500&r2=711501&view=diff
==============================================================================
--- tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml (original)
+++ tomcat/tc6.0.x/trunk/webapps/docs/changelog.xml Tue Nov  4 19:22:31 2008
@@ -141,6 +141,10 @@
         jsessionid path parameter name. Based on a patch by Jean-frederic Clere.
         (markt)
       </add>
+      <fix>
+        <bug>46096</bug>:  Support annotation processing whilst running under
a
+        security manager. (markt)
+      </fix>
     </changelog>
   </subsection>
   <subsection name="Coyote">



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


Mime
View raw message