Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
* Log as warnings SecurityException thrown on `Loader.getCacheDir(…
…)` instead of swallowing them
  • Loading branch information
saudet committed May 11, 2020
1 parent ce60746 commit d7c1b0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
@@ -1,4 +1,5 @@

* Log as warnings `SecurityException` thrown on `Loader.getCacheDir()` instead of swallowing them
* Fix memory leak that occurs with "org.bytedeco.javacpp.nopointergc" ([issue bytedeco/javacpp-presets#878](https://github.com/bytedeco/javacpp-presets/issues/878))
* Take into account `platform.library.path` when extracting executables and their libraries on `Loader.load()` ([issue bytedeco/javacv#1410](https://github.com/bytedeco/javacv/issues/1410))
* Move init code for `Loader.getPlatform()` to `Detector` to avoid warning messages ([issue #393](https://github.com/bytedeco/javacpp/issues/393))
Expand Down
3 changes: 2 additions & 1 deletion src/main/java/org/bytedeco/javacpp/Loader.java
Expand Up @@ -916,13 +916,14 @@ public static File getCacheDir() throws IOException {
System.getProperty("java.io.tmpdir") + "/.javacpp-" + System.getProperty("user.name") + "/cache/"};
for (String dirName : dirNames) {
if (dirName != null) {
File f = new File(dirName);
try {
File f = new File(dirName);
if ((f.exists() || f.mkdirs()) && f.canRead() && f.canWrite() && f.canExecute()) {
cacheDir = f;
break;
}
} catch (SecurityException e) {
logger.warn("Could not access " + f + ": " + e.getMessage());
// No access, try the next option.
}
}
Expand Down

0 comments on commit d7c1b0e

Please sign in to comment.