private Node parentNode = new Node(-2);
private String operation;
private String detail;
+ private String errorMessage;
private int depth;
private int id;
private boolean conflictFound = false;
for (NameValuePair i : currentNode.getSetSet()) {
if (i.getIsManual()) // Manual input: we have no conflict
- return false;
+ continue;
valueMap.put(i.getVarName(), i.getValue());
if (writerMap.containsKey(i.getVarName()))
// 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())))
- if (!(writerMap.get(i.getVarName()).equals(i.getAppNum())))
+ if (!(valueMap.get(i.getVarName()).equals(i.getValue()))) // We have different values
+ if (!(writerMap.get(i.getVarName()).equals(i.getAppNum()))) {// We have different writers
+ 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;
+ }
}
}
if (conflictFound) {
StringBuilder sb = new StringBuilder();
- sb.append("Conflict found between two apps!");
+ sb.append(errorMessage);
Instruction nextIns = ti.createAndThrowException("java.lang.RuntimeException", sb.toString());
ti.setNextPC(nextIns);
} else if (executedInsn instanceof WriteInstruction) {