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 9fb12cf3dac2aa6a4769468a7966edf7a7d5e710..51e34fc89f0c9a50b64244968c813f7ca1516d21 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;
                                }
+                       }
                }
        }