[libbluray-devel] Simplify getCacheRoot() in CacheDir class

tourettes git at videolan.org
Fri Mar 6 09:02:56 CET 2015


libbluray | branch: master | tourettes <tourettes at team-mediaportal.com> | Thu Mar  5 21:32:50 2015 +0200| [17d9437d5095e100ecd132a98b092ec5eec929b6] | committer: hpi1

Simplify getCacheRoot() in CacheDir class

> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=17d9437d5095e100ecd132a98b092ec5eec929b6
---

 src/libbluray/bdj/java/org/videolan/CacheDir.java |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/libbluray/bdj/java/org/videolan/CacheDir.java b/src/libbluray/bdj/java/org/videolan/CacheDir.java
index 83350cf..8118bb4 100644
--- a/src/libbluray/bdj/java/org/videolan/CacheDir.java
+++ b/src/libbluray/bdj/java/org/videolan/CacheDir.java
@@ -52,11 +52,11 @@ class CacheDir {
             return cacheRoot;
         }
 
-        SecurityManager sm = System.getSecurityManager();
-        if (sm != null && sm instanceof BDJSecurityManager) {
-            ((BDJSecurityManager)sm).setCacheRoot(System.getProperty("java.io.tmpdir"));
+        BDJSecurityManager sm = (BDJSecurityManager)System.getSecurityManager();
+        if (sm != null) {
+            sm.setCacheRoot(System.getProperty("java.io.tmpdir"));
             baseDir.mkdirs();
-            ((BDJSecurityManager)sm).setCacheRoot(baseDir.getPath());
+            sm.setCacheRoot(baseDir.getPath());
         }
 
         cleanupCache();
@@ -70,8 +70,8 @@ class CacheDir {
                 lockFile  = lockCache(cacheRoot.getPath());
                 logger.info("Created cache in " + tmpDir.getPath());
 
-                if (sm != null && sm instanceof BDJSecurityManager) {
-                    ((BDJSecurityManager)sm).setCacheRoot(cacheRoot.getPath());
+                if (sm != null) {
+                    sm.setCacheRoot(cacheRoot.getPath());
                 }
 
                 return cacheRoot;



More information about the libbluray-devel mailing list