[libbluray-devel] BD-J native events: catch exceptions before returning to native side

hpi1 git at videolan.org
Thu Apr 30 11:50:19 CEST 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Apr 30 12:41:10 2015 +0300| [8b855c9e1d1578ca78718deb0ee45cc2236880e5] | committer: hpi1

BD-J native events: catch exceptions before returning to native side

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

 src/libbluray/bdj/java/org/videolan/Libbluray.java |   11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/libbluray/bdj/java/org/videolan/Libbluray.java b/src/libbluray/bdj/java/org/videolan/Libbluray.java
index 7e2d8cc..41af18f 100644
--- a/src/libbluray/bdj/java/org/videolan/Libbluray.java
+++ b/src/libbluray/bdj/java/org/videolan/Libbluray.java
@@ -474,7 +474,7 @@ public class Libbluray {
     }
 
     /* called only from native code */
-    private static boolean processEvent(int event, int param) {
+    private static boolean processEventImpl(int event, int param) {
         boolean result = true;
         int key = 0;
 
@@ -552,6 +552,15 @@ public class Libbluray {
         return result;
     }
 
+    private static boolean processEvent(int event, int param) {
+        try {
+            return processEventImpl(event, param);
+        } catch (Throwable e) {
+            System.err.println("processEvent() failed: " + e + "\n" + Logger.dumpStack(e));
+            return false;
+        }
+    }
+
     public  static final int BDJ_EVENT_CHAPTER                  = 1;
     public  static final int BDJ_EVENT_PLAYITEM                 = 2;
     public  static final int BDJ_EVENT_ANGLE                    = 3;



More information about the libbluray-devel mailing list