This is an automated email from the ASF dual-hosted git repository.
krisden pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/calcite.git
The following commit(s) were added to refs/heads/main by this push:
new 4bebdb07c2 [CALCITE-5298] CalciteSystemProperty calcite.test.dataset
path check fails under Java Security Manager
4bebdb07c2 is described below
commit 4bebdb07c2f45a95c9a4fdf81e9bcfbdd11a15de
Author: Kevin Risden <[email protected]>
AuthorDate: Sun Sep 25 11:33:53 2022 -0400
[CALCITE-5298] CalciteSystemProperty calcite.test.dataset path check fails
under Java Security Manager
---
.../org/apache/calcite/config/CalciteSystemProperty.java | 16 ++++++++++------
.../java/org/apache/calcite/util/SaffronProperties.java | 7 +++----
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git
a/core/src/main/java/org/apache/calcite/config/CalciteSystemProperty.java
b/core/src/main/java/org/apache/calcite/config/CalciteSystemProperty.java
index 5426980c11..baab8e5092 100644
--- a/core/src/main/java/org/apache/calcite/config/CalciteSystemProperty.java
+++ b/core/src/main/java/org/apache/calcite/config/CalciteSystemProperty.java
@@ -196,8 +196,13 @@ public final class CalciteSystemProperty<T> {
"../../calcite-test-dataset"
};
for (String s : dirs) {
- if (new File(s).exists() && new File(s, "vm").exists()) {
- return s;
+ try {
+ if (new File(s).exists() && new File(s, "vm").exists()) {
+ return s;
+ }
+ } catch (SecurityException ignore) {
+ // Ignore SecurityException on purpose because if
+ // we can't get to the file we fall through.
}
}
return ".";
@@ -449,10 +454,9 @@ public final class CalciteSystemProperty<T> {
}
} catch (IOException e) {
throw new RuntimeException("while reading from saffron.properties file",
e);
- } catch (RuntimeException e) {
- if
(!"java.security.AccessControlException".equals(e.getClass().getName())) {
- throw e;
- }
+ } catch (SecurityException ignore) {
+ // Ignore SecurityException on purpose because if
+ // we can't get to the file we fall through.
}
// Merge system and saffron properties, mapping deprecated saffron
diff --git a/core/src/main/java/org/apache/calcite/util/SaffronProperties.java
b/core/src/main/java/org/apache/calcite/util/SaffronProperties.java
index 4f5ec59254..fcc6f9b03b 100644
--- a/core/src/main/java/org/apache/calcite/util/SaffronProperties.java
+++ b/core/src/main/java/org/apache/calcite/util/SaffronProperties.java
@@ -133,10 +133,9 @@ public interface SaffronProperties {
}
} catch (IOException e) {
throw new RuntimeException("while reading from saffron.properties
file", e);
- } catch (RuntimeException e) {
- if
(!"java.security.AccessControlException".equals(e.getClass().getName())) {
- throw e;
- }
+ } catch (SecurityException ignore) {
+ // Ignore SecurityException on purpose because if
+ // we can't get to the file we fall through.
}
// copy in all system properties which start with "saffron."