// Conflict is declared when:
// 1) Current writer != previous writer, e.g., App1 vs. App2
// 2) Current value != previous value, e.g., "locked" vs. "unlocked"
- if (current.value == null) {
-
- StringBuilder sb = new StringBuilder();
- sb.append("Conflict between apps " + current.writer + " and " + writer + ": ");
- sb.append("Current value cannot be read (null value)... Please double check with your app output!");
- Instruction nextIns = ti.createAndThrowException("java.lang.RuntimeException", sb.toString());
- ti.setNextPC(nextIns);
- }
if (!current.value.equals(value)) {
StringBuilder sb = new StringBuilder();
current.value = value;
}
} else {
- // First write to the variable
- VarChange change = new VarChange(writer, value);
- writeMap.put(var, change);
+ // First write to the variable only if it is not null
+ if (value != null) {
+ VarChange change = new VarChange(writer, value);
+ writeMap.put(var, change);
+ }
}
}