From 31732e91ff0693f91902c7b1f873515dc128561f Mon Sep 17 00:00:00 2001 From: rtrimana Date: Thu, 8 Aug 2019 15:06:15 -0700 Subject: [PATCH] Checking for null value before storing the first write. --- .../jpf/listener/VariableConflictTracker.java | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/main/gov/nasa/jpf/listener/VariableConflictTracker.java b/src/main/gov/nasa/jpf/listener/VariableConflictTracker.java index 0418294..0359ed1 100644 --- a/src/main/gov/nasa/jpf/listener/VariableConflictTracker.java +++ b/src/main/gov/nasa/jpf/listener/VariableConflictTracker.java @@ -132,14 +132,6 @@ public class VariableConflictTracker extends ListenerAdapter { // 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(); @@ -156,9 +148,11 @@ public class VariableConflictTracker extends ListenerAdapter { 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); + } } } -- 2.34.1