[libbluray-devel] Do not catch Throwable in places where thread should be terminated on Error or ThreadDeath
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:28:18 2015 +0300| [2e999752e8052e0175c60dde5e4b24582179e110] | committer: hpi1
Do not catch Throwable in places where thread should be terminated on Error or ThreadDeath
> http://git.videolan.org/gitweb.cgi/libbluray.git/?a=commit;h=2e999752e8052e0175c60dde5e4b24582179e110
---
.../bdj/java/com/aacsla/bluray/online/ContentAttribute.java | 4 ++--
src/libbluray/bdj/java/java/awt/BDJHelper.java | 2 +-
src/libbluray/bdj/java/java/io/BDFileSystem.java | 2 +-
src/libbluray/bdj/java/javax/tv/service/SIManagerImpl.java | 4 ++--
src/libbluray/bdj/java/org/videolan/BDJActionManager.java | 2 +-
src/libbluray/bdj/java/org/videolan/BDJActionQueue.java | 5 ++++-
src/libbluray/bdj/java/org/videolan/BDJXletContext.java | 4 ++--
src/libbluray/bdj/java/org/videolan/Copy.java | 4 ++--
.../java/org/videolan/media/content/playlist/Handler.java | 10 +++++-----
9 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/src/libbluray/bdj/java/com/aacsla/bluray/online/ContentAttribute.java b/src/libbluray/bdj/java/com/aacsla/bluray/online/ContentAttribute.java
index de13511..fbfa45d 100644
--- a/src/libbluray/bdj/java/com/aacsla/bluray/online/ContentAttribute.java
+++ b/src/libbluray/bdj/java/com/aacsla/bluray/online/ContentAttribute.java
@@ -37,14 +37,14 @@ public class ContentAttribute {
if (is.read(bytes, 0, 6) != 6)
return null;
return bytes;
- } catch (Throwable e) {
+ } catch (Exception e) {
e.printStackTrace();
return null;
} finally {
if (is != null) {
try {
is.close();
- } catch (Throwable e) {
+ } catch (Exception e) {
e.printStackTrace();
}
}
diff --git a/src/libbluray/bdj/java/java/awt/BDJHelper.java b/src/libbluray/bdj/java/java/awt/BDJHelper.java
index f5a165b..6d8c4af 100644
--- a/src/libbluray/bdj/java/java/awt/BDJHelper.java
+++ b/src/libbluray/bdj/java/java/awt/BDJHelper.java
@@ -84,7 +84,7 @@ public class BDJHelper {
eq.postEvent(event);
return true;
}
- } catch (Throwable e) {
+ } catch (Exception e) {
org.videolan.Logger.getLogger("BDJHelper").error("postKeyEvent failed: " + e);
}
} else {
diff --git a/src/libbluray/bdj/java/java/io/BDFileSystem.java b/src/libbluray/bdj/java/java/io/BDFileSystem.java
index 0e1c07d..64c4c9e 100644
--- a/src/libbluray/bdj/java/java/io/BDFileSystem.java
+++ b/src/libbluray/bdj/java/java/io/BDFileSystem.java
@@ -90,7 +90,7 @@ public abstract class BDFileSystem extends FileSystem {
} else {
filesystem.set(null, new BDFileSystemImpl(fs));
}
- } catch (Throwable t) {
+ } catch (Exception t) {
System.err.print("Hooking FileSystem class failed: " + t);
}
}
diff --git a/src/libbluray/bdj/java/javax/tv/service/SIManagerImpl.java b/src/libbluray/bdj/java/javax/tv/service/SIManagerImpl.java
index 00c23fe..4016876 100644
--- a/src/libbluray/bdj/java/javax/tv/service/SIManagerImpl.java
+++ b/src/libbluray/bdj/java/javax/tv/service/SIManagerImpl.java
@@ -53,14 +53,14 @@ public class SIManagerImpl extends SIManager {
for (int i = 0; i <= ntitles; i++) {
try {
list.add(new TitleImpl(i));
- } catch (Throwable t) {
+ } catch (Exception t) {
org.videolan.Logger.getLogger("SIManagerImpl").error("Failed initializing title " + i + ": " + t);
}
}
try {
list.add(new TitleImpl(65535));
- } catch (Throwable t) {
+ } catch (Exception t) {
org.videolan.Logger.getLogger("SIManagerImpl").error("Failed initializing title FirstPlay: " + t);
}
diff --git a/src/libbluray/bdj/java/org/videolan/BDJActionManager.java b/src/libbluray/bdj/java/org/videolan/BDJActionManager.java
index 4188f11..d8b46db 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJActionManager.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJActionManager.java
@@ -38,7 +38,7 @@ public class BDJActionManager {
protected static void shutdown() {
try {
instance.commandQueue.shutdown();
- } catch (Throwable t) {
+ } catch (Exception t) {
} finally {
running = false;
}
diff --git a/src/libbluray/bdj/java/org/videolan/BDJActionQueue.java b/src/libbluray/bdj/java/org/videolan/BDJActionQueue.java
index fc74543..1530c56 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJActionQueue.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJActionQueue.java
@@ -50,7 +50,7 @@ public class BDJActionQueue implements Runnable {
watchdog.shutdown();
try {
thread.join();
- } catch (Throwable t) {
+ } catch (InterruptedException t) {
logger.error("Error joining thread: " + t);
}
}
@@ -75,6 +75,9 @@ public class BDJActionQueue implements Runnable {
((BDJAction)action).process();
watchdog.endAction();
+ } catch (ThreadDeath d) {
+ System.err.println("action failed: " + d + "\n");
+ throw d;
} catch (Throwable e) {
System.err.println("action failed: " + e + "\n" + Logger.dumpStack(e));
}
diff --git a/src/libbluray/bdj/java/org/videolan/BDJXletContext.java b/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
index a22fc47..ae5b3a0 100644
--- a/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
+++ b/src/libbluray/bdj/java/org/videolan/BDJXletContext.java
@@ -287,7 +287,7 @@ public class BDJXletContext implements javax.tv.xlet.XletContext, javax.microedi
try {
look = defClass.newInstance();
setDefaultLook(key, look);
- } catch (Throwable t) {
+ } catch (Exception t) {
logger.error("Error creating default look " + defClass.getName() + " for " + key + ": " + t);
}
}
@@ -357,7 +357,7 @@ public class BDJXletContext implements javax.tv.xlet.XletContext, javax.microedi
}
try {
thread.join();
- } catch (Throwable t) { }
+ } catch (InterruptedException e) { }
}
private void stopIxcThreads() {
diff --git a/src/libbluray/bdj/java/org/videolan/Copy.java b/src/libbluray/bdj/java/org/videolan/Copy.java
index 353fee7..ad15c22 100644
--- a/src/libbluray/bdj/java/org/videolan/Copy.java
+++ b/src/libbluray/bdj/java/org/videolan/Copy.java
@@ -65,10 +65,10 @@ public class Copy {
}
System.err.println("deepCopy: failed to resolve class " + desc.getName());
throw e;
- } catch (Throwable t) {
+ } catch (Exception t) {
System.err.println("deepCopy: failed to resolve class " + desc.getName() + ": " + t);
return null;
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java b/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
index 7046b77..7e52949 100644
--- a/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
+++ b/src/libbluray/bdj/java/org/videolan/media/content/playlist/Handler.java
@@ -129,7 +129,7 @@ public class Handler extends BDHandler {
updateTime(new Time(Libbluray.tellTime() * TO_SECONDS));
currentLocator = new BDLocator(locator.toExternalForm());
- } catch (Throwable e) {
+ } catch (Exception e) {
return new ConnectionErrorEvent(this);
}
return super.doPrefetch();
@@ -141,14 +141,14 @@ public class Handler extends BDHandler {
if (at != null) {
try {
Libbluray.seekTime((long)(at.getSeconds() * FROM_SECONDS));
- } catch (Throwable e) {
+ } catch (Exception e) {
return new ConnectionErrorEvent(this);
}
}
try {
Libbluray.selectRate(rate, true);
- } catch (Throwable e) {
+ } catch (Exception e) {
return new ConnectionErrorEvent(this);
}
@@ -167,7 +167,7 @@ public class Handler extends BDHandler {
if ((state == Prefetched) || (state == Started)) {
try {
Libbluray.seekTime((long)(at.getSeconds() * FROM_SECONDS));
- } catch (Throwable e) {
+ } catch (Exception e) {
return;
}
at = new Time(Libbluray.tellTime() * TO_SECONDS);
@@ -181,7 +181,7 @@ public class Handler extends BDHandler {
if (state == Started) {
try {
Libbluray.selectRate(factor.floatValue());
- } catch (Throwable e) {
+ } catch (Exception e) {
return;
}
if (state == Started) {
More information about the libbluray-devel
mailing list