[libbluray-devel] [PATCH] Fix compatibility with recent versions of Java 7

rraptorr at nails.eu.org rraptorr at nails.eu.org
Sat Jan 4 18:29:30 CET 2014


From: Janusz Dziemidowicz <rraptorr at nails.eu.org>

Recent Java 7 versions changed
sun.awt.KeyboardFocusManagerPeerProvider.createKeyboardFocusManagerPeer()
method to
sun.awt.KeyboardFocusManagerPeerProvider.getKeyboardFocusManagerPeer(). This
causes BD-J initialization to fail with Java 7u45 (and most probably
earlier, I am not sure when the change occured). Fix this by providing
both methods. Tested on Java 6u45, 7u10 and 7u45.
---
 src/libbluray/bdj/java-j2se/java/awt/BDToolkit.java                 | 6 ++++++
 .../bdj/java-j2se/sun/awt/KeyboardFocusManagerPeerProvider.java     | 3 +++
 2 files changed, 9 insertions(+)

diff --git a/src/libbluray/bdj/java-j2se/java/awt/BDToolkit.java b/src/libbluray/bdj/java-j2se/java/awt/BDToolkit.java
index 26e89af..f323002 100644
--- a/src/libbluray/bdj/java-j2se/java/awt/BDToolkit.java
+++ b/src/libbluray/bdj/java-j2se/java/awt/BDToolkit.java
@@ -82,8 +82,14 @@ public class BDToolkit extends Toolkit implements KeyboardFocusManagerPeerProvid
         BDKeyboardFocusManagerPeer.init(window);
     }
 
+    // required by older Java 7 versions
     public KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager kfm)
     {
+        return getKeyboardFocusManagerPeer();
+    }
+
+    public KeyboardFocusManagerPeer getKeyboardFocusManagerPeer()
+    {
         return BDKeyboardFocusManagerPeer.getInstance();
     }
 
diff --git a/src/libbluray/bdj/java-j2se/sun/awt/KeyboardFocusManagerPeerProvider.java b/src/libbluray/bdj/java-j2se/sun/awt/KeyboardFocusManagerPeerProvider.java
index b39e0f6..c3c4af9 100644
--- a/src/libbluray/bdj/java-j2se/sun/awt/KeyboardFocusManagerPeerProvider.java
+++ b/src/libbluray/bdj/java-j2se/sun/awt/KeyboardFocusManagerPeerProvider.java
@@ -23,5 +23,8 @@ import java.awt.KeyboardFocusManager;
 import java.awt.peer.KeyboardFocusManagerPeer;
 
 public abstract interface KeyboardFocusManagerPeerProvider {
+    // required by older Java 7 versions
     public abstract KeyboardFocusManagerPeer createKeyboardFocusManagerPeer(KeyboardFocusManager kfm);
+
+    public abstract KeyboardFocusManagerPeer getKeyboardFocusManagerPeer();
 }
-- 
1.8.4



More information about the libbluray-devel mailing list