[libbluray-devel] Revert 891be060dd7a872ef68afb1cf84b7d0faae6cb9b

hpi1 git at videolan.org
Mon Dec 1 21:57:37 CET 2014


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Mon Dec  1 22:53:09 2014 +0200| [9186e469f605545b9c20d76ca8309ef23faf47f8] | committer: hpi1

Revert 891be060dd7a872ef68afb1cf84b7d0faae6cb9b

Second tryLock() should fail. It seems failure can cause exception that should be ignored.

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

 src/libbluray/bdj/java-j2se/org/videolan/LockFile.java |   15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/libbluray/bdj/java-j2se/org/videolan/LockFile.java b/src/libbluray/bdj/java-j2se/org/videolan/LockFile.java
index 31ca4fe..6753f44 100644
--- a/src/libbluray/bdj/java-j2se/org/videolan/LockFile.java
+++ b/src/libbluray/bdj/java-j2se/org/videolan/LockFile.java
@@ -35,13 +35,16 @@ class LockFile {
             os = new RandomAccessFile(path, "rw");
             if (os.getChannel().tryLock() != null) {
                 /* Test if locking works: second tryLock() should fail */
-                if (os.getChannel().tryLock() != null) {
-                    try {
-                        os.close();
-                    } catch (Exception e) {
+                try {
+                    if (os.getChannel().tryLock() != null) {
+                        try {
+                            os.close();
+                        } catch (Exception e) {
+                        }
+                        logger.error("File locking is unreliable !");
+                        return null;
                     }
-                    logger.error("File locking is unreliable !");
-                    return null;
+                } catch (Exception e) {
                 }
                 return new LockFile(os);
             } else {



More information about the libbluray-devel mailing list