Return-Path: Delivered-To: apmail-geronimo-scm-archive@www.apache.org Received: (qmail 73113 invoked from network); 23 Apr 2010 13:48:31 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 23 Apr 2010 13:48:31 -0000 Received: (qmail 15869 invoked by uid 500); 23 Apr 2010 13:48:30 -0000 Delivered-To: apmail-geronimo-scm-archive@geronimo.apache.org Received: (qmail 15834 invoked by uid 500); 23 Apr 2010 13:48:30 -0000 Mailing-List: contact scm-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@geronimo.apache.org List-Id: Delivered-To: mailing list scm@geronimo.apache.org Received: (qmail 15827 invoked by uid 99); 23 Apr 2010 13:48:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Apr 2010 13:48:30 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 23 Apr 2010 13:48:27 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 44B3D23888EA; Fri, 23 Apr 2010 13:47:45 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r937297 - in /geronimo/specs/trunk/geronimo-jcdi_1.0_spec: pom.xml src/main/java/javax/enterprise/util/AnnotationLiteral.java Date: Fri, 23 Apr 2010 13:47:45 -0000 To: scm@geronimo.apache.org From: dwoods@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100423134745.44B3D23888EA@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: dwoods Date: Fri Apr 23 13:47:44 2010 New Revision: 937297 URL: http://svn.apache.org/viewvc?rev=937297&view=rev Log: GERONIMO-5259 Annoying 'access denied' security exceptions for oenwebbeans while java2 security is enabled. Contributed by Ying Wang. I also updated the pom.xml to use the specs that are stagged for a vote right now, as newer snapshot are not needed at this time. Modified: geronimo/specs/trunk/geronimo-jcdi_1.0_spec/pom.xml geronimo/specs/trunk/geronimo-jcdi_1.0_spec/src/main/java/javax/enterprise/util/AnnotationLiteral.java Modified: geronimo/specs/trunk/geronimo-jcdi_1.0_spec/pom.xml URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jcdi_1.0_spec/pom.xml?rev=937297&r1=937296&r2=937297&view=diff ============================================================================== --- geronimo/specs/trunk/geronimo-jcdi_1.0_spec/pom.xml (original) +++ geronimo/specs/trunk/geronimo-jcdi_1.0_spec/pom.xml Fri Apr 23 13:47:44 2010 @@ -72,25 +72,25 @@ org.apache.geronimo.specs geronimo-interceptor_1.1_spec - 1.1-SNAPSHOT + 1.0 provided org.apache.geronimo.specs geronimo-el_2.2_spec - 1.1-SNAPSHOT + 1.0 provided org.apache.geronimo.specs geronimo-atinject_1.0_spec - 1.1-SNAPSHOT + 1.0 provided org.apache.geronimo.specs geronimo-annotation_1.1_spec - 1.1-SNAPSHOT + 1.0 provided Modified: geronimo/specs/trunk/geronimo-jcdi_1.0_spec/src/main/java/javax/enterprise/util/AnnotationLiteral.java URL: http://svn.apache.org/viewvc/geronimo/specs/trunk/geronimo-jcdi_1.0_spec/src/main/java/javax/enterprise/util/AnnotationLiteral.java?rev=937297&r1=937296&r2=937297&view=diff ============================================================================== --- geronimo/specs/trunk/geronimo-jcdi_1.0_spec/src/main/java/javax/enterprise/util/AnnotationLiteral.java (original) +++ geronimo/specs/trunk/geronimo-jcdi_1.0_spec/src/main/java/javax/enterprise/util/AnnotationLiteral.java Fri Apr 23 13:47:44 2010 @@ -20,9 +20,12 @@ package javax.enterprise.util; import java.io.Serializable; import java.lang.annotation.Annotation; +import java.lang.reflect.AccessibleObject; import java.lang.reflect.Method; import java.lang.reflect.ParameterizedType; import java.lang.reflect.Type; +import java.security.AccessController; +import java.security.PrivilegedAction; import java.util.Arrays; /** @@ -97,7 +100,12 @@ public abstract class AnnotationLiteral< @Override public boolean equals(Object other) { - Method[] methods = this.annotationType.getDeclaredMethods(); + Method[] methods = (Method[])AccessController.doPrivileged(new PrivilegedAction() { + public Object run() + { + return annotationType.getDeclaredMethods(); + } + }); if(other == this) { @@ -213,7 +221,7 @@ public abstract class AnnotationLiteral< { if (!method.isAccessible()) { - method.setAccessible(true); + AccessController.doPrivileged(new PrivilegedActionForAccessibleObject(method, true)); } return method.invoke(instance, EMPTY_OBJECT_ARRAY); @@ -224,16 +232,19 @@ public abstract class AnnotationLiteral< } finally { - method.setAccessible(access); + AccessController.doPrivileged(new PrivilegedActionForAccessibleObject(method, access)); } - - } @Override public int hashCode() { - Method[] methods = this.annotationType.getDeclaredMethods(); + Method[] methods = (Method[])AccessController.doPrivileged(new PrivilegedAction() { + public Object run() + { + return annotationType.getDeclaredMethods(); + } + }); int hashCode = 0; for (Method method : methods) @@ -301,8 +312,12 @@ public abstract class AnnotationLiteral< @Override public String toString() { - Method[] methods = this.annotationType.getDeclaredMethods(); - + Method[] methods = (Method[])AccessController.doPrivileged(new PrivilegedAction() { + public Object run() + { + return annotationType.getDeclaredMethods(); + } + }); StringBuilder sb = new StringBuilder("@" + annotationType().getName() + "("); int lenght = methods.length; @@ -324,4 +339,24 @@ public abstract class AnnotationLiteral< return sb.toString(); } -} \ No newline at end of file + + protected static class PrivilegedActionForAccessibleObject implements PrivilegedAction + { + AccessibleObject object; + boolean flag; + + protected PrivilegedActionForAccessibleObject(AccessibleObject object, boolean flag) + { + this.object = object; + this.flag = flag; + } + + public Object run() + { + object.setAccessible(flag); + return null; + } + } + +} +