Fixing a bug in listener!
authoramiraj <amiraj.95@uci.edu>
Fri, 18 Oct 2019 18:19:16 +0000 (11:19 -0700)
committeramiraj <amiraj.95@uci.edu>
Fri, 18 Oct 2019 18:19:16 +0000 (11:19 -0700)
src/main/gov/nasa/jpf/listener/ConflictTracker.java

index 9fb12cf..51e34fc 100644 (file)
@@ -158,13 +158,16 @@ public class ConflictTracker extends ListenerAdapter {
        // 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;
                                }
+                       }
                }
        }