aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPJ Fanning <fanningpj@apache.org>2022-02-22 02:08:12 +0000
committerPJ Fanning <fanningpj@apache.org>2022-02-22 02:08:12 +0000
commit26978d373d62c2a6ae401583f3117979e7265b4b (patch)
tree91ebe2e3de0436b7cb1f4fafaad18458f1283ca9
parent418a633ae52dd2f80a5a265125f89bafe3a81038 (diff)
downloadpoi-26978d373d62c2a6ae401583f3117979e7265b4b.tar.gz
poi-26978d373d62c2a6ae401583f3117979e7265b4b.zip
java 17 build issue
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1898302 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--poi/src/test/java/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java1
-rw-r--r--poi/src/test/java/org/apache/poi/poifs/dev/TestPOIFSDump.java26
2 files changed, 15 insertions, 12 deletions
diff --git a/poi/src/test/java/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java b/poi/src/test/java/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
index 2c4e3f89f4..3121ee039d 100644
--- a/poi/src/test/java/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
+++ b/poi/src/test/java/org/apache/poi/hssf/extractor/TestOldExcelExtractor.java
@@ -362,6 +362,7 @@ final class TestOldExcelExtractor {
}
}
+ @SuppressForbidden("tests java.security features deprecated in java 17 - no other option though")
private static class NoExitSecurityManager extends SecurityManager {
@Override
public void checkPermission(Permission perm) {
diff --git a/poi/src/test/java/org/apache/poi/poifs/dev/TestPOIFSDump.java b/poi/src/test/java/org/apache/poi/poifs/dev/TestPOIFSDump.java
index 1b93047148..7a477cb3d6 100644
--- a/poi/src/test/java/org/apache/poi/poifs/dev/TestPOIFSDump.java
+++ b/poi/src/test/java/org/apache/poi/poifs/dev/TestPOIFSDump.java
@@ -152,6 +152,19 @@ public class TestPOIFSDump {
}
}
+ @SuppressForbidden("tests java.security features deprecated in java 17 - no other option though")
+ private static class TestOverrideSecurityManager extends SecurityManager {
+ @Override
+ public void checkExit(int status) {
+ throw new SecurityException();
+ }
+
+ @Override
+ public void checkPermission(Permission perm) {
+ // Allow other activities by default
+ }
+ }
+
@Test
void testMainNoArgs() {
Assumptions.assumeFalse(System.getProperty("java.version").startsWith("18"),
@@ -159,18 +172,7 @@ public class TestPOIFSDump {
SecurityManager sm = System.getSecurityManager();
try {
- System.setSecurityManager(new SecurityManager() {
- @Override
- public void checkExit(int status) {
- throw new SecurityException();
- }
-
- @Override
- public void checkPermission(Permission perm) {
- // Allow other activities by default
- }
- });
-
+ System.setSecurityManager(new TestOverrideSecurityManager());
assertThrows(SecurityException.class, () -> POIFSDump.main(new String[]{}));
} finally {
System.setSecurityManager(sm);