[libbluray-devel] HScreenConfigTemplate: log errors

hpi1 git at videolan.org
Sun Apr 17 14:55:58 CEST 2016


libbluray | branch: master | hpi1 <hpi1 at anonymous.org> | Sat Apr 16 23:47:41 2016 +0300| [f646fa57d6aaada30c0eaa1219d19275be57ff3d] | committer: hpi1

HScreenConfigTemplate: log errors

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

 .../java/org/havi/ui/HScreenConfigTemplate.java    |   28 +++++++++++++++-----
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/src/libbluray/bdj/java/org/havi/ui/HScreenConfigTemplate.java b/src/libbluray/bdj/java/org/havi/ui/HScreenConfigTemplate.java
index 8d323e7..adf1641 100644
--- a/src/libbluray/bdj/java/org/havi/ui/HScreenConfigTemplate.java
+++ b/src/libbluray/bdj/java/org/havi/ui/HScreenConfigTemplate.java
@@ -22,6 +22,8 @@ package org.havi.ui;
 import java.awt.Dimension;
 import java.util.Arrays;
 
+import org.videolan.Logger;
+
 public abstract class HScreenConfigTemplate {
     HScreenConfigTemplate() {
         objectArray = new Object[getPreferenceObjectCount()];
@@ -30,35 +32,47 @@ public abstract class HScreenConfigTemplate {
     }
 
     public void setPreference(int preference, int priority) {
-        if ((priority < REQUIRED) || (priority > REQUIRED_NOT))
+        if ((priority < REQUIRED) || (priority > REQUIRED_NOT)) {
+            logger.error("invalid priority " + priority);
             throw new IllegalArgumentException("invalid priority");
+        }
         int index = getPreferenceIndex(preference);
-        if (index < 0)
+        if (index < 0) {
+            logger.error("invalid preference " + preference);
             throw new IllegalArgumentException("invalid preference");
+        }
         priorityArray[index] = priority;
     }
 
     public void setPreference(int preference, Object object, int priority) {
-        if ((priority < REQUIRED) || (priority > REQUIRED_NOT))
+        if ((priority < REQUIRED) || (priority > REQUIRED_NOT)) {
+            logger.error("invalid priority " + priority);
             throw new IllegalArgumentException("invalid priority");
+        }
         int index = getPreferenceObjectIndex(preference);
-        if (index < 0)
+        if (index < 0) {
+            logger.error("invalid preference " + preference);
             throw new IllegalArgumentException("invalid preference");
+        }
         objectArray[index] = object;
         priorityArray[getPreferenceIndex(preference)] = priority;
     }
 
     public int getPreferencePriority(int preference) {
         int index = getPreferenceIndex(preference);
-        if (index < 0)
+        if (index < 0) {
+            logger.error("invalid preference " + preference);
             throw new IllegalArgumentException("invalid preference");
+        }
         return priorityArray[getPreferenceIndex(preference)];
     }
 
     public Object getPreferenceObject(int preference) {
         int index = getPreferenceObjectIndex(preference);
-        if (index < 0)
+        if (index < 0) {
+            logger.error("invalid preference " + preference);
             throw new IllegalArgumentException("invalid preference");
+        }
         return objectArray[getPreferenceObjectIndex(preference)];
     }
 
@@ -169,4 +183,6 @@ public abstract class HScreenConfigTemplate {
 
         { 960, 540, 16, 9 },
     };
+
+    private static final Logger logger = Logger.getLogger(HScreenConfigTemplate.class.getName());
 }



More information about the libbluray-devel mailing list