[libbluray-devel] [Git][videolan/libbluray][master] 2 commits: Improve exception logging

Petri Hintukainen (@hpi) gitlab at videolan.org
Fri Aug 13 13:42:32 UTC 2021



Petri Hintukainen pushed to branch master at VideoLAN / libbluray


Commits:
b41a298a by hpi1 at 2021-08-12T14:58:32+03:00
Improve exception logging

- - - - -
06d7ce99 by hpi1 at 2021-08-13T16:40:58+03:00
BDJ: Implement GraphicsEnvironment and Toolkit creation for Java 13+

Doesn't use java.awt.graphicsenv property anymore.

- - - - -


4 changed files:

- ChangeLog
- + src/libbluray/bdj/java-j2se/sun/awt/PlatformGraphicsInfo.java
- src/libbluray/bdj/java/java/awt/BDGraphicsEnvironment.java
- src/libbluray/bdj/java/org/videolan/Logger.java


Changes:

=====================================
ChangeLog
=====================================
@@ -1,3 +1,4 @@
+- Add support for Java 13 ... 16.
 - Improve JVM probing in Windows.
 
 2021-04-05: Version 1.3.0


=====================================
src/libbluray/bdj/java-j2se/sun/awt/PlatformGraphicsInfo.java
=====================================
@@ -0,0 +1,46 @@
+/*
+ * This file is part of libbluray
+ * Copyright (C) 2021  VideoLAN
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see
+ * <http://www.gnu.org/licenses/>.
+ */
+
+package sun.awt;
+
+/* This class replaces java.awt.graphicsenv property in Java 13+ */
+
+import java.awt.GraphicsEnvironment;
+import java.awt.Toolkit;
+
+public class PlatformGraphicsInfo {
+
+    public static GraphicsEnvironment createGE() {
+        return new java.awt.BDGraphicsEnvironment();
+    }
+
+    public static Toolkit createToolkit() {
+        return new java.awt.BDToolkit();
+    }
+
+    public static boolean getDefaultHeadlessProperty() {
+        return false;
+    }
+
+    public static String getDefaultHeadlessMessage() {
+        org.videolan.Logger.getLogger(PlatformGraphicsInfo.class.getName())
+            .error("Headless graphics environment ?\n" + org.videolan.Logger.dumpStack());
+        return "Internal error: headless graphics environment ?";
+    }
+}


=====================================
src/libbluray/bdj/java/java/awt/BDGraphicsEnvironment.java
=====================================
@@ -24,7 +24,7 @@ import java.util.Locale;
 
 import org.videolan.Logger;
 
-class BDGraphicsEnvironment extends GraphicsEnvironment {
+public class BDGraphicsEnvironment extends GraphicsEnvironment {
     private BDGraphicsDevice graphicsDevice;
 
     public BDGraphicsEnvironment() {


=====================================
src/libbluray/bdj/java/org/videolan/Logger.java
=====================================
@@ -152,8 +152,11 @@ public class Logger {
     }
 
     public static String dumpStack(Throwable t) {
+        String sup = "";
+        if (t.getCause() != null)
+            sup += "\n    Caused by: " + t.getCause() + "\n" + dumpStack(t.getCause());
         StackTraceElement e[] = t.getStackTrace();
-        return printStackTrace(e, 0);
+        return printStackTrace(e, 0) + sup;
     }
 
     public void unimplemented(String func) {



View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/83b2ac110e79cc4dcd95cdc4425e36d3e87a7963...06d7ce99531eb643a6f165424373d1ab72178a51

-- 
View it on GitLab: https://code.videolan.org/videolan/libbluray/-/compare/83b2ac110e79cc4dcd95cdc4425e36d3e87a7963...06d7ce99531eb643a6f165424373d1ab72178a51
You're receiving this email because of your account on code.videolan.org.




More information about the libbluray-devel mailing list