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

noreply at berlios.de noreply at berlios.de
Fri Dec 7 15:26:57 CET 2007


Author: dreil
Date: 2007-12-07 15:26:54 +0100 (Fri, 07 Dec 2007)
New Revision: 1937

Modified:
   izpack-src/trunk/src/lib/com/izforge/izpack/rules/RulesEngine.java
   izpack-src/trunk/src/lib/com/izforge/izpack/rules/VariableCondition.java
Log:
bugfix: installdata not given to conditions

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/rules/RulesEngine.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/rules/RulesEngine.java	2007-12-07 11:58:02 UTC (rev 1936)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/rules/RulesEngine.java	2007-12-07 14:26:54 UTC (rev 1937)
@@ -21,6 +21,7 @@
 package com.izforge.izpack.rules;
 
 import java.util.Hashtable;
+import java.util.Iterator;
 import java.util.Map;
 import java.util.Properties;
 import java.util.Vector;
@@ -72,6 +73,12 @@
         this();
         RulesEngine.installdata = installdata;
         conditionsmap = rules;
+        Iterator keyiter = conditionsmap.keySet().iterator();
+        while (keyiter.hasNext()) {
+            String key = (String) keyiter.next();
+            Condition condition = (Condition) conditionsmap.get(key);
+            condition.setInstalldata(installdata);
+        }
     }
 
     /**

Modified: izpack-src/trunk/src/lib/com/izforge/izpack/rules/VariableCondition.java
===================================================================
--- izpack-src/trunk/src/lib/com/izforge/izpack/rules/VariableCondition.java	2007-12-07 11:58:02 UTC (rev 1936)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/rules/VariableCondition.java	2007-12-07 14:26:54 UTC (rev 1937)
@@ -96,14 +96,19 @@
 
     public boolean isTrue()
     {
-        String val = this.installdata.getVariable(variablename);
-        if (val == null)
-        {
+        if (this.installdata != null) {
+            String val = this.installdata.getVariable(variablename);
+            if (val == null)
+            {
+                return false;
+            }
+            else
+            {
+                return val.equals(value);
+            }
+        }
+        else {
             return false;
         }
-        else
-        {
-            return val.equals(value);
-        }
     }
 }
\ No newline at end of file



More information about the izpack-changes mailing list