Commit 4f7a283b authored by hpi1's avatar 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.
parent 0b248b7e
......@@ -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);
}
......
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");
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment