[izpack-changes] r1740 - izpack-src/trunk/src/lib/com/izforge/izpack/rules
noreply at berlios.de
noreply at berlios.de
Fri Feb 16 15:52:40 CET 2007
Author: dreil
Date: 2007-02-16 15:52:39 +0100 (Fri, 16 Feb 2007)
New Revision: 1740
Modified:
izpack-src/trunk/src/lib/com/izforge/izpack/rules/RulesEngine.java
Log:
Fixed: NPE in combined 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-02-16 14:16:21 UTC (rev 1739)
+++ izpack-src/trunk/src/lib/com/izforge/izpack/rules/RulesEngine.java 2007-02-16 14:52:39 UTC (rev 1740)
@@ -48,7 +48,7 @@
protected static Map conditionsmap = new Hashtable();
- protected InstallData installdata;
+ protected static InstallData installdata;
/**
*
@@ -60,7 +60,7 @@
this.panelconditions = new Hashtable();
this.packconditions = new Hashtable();
this.optionalpackconditions = new Hashtable();
- this.installdata = installdata;
+ RulesEngine.installdata = installdata;
this.readConditions();
}
@@ -109,6 +109,9 @@
{
Class conditionclass = loader.loadClass(conditionclassname);
result = (Condition) conditionclass.newInstance();
+ result.readFromXML(condition);
+ result.setId(condid);
+ result.setInstalldata(RulesEngine.installdata);
}
catch (ClassNotFoundException e)
{
@@ -121,9 +124,7 @@
catch (IllegalAccessException e)
{
Debug.trace("Illegal access to " + conditionclassname);
- }
- result.readFromXML(condition);
- result.setId(condid);
+ }
}
return result;
}
@@ -153,7 +154,7 @@
{
// this.conditionslist.add(cond);
String condid = cond.getId();
- cond.setInstalldata(this.installdata);
+ cond.setInstalldata(RulesEngine.installdata);
if ((condid != null) && !("UNKNOWN".equals(condid)))
{
conditionsmap.put(condid, cond);
@@ -221,18 +222,21 @@
Condition op1 = (Condition) conditionsmap.get(conditionexpr.substring(0, index));
conditionexpr.delete(0, index + 1);
result = new AndCondition(op1, getConditionByExpr(conditionexpr));
+ result.setInstalldata(RulesEngine.installdata);
break;
case '|':
// or-condition
op1 = (Condition) conditionsmap.get(conditionexpr.substring(0, index));
conditionexpr.delete(0, index + 1);
result = new OrCondition(op1, getConditionByExpr(conditionexpr));
+ result.setInstalldata(RulesEngine.installdata);
break;
case '\\':
// xor-condition
op1 = (Condition) conditionsmap.get(conditionexpr.substring(0, index));
conditionexpr.delete(0, index + 1);
result = new XOrCondition(op1, getConditionByExpr(conditionexpr));
+ result.setInstalldata(RulesEngine.installdata);
break;
case '!':
// not-condition
@@ -245,6 +249,7 @@
// delete not symbol
conditionexpr.deleteCharAt(index);
result = new NotCondition(getConditionByExpr(conditionexpr));
+ result.setInstalldata(RulesEngine.installdata);
}
break;
default:
@@ -255,6 +260,7 @@
if (conditionexpr.length() > 0)
{
result = (Condition) conditionsmap.get(conditionexpr.toString());
+ result.setInstalldata(RulesEngine.installdata);
conditionexpr.delete(0, conditionexpr.length());
}
return result;
@@ -271,7 +277,13 @@
else
{
Debug.trace("Checking condition");
- return cond.isTrue();
+ try {
+ return cond.isTrue();
+ }
+ catch (NullPointerException npe){
+ Debug.error("Nullpointerexception checking condition: " + id);
+ return false;
+ }
}
}
More information about the izpack-changes
mailing list