poi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r1713917 - /poi/trunk/src/testcases/org/apache/poi/POITestCase.java
Date Wed, 11 Nov 2015 19:17:18 GMT
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


Mime
View raw message