[izpack-changes] r1752 - izpack-src/trunk/src/lib/com/izforge/izpack/rules

noreply at berlios.de noreply at berlios.de
Mon Feb 19 11:12:14 CET 2007


Author: dreil
Date: 2007-02-19 11:12:11 +0100 (Mon, 19 Feb 2007)
New Revision: 1752

Modified:
   izpack-src/trunk/src/lib/com/izforge/izpack/rules/RulesEngine.java
Log:
fixed possible NPE in conditional expression evaluation


Modified: izpack-src/trunk/src/lib/com/izforge/izpack/rules/RulesEngine.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/rules/RulesEngine.java	2007-02-19 08:54:03 UTC (rev 1751)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/rules/RulesEngine.java	2007-02-19 10:12:11 UTC (rev 1752)
@@ -98,7 +98,6 @@
             }
             else {
                 String conditiontype = condtype.toLowerCase();
-                //  TODO: externalize package name
                 conditionclassname = "com.izforge.izpack.rules."
                     + conditiontype.substring(0, 1).toUpperCase()
                     + conditiontype.substring(1, conditiontype.length());
@@ -260,8 +259,10 @@
         if (conditionexpr.length() > 0)
         {
             result = (Condition) conditionsmap.get(conditionexpr.toString());
-            result.setInstalldata(RulesEngine.installdata);
-            conditionexpr.delete(0, conditionexpr.length());
+            if (result != null){
+                result.setInstalldata(RulesEngine.installdata);
+                conditionexpr.delete(0, conditionexpr.length());
+            }
         }
         return result;
     }
@@ -300,7 +301,17 @@
             return cond.isTrue();
         }
     }
+    
+    public boolean isConditionTrue(String id)
+    {
+        return this.isConditionTrue(RulesEngine.getCondition(id));
+    }
 
+    public boolean isConditionTrue(Condition cond)
+    {
+        return cond.isTrue();
+    }
+
     /**
      * Can a panel be shown?
      * 




More information about the izpack-changes mailing list