You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@poi.apache.org by us...@apache.org on 2015/11/11 20:17:18 UTC

svn commit: r1713917 - /poi/trunk/src/testcases/org/apache/poi/POITestCase.java

Author: uschindler
Date: Wed Nov 11 19:17:18 2015
New Revision: 1713917

URL: http://svn.apache.org/viewvc?rev=1713917&view=rev
Log:
Add security check

Modified:
    poi/trunk/src/testcases/org/apache/poi/POITestCase.java

Modified: poi/trunk/src/testcases/org/apache/poi/POITestCase.java
URL: http://svn.apache.org/viewvc/poi/trunk/src/testcases/org/apache/poi/POITestCase.java?rev=1713917&r1=1713916&r2=1713917&view=diff
==============================================================================
--- poi/trunk/src/testcases/org/apache/poi/POITestCase.java (original)
+++ poi/trunk/src/testcases/org/apache/poi/POITestCase.java Wed Nov 11 19:17:18 2015
@@ -79,6 +79,7 @@ public class POITestCase {
       * Only use this method in test cases!!!
       */
      public static <R,T> R getFieldValue(final Class<? super T> clazz, final T instance, final Class<R> fieldType, final String fieldName) {
+         assertTrue("Reflection of private fields is only allowed for POI classes.", clazz.getName().startsWith("org.apache.poi."));
          try {
             return AccessController.doPrivileged(new PrivilegedExceptionAction<R>() {
                 @Override
@@ -100,6 +101,7 @@ public class POITestCase {
       */
      public static <R,T> R callMethod(final Class<? super T> clazz, final T instance, final Class<R> returnType, final String methodName,
              final Class<?>[] parameterTypes, final Object[] parameters) {
+         assertTrue("Reflection of private methods is only allowed for POI classes.", clazz.getName().startsWith("org.apache.poi."));
          try {
             return AccessController.doPrivileged(new PrivilegedExceptionAction<R>() {
                 @Override



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@poi.apache.org
For additional commands, e-mail: commits-help@poi.apache.org