[libbluray-devel] TitleImpl: do not throw Error when error is not fatal.

hpi1 git at videolan.org
Tue Feb 3 09:06:50 CET 2015


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Tue Feb  3 09:59:09 2015 +0200| [4f7a283bcc182684399999084e3085f96686ddbf] | committer: hpi1

TitleImpl: do not throw Error when error is not fatal.

Error is not present in method signatures. Compiler does not warn when Error is uncaught.

Fixes loading discs with missing .bdjo files.

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

 .../bdj/java/javax/tv/service/SIManagerImpl.java      |   17 ++++++++++++++---
 src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java   |    7 ++++---
 2 files changed, 18 insertions(+), 6 deletions(-)

diff --git a/src/libbluray/bdj/java/javax/tv/service/SIManagerImpl.java b/src/libbluray/bdj/java/javax/tv/service/SIManagerImpl.java
index 8f54d5e..00c23fe 100644
--- a/src/libbluray/bdj/java/javax/tv/service/SIManagerImpl.java
+++ b/src/libbluray/bdj/java/javax/tv/service/SIManagerImpl.java
@@ -50,9 +50,20 @@ public class SIManagerImpl extends SIManager {
     protected SIManagerImpl() {
         int ntitles = Libbluray.numTitles();
         LinkedList list = new LinkedList();
-        for (int i = 0; i <= ntitles; i++)
-            list.add(new TitleImpl(i));
-        list.add(new TitleImpl(65535));
+        for (int i = 0; i <= ntitles; i++) {
+            try {
+                list.add(new TitleImpl(i));
+            } catch (Throwable t) {
+                org.videolan.Logger.getLogger("SIManagerImpl").error("Failed initializing title " + i + ": " + t);
+            }
+        }
+
+        try {
+            list.add(new TitleImpl(65535));
+        } catch (Throwable t) {
+            org.videolan.Logger.getLogger("SIManagerImpl").error("Failed initializing title FirstPlay: " + t);
+        }
+
         titles = new ServiceListImpl(list);
     }
 
diff --git a/src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java b/src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java
index 5322e13..a63f2d1 100644
--- a/src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java
+++ b/src/libbluray/bdj/java/org/bluray/ti/TitleImpl.java
@@ -1,6 +1,7 @@
 package org.bluray.ti;
 
 import javax.tv.locator.Locator;
+import javax.tv.service.SIException;
 import javax.tv.service.SIRequest;
 import javax.tv.service.SIRequestor;
 import javax.tv.service.ServiceType;
@@ -12,15 +13,15 @@ import org.videolan.TitleInfo;
 import org.videolan.bdjo.Bdjo;
 
 public class TitleImpl implements Title {
-    public TitleImpl(int titleNum) {
+    public TitleImpl(int titleNum) throws SIException {
         this.titleNum = titleNum;
         this.ti = Libbluray.getTitleInfo(titleNum);
         if (ti == null)
-            throw new Error("Invalid title " + titleNum);
+            throw new SIException("Title " + titleNum + " does not exist in disc index");
         if (ti.isBdj()) {
             bdjo = Libbluray.getBdjo(ti.getBdjoName());
             if (bdjo == null)
-                throw new Error("Invalid title " + titleNum);
+                throw new SIException("title " + titleNum + ": Failed loading " + ti.getBdjoName() + ".bdjo");
         }
     }
 



More information about the libbluray-devel mailing list