You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2023/01/10 15:32:29 UTC

[GitHub] [calcite] zabetak commented on a diff in pull request #2919: [CALCITE-5298] CalciteSystemProperty calcite.test.dataset path check fails under Java Security Manager

zabetak commented on code in PR #2919:
URL: https://github.com/apache/calcite/pull/2919#discussion_r1065928416


##########
core/src/main/java/org/apache/calcite/util/Util.java:
##########
@@ -1048,6 +1048,22 @@ public static String getStackTrace(Throwable t) {
     return sw.toString();
   }
 
+  /**
+   * Ignores the RuntimeException if it is an AccessControlException otherwise throws.
+   *
+   * <p>Checks a RuntimeException for AccessControlException without importing JDK
+   * classes that are deprecated in <a href="https://openjdk.org/jeps/411">JDK 17</a>
+   * with the anticipated removal of Java security manager.
+   *
+   * @param e RuntimeException to check if it is an AccessControlException
+   */
+  @API(since = "1.33", status = API.Status.EXPERIMENTAL)
+  public static void ignoreAccessControlException(RuntimeException e) {
+    if (!"java.security.AccessControlException".equals(e.getClass().getName())) {
+      throw e;
+    }
+  }

Review Comment:
   Do we really need this hacky check? `AccessControlException` is a subclass of `SecurityException`. The latter is not deprecated (https://download.java.net/java/early_access/jdk21/docs/api/java.base/java/lang/SecurityException.html) so I assume we can do regular `catch(SecurityException se)` where needed can't we?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org