Add missing runtime permission to TikaImpl (#28602)

Tests on jdk10 were failing because of a change in its ZipFile implementation 
that now needs `accessDeclaredMembers` permissions. This change adds 
the missing permission to the plugins security policy and TikaImpl.

Closes #28568
This commit is contained in:
Christoph Büscher 2018-02-09 14:41:24 +01:00 committed by GitHub
parent da1a10fa92
commit cc9cb5356a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 1 deletions

View File

@ -52,8 +52,8 @@ import java.security.SecurityPermission;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;
import java.util.Set;
import java.util.PropertyPermission; import java.util.PropertyPermission;
import java.util.Set;
/** /**
* Runs tika with limited parsers and limited permissions. * Runs tika with limited parsers and limited permissions.
@ -161,6 +161,8 @@ final class TikaImpl {
perms.add(new ReflectPermission("suppressAccessChecks")); perms.add(new ReflectPermission("suppressAccessChecks"));
// xmlbeans, use by POI, needs to get the context classloader // xmlbeans, use by POI, needs to get the context classloader
perms.add(new RuntimePermission("getClassLoader")); perms.add(new RuntimePermission("getClassLoader"));
// ZipFile needs accessDeclaredMembers on Java 10
perms.add(new RuntimePermission("accessDeclaredMembers"));
perms.setReadOnly(); perms.setReadOnly();
return perms; return perms;
} }

View File

@ -29,4 +29,6 @@ grant {
permission java.lang.reflect.ReflectPermission "suppressAccessChecks"; permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
// needed by xmlbeans, as part of POI for MS xml docs // needed by xmlbeans, as part of POI for MS xml docs
permission java.lang.RuntimePermission "getClassLoader"; permission java.lang.RuntimePermission "getClassLoader";
// ZipFile needs accessDeclaredMembers on Java 10
permission java.lang.RuntimePermission "accessDeclaredMembers";
}; };