[libbluray-devel] javax.tv.service: improve compatibility

hpi1 git at videolan.org
Wed Apr 13 11:14:27 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Wed Apr 13 12:00:50 2016 +0300| [dc924c3a84a67c3a7adc9c134ec4df8a65378fd2] | committer: hpi1

javax.tv.service: improve compatibility

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

 .../bdj/java/javax/tv/service/SIChangeEvent.java         |   14 ++++++++++++--
 .../bdj/java/javax/tv/service/SIChangeType.java          |    8 +++-----
 .../bdj/java/javax/tv/service/SIRequestFailureType.java  |    3 +++
 .../java/javax/tv/service/ServiceInformationType.java    |    2 ++
 src/libbluray/bdj/java/javax/tv/service/ServiceType.java |    2 ++
 .../javax/tv/service/selection/ServiceContextEvent.java  |    5 ++++-
 6 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/src/libbluray/bdj/java/javax/tv/service/SIChangeEvent.java b/src/libbluray/bdj/java/javax/tv/service/SIChangeEvent.java
index 14a82d2..3ab9ea7 100644
--- a/src/libbluray/bdj/java/javax/tv/service/SIChangeEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/SIChangeEvent.java
@@ -25,6 +25,7 @@ public abstract class SIChangeEvent extends EventObject {
     public SIChangeEvent(Object source, SIChangeType type, SIElement element) {
         super(source);
 
+        this.source = source;
         this.type = type;
         this.element = element;
     }
@@ -37,8 +38,17 @@ public abstract class SIChangeEvent extends EventObject {
         return element;
     }
 
-    private SIChangeType type;
-    private SIElement element;
+    public Object getSource() {
+        return source;
+    }
+
+    public String toString() {
+        return getClass().getName() + "[source=" + source + ",type=" + type + ",element=" + element + "]";
+    }
+
+    private final Object source;
+    private final SIChangeType type;
+    private final SIElement element;
 
     private static final long serialVersionUID = -2585934355425778816L;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/SIChangeType.java b/src/libbluray/bdj/java/javax/tv/service/SIChangeType.java
index 5badf23..edc842a 100644
--- a/src/libbluray/bdj/java/javax/tv/service/SIChangeType.java
+++ b/src/libbluray/bdj/java/javax/tv/service/SIChangeType.java
@@ -19,9 +19,7 @@
 
 package javax.tv.service;
 
-import java.io.Serializable;
-
-public class SIChangeType implements Serializable {
+public class SIChangeType {
 
     public static final SIChangeType ADD = new SIChangeType("ADD");
     public static final SIChangeType REMOVE = new SIChangeType("REMOVE");
@@ -29,6 +27,8 @@ public class SIChangeType implements Serializable {
 
     protected SIChangeType(String name) {
         this.name = name;
+        if (name == null)
+            throw new NullPointerException();
     }
 
     public String toString() {
@@ -36,6 +36,4 @@ public class SIChangeType implements Serializable {
     }
 
     protected String name;
-
-    private static final long serialVersionUID = 1L;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/SIRequestFailureType.java b/src/libbluray/bdj/java/javax/tv/service/SIRequestFailureType.java
index b695bcb..8b27031 100644
--- a/src/libbluray/bdj/java/javax/tv/service/SIRequestFailureType.java
+++ b/src/libbluray/bdj/java/javax/tv/service/SIRequestFailureType.java
@@ -21,6 +21,8 @@ package javax.tv.service;
 
 public class SIRequestFailureType {
     protected SIRequestFailureType(String name) {
+        if (name == null)
+            throw new NullPointerException();
         this.name = name;
     }
 
@@ -36,5 +38,6 @@ public class SIRequestFailureType {
             "DATA_UNAVAILABLE");
     public static final SIRequestFailureType UNKNOWN = new SIRequestFailureType(
             "UNKNOWN");
+
     private String name;
 }
diff --git a/src/libbluray/bdj/java/javax/tv/service/ServiceInformationType.java b/src/libbluray/bdj/java/javax/tv/service/ServiceInformationType.java
index 4e3eda7..6895f55 100644
--- a/src/libbluray/bdj/java/javax/tv/service/ServiceInformationType.java
+++ b/src/libbluray/bdj/java/javax/tv/service/ServiceInformationType.java
@@ -22,6 +22,8 @@ package javax.tv.service;
 public class ServiceInformationType {
 
     protected ServiceInformationType(String name) {
+        if (name == null)
+            throw new NullPointerException();
         this.name = name;
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/ServiceType.java b/src/libbluray/bdj/java/javax/tv/service/ServiceType.java
index 75c851b..8526896 100644
--- a/src/libbluray/bdj/java/javax/tv/service/ServiceType.java
+++ b/src/libbluray/bdj/java/javax/tv/service/ServiceType.java
@@ -21,6 +21,8 @@ package javax.tv.service;
 
 public class ServiceType {
     protected ServiceType(String name) {
+        if (name == null)
+            throw new NullPointerException();
         this.name = name;
     }
 
diff --git a/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextEvent.java b/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextEvent.java
index 3885efe..0fd78de 100644
--- a/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextEvent.java
+++ b/src/libbluray/bdj/java/javax/tv/service/selection/ServiceContextEvent.java
@@ -25,11 +25,14 @@ public class ServiceContextEvent extends EventObject
 {
     public ServiceContextEvent(ServiceContext context) {
         super(context);
+        this.context = context;
     }
 
     public ServiceContext getServiceContext() {
-        return (ServiceContext)source;
+        return context;
     }
 
+    protected ServiceContext context;
+
     private static final long serialVersionUID = -1865592897966055645L;
 }



More information about the libbluray-devel mailing list