[libbluray-devel] java.awt: avoid catching ThreadDeath

hpi1 git at videolan.org
Fri Jun 3 09:57:43 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Thu Jun  2 15:35:57 2016 +0300| [a6561e00d89e3892605560f9daaed8961640a64a] | committer: hpi1

java.awt: avoid catching ThreadDeath

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

 src/libbluray/bdj/java/java/awt/BDFontMetrics.java |    8 +++++---
 src/libbluray/bdj/java/java/awt/BDToolkitBase.java |    2 +-
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/libbluray/bdj/java/java/awt/BDFontMetrics.java b/src/libbluray/bdj/java/java/awt/BDFontMetrics.java
index fdcda44..ce018a7 100644
--- a/src/libbluray/bdj/java/java/awt/BDFontMetrics.java
+++ b/src/libbluray/bdj/java/java/awt/BDFontMetrics.java
@@ -130,8 +130,8 @@ public class BDFontMetrics extends sun.font.FontDesignMetrics {
                 if (fm != null) {
                     fm.destroy();
                 }
-            } catch (Throwable e) {
-                e.printStackTrace();
+            } catch (Exception e) {
+                logger.error("shutdown() failed: " + e);
             }
         }
         destroyN(BDFontMetrics.ftLib);
@@ -194,8 +194,10 @@ public class BDFontMetrics extends sun.font.FontDesignMetrics {
     static synchronized String[] getFontList() {
         try {
             init();
+        } catch (ThreadDeath td) {
+            throw td;
         } catch (Throwable t) {
-            System.err.println("getFontList() failed: " + t);
+            logger.error("getFontList() failed: " + t);
             return new String[0];
         }
 
diff --git a/src/libbluray/bdj/java/java/awt/BDToolkitBase.java b/src/libbluray/bdj/java/java/awt/BDToolkitBase.java
index 0f5e3e0..18f4014 100644
--- a/src/libbluray/bdj/java/java/awt/BDToolkitBase.java
+++ b/src/libbluray/bdj/java/java/awt/BDToolkitBase.java
@@ -61,7 +61,7 @@ abstract class BDToolkitBase extends Toolkit {
             if (toolkit instanceof BDToolkit) {
                 ((BDToolkit)toolkit).shutdown();
             }
-        } catch (Throwable t) {
+        } catch (Exception t) {
             logger.error("shutdownDisc() failed: " + t + "\n" + Logger.dumpStack(t));
         }
     }



More information about the libbluray-devel mailing list