diff --git a/src/testcases/org/apache/poi/POITestCase.java b/src/testcases/org/apache/poi/POITestCase.java index 8bd466c162..dda9443c81 100644 --- a/src/testcases/org/apache/poi/POITestCase.java +++ b/src/testcases/org/apache/poi/POITestCase.java @@ -79,6 +79,7 @@ public class POITestCase { * Only use this method in test cases!!! */ public static R getFieldValue(final Class clazz, final T instance, final Class 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() { @Override @@ -100,6 +101,7 @@ public class POITestCase { */ public static R callMethod(final Class clazz, final T instance, final Class 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() { @Override