// Comparing the inSet and setSet to find the conflict
for (NameValuePair i : currentNode.getInSet()) {
if (valueMap.containsKey(i.getVarName())) {
- if (!(valueMap.get(i.getVarName()).equals(i.getValue()))) // We have different values
- if (!(writerMap.get(i.getVarName()).equals(i.getAppNum()))) {// We have different writers
+ String value = valueMap.get(i.getVarName());
+ Integer writer = writerMap.get(i.getVarName());
+ if ((value != null)&&(writer != null)) {
+ if (!value.equals(i.getValue())&&!writer.equals(i.getAppNum())) { // We have different values
errorMessage = "Conflict found between the two apps. App"+i.getAppNum()+" has written the value: "+i.getValue()+
" to the variable: "+i.getVarName()+" while App"+writerMap.get(i.getVarName())+" is overwriting the value: "
+valueMap.get(i.getVarName())+" to the same variable!";
return true;
}
+ }
}
}