From: rtrimana Date: Wed, 7 Aug 2019 17:21:49 +0000 (-0700) Subject: Adding a null value filter in the tracker; Adding a new conflict variable for lights. X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=fe051f890e5b90b33902d3c9c252bc587ca4bffe;p=jpf-core.git Adding a null value filter in the tracker; Adding a new conflict variable for lights. --- diff --git a/main.jpf b/main.jpf index 9b0c4c6..98264ca 100644 --- a/main.jpf +++ b/main.jpf @@ -13,9 +13,9 @@ listener=gov.nasa.jpf.listener.VariableConflictTracker # Switches #variables=currentSwitch # Lights -#variables=currentColor,currentHue,currentSaturation,currentLevel,currentSwitch,colorTemperature +variables=colorChanged,currentHue,currentSaturation,currentLevel,currentSwitch,colorTemperature # Speeches -variables=level,oneUser +#variables=level,oneUser # Music players #variables=status,level,trackDescription,trackData,mute # Relay switch diff --git a/src/main/gov/nasa/jpf/listener/VariableConflictTracker.java b/src/main/gov/nasa/jpf/listener/VariableConflictTracker.java index 561a409..0418294 100644 --- a/src/main/gov/nasa/jpf/listener/VariableConflictTracker.java +++ b/src/main/gov/nasa/jpf/listener/VariableConflictTracker.java @@ -93,7 +93,7 @@ public class VariableConflictTracker extends ListenerAdapter { byte type = getType(ti, executedInsn); String value = getValue(ti, executedInsn, type); //System.out.println("\n\n" + ti.getStackTrace() + "\n\n"); - String writer = getWriter(ti.getStack()); + String writer = getWriter(ti.getStack()); // Just return if the writer is not one of the listed apps in the .jpf file if (writer == null) return; @@ -132,6 +132,14 @@ 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();