nus-yam/ex-repair huggingface dataset:
Program: 147069
Project: 147069
Buggy source:
public boolean handlePostProcess(IFormDataModel model,IDataReference ref,String params){
  IAnswerData data=model.getDataValue(ref);
  if ("String_Node_Str".equals(params)) {
    patient.setVaccinations((ImmunizationData)data);
    return true;
  }
 else {
  }
  return false;
}

Fixed version (ground truth):
public boolean handlePostProcess(IFormDataModel model,IDataReference ref,String params){
  IAnswerData data=model.getDataValue(ref);
  if ("String_Node_Str".equals(params)) {
    patient.setVaccinations((ImmunizationData)((ImmunizationAnswerData)data).getValue());
    return true;
  }
 else {
  }
  return false;
}
Program: 147070
Project: 147070
Buggy source:
public boolean canSerialize(IAnswerData data){
  if (data.getClass() == StringData.class || data.getClass() == DateData.class || data.getClass() == SelectMultiData.class || data.getClass() == SelectOneData.class) {
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
public boolean canSerialize(IAnswerData data){
  if (data instanceof StringData || data instanceof DateData || data instanceof SelectMultiData|| data instanceof SelectOneData) {
    return true;
  }
 else {
    return false;
  }
}
Program: 147071
Project: 147071
Buggy source:
public static IAnswerData getAnswerData(DataBinding binding,Element node){
  String value;
switch (binding.getDataType()) {
case Constants.DATATYPE_DATE:
    value=(String)node.getChild(0);
  return new DateData(DateUtils.getDateFromString(value));
case Constants.DATATYPE_DATE_TIME:
value=(String)node.getChild(0);
return new DateData(DateUtils.getDateFromString(value));
case Constants.DATATYPE_INTEGER:
value=(String)node.getChild(0);
return new IntegerData(Integer.parseInt(value));
case Constants.DATATYPE_TEXT:
value=(String)node.getChild(0);
return new StringData(value);
case Constants.DATATYPE_TIME:
return null;
}
return null;
}

Fixed version (ground truth):
public static IAnswerData getAnswerData(DataBinding binding,Element node){
  String value=XFormParser.getXMLText(node,false);
  if (value == null)   return null;
switch (binding.getDataType()) {
case Constants.DATATYPE_DATE:
    return new DateData(DateUtils.getDateFromString(value));
case Constants.DATATYPE_DATE_TIME:
  return new DateData(DateUtils.getDateFromString(value));
case Constants.DATATYPE_INTEGER:
return new IntegerData(Integer.parseInt(value));
case Constants.DATATYPE_TEXT:
return new StringData(value);
case Constants.DATATYPE_TIME:
return null;
}
return null;
}
Program: 147072
Project: 147072
Buggy source:
public ConstellationNamesDataLoader(String filePath) throws Exception {
  this.constellationNames=new ArrayList();
  InputStream inputStream=getClass().getResourceAsStream(filePath);
  BufferedReader reader=new BufferedReader(new InputStreamReader(inputStream));
  String strLine;
  while ((strLine=reader.readLine()) != null) {
    if (!strLine.isEmpty()) {
      String[] values=strLine.split("String_Node_Str");
      Point2D coord=new Point2D.Double();
      coord.setLocation(Double.parseDouble(values[0]) / 1000.0D,Double.parseDouble(values[1]) / 100.0D);
      this.constellationNames.add(new ConstellationName(values[2],values[3],coord));
    }
  }
  reader.close();
  inputStream.close();
}

Fixed version (ground truth):
public ConstellationNamesDataLoader(String filePath) throws Exception {
  this.constellationNames=new ArrayList();
  InputStream inputStream=getClass().getResourceAsStream(filePath);
  BufferedReader reader=new BufferedReader(new InputStreamReader(inputStream,"String_Node_Str"));
  String strLine;
  while ((strLine=reader.readLine()) != null) {
    if (!strLine.isEmpty()) {
      String[] values=strLine.split("String_Node_Str");
      Point2D coord=new Point2D.Double();
      coord.setLocation(Double.parseDouble(values[0]) / 1000.0D,Double.parseDouble(values[1]) / 100.0D);
      this.constellationNames.add(new ConstellationName(values[2],values[3],coord));
    }
  }
  reader.close();
  inputStream.close();
}
Program: 147073
Project: 147073
Buggy source:
/** 
 * Obtains an instance of   {@code ZoneOffset} specifying the total offset in seconds<p> The offset must be in the range  {@code -18:00} to {@code +18:00}, which corresponds to -64800 to +64800.
 * @param totalSeconds the total time-zone offset in seconds, from -64800 to +64800
 * @return the ZoneOffset, not null
 * @throws DateTimeException if the offset is not in the required range
 */
public static ZoneOffset ofTotalSeconds(int totalSeconds){
  if (Math.abs(totalSeconds) > MAX_SECONDS) {
    throw new DateTimeException("String_Node_Str");
  }
  if (totalSeconds % (15 * SECONDS_PER_MINUTE) == 0) {
    Integer totalSecs=totalSeconds;
    ZoneOffset result=SECONDS_CACHE.get(totalSecs);
    if (result == null) {
      result=new ZoneOffset(totalSeconds);
      SECONDS_CACHE.putIfAbsent(totalSecs,result);
      result=SECONDS_CACHE.get(totalSecs);
      ID_CACHE.putIfAbsent(result.getId(),result);
    }
    return result;
  }
 else {
    return new ZoneOffset(totalSeconds);
  }
}

Fixed version (ground truth):
/** 
 * Obtains an instance of   {@code ZoneOffset} specifying the total offset in seconds<p> The offset must be in the range  {@code -18:00} to {@code +18:00}, which corresponds to -64800 to +64800.
 * @param totalSeconds the total time-zone offset in seconds, from -64800 to +64800
 * @return the ZoneOffset, not null
 * @throws DateTimeException if the offset is not in the required range
 */
public static ZoneOffset ofTotalSeconds(int totalSeconds){
  if (Math.abs(totalSeconds) > MAX_SECONDS) {
    throw new DateTimeException("String_Node_Str");
  }
  if (totalSeconds % (15 * SECONDS_PER_MINUTE) == 0) {
    Integer totalSecs=totalSeconds;
    ZoneOffset result=SECONDS_CACHE.get(totalSecs);
    if (result == null) {
      result=new ZoneOffset(totalSeconds);
      SECONDS_CACHE.put(totalSecs,result);
      result=SECONDS_CACHE.get(totalSecs);
      ID_CACHE.put(result.getId(),result);
    }
    return result;
  }
 else {
    return new ZoneOffset(totalSeconds);
  }
}
Program: 147074
Project: 147074
Buggy source:
/** 
 * Creates an instance.
 */
protected Chrono(){
  CHRONOS_BY_ID.putIfAbsent(this.getId(),this);
  String type=this.getCalendarType();
  if (type != null) {
    CHRONOS_BY_TYPE.putIfAbsent(type,this);
  }
}

Fixed version (ground truth):
/** 
 * Creates an instance.
 */
protected Chrono(){
  CHRONOS_BY_ID.put(this.getId(),this);
  String type=this.getCalendarType();
  if (type != null) {
    CHRONOS_BY_TYPE.put(type,this);
  }
}
Program: 147075
Project: 147075
Buggy source:
/** 
 * Clones this builder, creating a new independent copy referring to the same map of fields and objects.
 * @return the cloned builder, not null
 */
@Override public DateTimeBuilder clone(){
  DateTimeBuilder dtb=new DateTimeBuilder();
  dtb.objects.addAll(this.objects);
  dtb.standardFields.putAll(this.standardFields);
  dtb.standardFields.putAll(this.standardFields);
  if (this.otherFields != null) {
    dtb.otherFields.putAll(this.otherFields);
  }
  return dtb;
}

Fixed version (ground truth):
/** 
 * Clones this builder, creating a new independent copy referring to the same map of fields and objects.
 * @return the cloned builder, not null
 */
public DateTimeBuilder clone(){
  DateTimeBuilder dtb=new DateTimeBuilder();
  dtb.objects.addAll(this.objects);
  dtb.standardFields.putAll(this.standardFields);
  dtb.standardFields.putAll(this.standardFields);
  if (this.otherFields != null) {
    dtb.otherFields.putAll(this.otherFields);
  }
  return dtb;
}
Program: 147076
Project: 147076
Buggy source:
public String browseForFolder(Frame parent,String description,boolean allowCreate){
  String defaultDir=Preferences.userNodeForPackage(TheApp.class).get("String_Node_Str","String_Node_Str");
  dlog.setCurrentDirectory(new File(defaultDir));
  dlog.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
  if (!description.equals("String_Node_Str")) {
    dlog.setDialogTitle(description);
  }
  String outFilename=null;
  Frame topFrame=(parent == null) ? TheApp.getAppFrame() : parent;
  for (; ; ) {
    dlog.setSelectedFile(new File("String_Node_Str"));
    int result;
    if (allowCreate)     result=dlog.showSaveDialog(topFrame);
 else     result=dlog.showOpenDialog(topFrame);
    outFilename=null;
    if (result == JFileChooser.APPROVE_OPTION && dlog.getSelectedFile() != null)     outFilename=dlog.getSelectedFile().getAbsolutePath();
    break;
  }
  dlog.setFileSelectionMode(JFileChooser.FILES_ONLY);
  if (outFilename != null) {
    String workDirectoryString=dlog.getSelectedFile().getParent();
    setWorkingDirectoryPreference(workDirectoryString);
  }
  return outFilename;
}

Fixed version (ground truth):
public String browseForFolder(Frame parent,String description,boolean allowCreate){
  String defaultDir=Preferences.userNodeForPackage(TheApp.class).get("String_Node_Str","String_Node_Str");
  dlog.setCurrentDirectory(new File(defaultDir));
  dlog.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
  if (!description.equals("String_Node_Str")) {
    dlog.setDialogTitle(description);
  }
  String outFilename=null;
  Frame topFrame=(parent == null) ? TheApp.getAppFrame() : parent;
  for (; ; ) {
    dlog.setSelectedFile(new File("String_Node_Str"));
    int result;
    if (allowCreate)     result=dlog.showSaveDialog(topFrame);
 else     result=dlog.showOpenDialog(topFrame);
    outFilename=null;
    if (result == JFileChooser.APPROVE_OPTION && dlog.getSelectedFile() != null)     outFilename=dlog.getSelectedFile().getAbsolutePath();
    break;
  }
  if (outFilename != null) {
    String workDirectoryString=dlog.getSelectedFile().getParent();
    setWorkingDirectoryPreference(workDirectoryString);
  }
  dlog.setFileSelectionMode(JFileChooser.FILES_ONLY);
  return outFilename;
}
Program: 147077
Project: 147077
Buggy source:
static JSONObject createAddObjectCommandJson(JSONObject newObject){
  JSONObject commandJson=new JSONObject();
  commandJson.put("String_Node_Str","String_Node_Str");
  commandJson.put("String_Node_Str",newObject.get("String_Node_Str"));
  commandJson.put("String_Node_Str",newObject);
  return commandJson;
}

Fixed version (ground truth):
static JSONObject createAddObjectCommandJson(JSONObject newObject){
  JSONObject commandJson=new JSONObject();
  commandJson.put("String_Node_Str","String_Node_Str");
  if (newObject.get("String_Node_Str") != null)   commandJson.put("String_Node_Str",newObject.get("String_Node_Str"));
 else {
    JSONObject jObj=(JSONObject)newObject.get("String_Node_Str");
    commandJson.put("String_Node_Str",jObj.get("String_Node_Str"));
  }
  commandJson.put("String_Node_Str",newObject);
  return commandJson;
}
Program: 147079
Project: 147079
Buggy source:
public void addVisualizerObject(JSONObject jsonObject,double[] bounds){
  if (websocketdb != null) {
    websocketdb.broadcastMessageJson(currentJson.createAddObjectCommand(jsonObject,bounds),null);
  }
}

Fixed version (ground truth):
public void addVisualizerObject(JSONObject jsonObject,double[] bounds){
  if (websocketdb != null) {
    boolean wait=true;
    while (websocketdb.isPending(currentJson.getModelUUID()) && wait) {
      try {
        Thread.sleep(500);
        wait=false;
      }
 catch (      InterruptedException ex) {
        Exceptions.printStackTrace(ex);
        wait=false;
      }
    }
    websocketdb.broadcastMessageJson(currentJson.createAddObjectCommand(jsonObject,bounds),null);
  }
}
Program: 147080
Project: 147080
Buggy source:
/** 
 * Mark an object as selected (on/off).
 */
public void markSelected(SelectedObject selectedObject,boolean highlight,boolean sendEvent,boolean updateStatusDisplayAndRepaint){
  if (highlight)   lookupContents.add(selectedObject.getOpenSimObject());
 else   lookupContents.remove(selectedObject.getOpenSimObject());
  if (websocketdb != null) {
    Model model=selectedObject.getOwnerModel();
    if (highlight) {
      if (selectInVisualizer != null && !selectInVisualizer.equals(selectedObject.getOpenSimObject())) {
        websocketdb.broadcastMessageJson(currentJson.createSelectionJson(selectedObject.getOpenSimObject()),null);
      }
 else       if (selectInVisualizer == null) {
        websocketdb.broadcastMessageJson(currentJson.createSelectionJson(selectedObject.getOpenSimObject()),null);
      }
      selectInVisualizer=selectedObject;
    }
 else {
      if (selectInVisualizer != null) {
        websocketdb.broadcastMessageJson(currentJson.createDeselectionJson(),null);
        selectInVisualizer=null;
      }
    }
  }
  if (updateStatusDisplayAndRepaint) {
    statusDisplaySelectedObjects();
    repaintAll();
  }
  if (sendEvent) {
    ObjectSelectedEvent evnt=new ObjectSelectedEvent(this,selectedObject,highlight);
    setChanged();
    notifyObservers(evnt);
  }
}

Fixed version (ground truth):
/** 
 * Mark an object as selected (on/off).
 */
public void markSelected(SelectedObject selectedObject,boolean highlight,boolean sendEvent,boolean updateStatusDisplayAndRepaint){
  if (highlight)   lookupContents.add(selectedObject.getOpenSimObject());
 else   lookupContents.remove(selectedObject.getOpenSimObject());
  if (websocketdb != null) {
    Model model=selectedObject.getOwnerModel();
    ModelVisualizationJson modelJson=getModelVisualizationJson(model);
    ArrayList<UUID> uuidList=modelJson.findUUIDForObject(selectedObject.getOpenSimObject());
    if (uuidList == null)     return;
    if (highlight) {
      if (selectInVisualizer != null && !selectInVisualizer.equals(selectedObject.getOpenSimObject())) {
        websocketdb.broadcastMessageJson(modelJson.createSelectionJson(selectedObject.getOpenSimObject()),null);
      }
 else       if (selectInVisualizer == null) {
        websocketdb.broadcastMessageJson(modelJson.createSelectionJson(selectedObject.getOpenSimObject()),null);
      }
      selectInVisualizer=selectedObject;
    }
 else {
      if (selectInVisualizer != null) {
        websocketdb.broadcastMessageJson(modelJson.createDeselectionJson(),null);
        selectInVisualizer=null;
      }
    }
  }
  if (updateStatusDisplayAndRepaint) {
    statusDisplaySelectedObjects();
    repaintAll();
  }
  if (sendEvent) {
    ObjectSelectedEvent evnt=new ObjectSelectedEvent(this,selectedObject,highlight);
    setChanged();
    notifyObservers(evnt);
  }
}
Program: 147081
Project: 147081
Buggy source:
public void broadcastMessageJson(JSONObject msg,VisWebSocket specificSocket){
  msg.put("String_Node_Str",UUID.randomUUID().toString());
  if (specificSocket != null) {
    specificSocket.sendVisualizerMessage(msg);
    return;
  }
  int i=0;
  for (  VisWebSocket sock : sockets) {
    if (debug)     System.out.println("String_Node_Str" + msg.toJSONString() + "String_Node_Str");
    sock.sendVisualizerMessage(msg);
    i++;
  }
}

Fixed version (ground truth):
public void broadcastMessageJson(JSONObject msg,VisWebSocket specificSocket){
  msg.put("String_Node_Str",UUID.randomUUID().toString());
  if (msg.get("String_Node_Str").equals("String_Node_Str")) {
    String modelUUIDString=(String)msg.get("String_Node_Str");
    if (!pendingModels.contains(modelUUIDString)) {
      pendingModels.add(modelUUIDString);
    }
  }
  if (specificSocket != null) {
    specificSocket.sendVisualizerMessage(msg);
    return;
  }
  int i=0;
  for (  VisWebSocket sock : sockets) {
    if (debug)     System.out.println("String_Node_Str" + msg.toJSONString() + "String_Node_Str");
    sock.sendVisualizerMessage(msg);
    i++;
  }
}
Program: 147083
Project: 147083
Buggy source:
private Vec3 extractVec3FromJsonXYZ(JSONObject offsetObj){
  Object xString=offsetObj.get("String_Node_Str");
  double xValue=JSONMessageHandler.convertObjectFromJsonRoDouble(xString);
  Object yString=offsetObj.get("String_Node_Str");
  double yValue=JSONMessageHandler.convertObjectFromJsonRoDouble(yString);
  Object zString=offsetObj.get("String_Node_Str");
  double zValue=JSONMessageHandler.convertObjectFromJsonRoDouble(zString);
  Vec3 offsetAsVec3=new Vec3(xValue,yValue,zValue);
  return offsetAsVec3;
}

Fixed version (ground truth):
private Vec3 extractVec3FromJsonXYZ(JSONObject offsetObj){
  Object xString=offsetObj.get("String_Node_Str");
  double xValue=JSONMessageHandler.convertObjectFromJsonToDouble(xString);
  Object yString=offsetObj.get("String_Node_Str");
  double yValue=JSONMessageHandler.convertObjectFromJsonToDouble(yString);
  Object zString=offsetObj.get("String_Node_Str");
  double zValue=JSONMessageHandler.convertObjectFromJsonToDouble(zString);
  Vec3 offsetAsVec3=new Vec3(xValue,yValue,zValue);
  return offsetAsVec3;
}
Program: 147088
Project: 147088
Buggy source:
public void deleteAttachmentPerformed(int menuChoice){
  AbstractPathPoint mp=currentPath.getPathPointSet().get(menuChoice);
  ViewDB.getInstance().removeObjectsBelongingToMuscleFromSelection(objectWithPath);
  boolean result=openSimContext.deletePathPoint(currentPath,menuChoice);
  if (result == false) {
    Object[] options={"String_Node_Str"};
    int answer=JOptionPane.showOptionDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.OK_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[0]);
    ViewDB.getInstance().setSelectedObject(mp);
  }
 else {
    ViewDB.getInstance().removeObjectsBelongingToMuscleFromSelection(objectWithPath);
    setupComponent(objectWithPath);
    Model model=currentModel;
    Vector<OpenSimObject> objs=new Vector<OpenSimObject>(1);
    objs.add(mp);
    ObjectsDeletedEvent evnt=new ObjectsDeletedEvent(this,model,objs);
    OpenSimDB.getInstance().setChanged();
    OpenSimDB.getInstance().notifyObservers(evnt);
    updatePathDisplay(EditOperation.RemovePoint,-1);
  }
}

Fixed version (ground truth):
public void deleteAttachmentPerformed(int menuChoice){
  AbstractPathPoint mp=currentPath.getPathPointSet().get(menuChoice);
  ViewDB.getInstance().removeObjectsBelongingToMuscleFromSelection(objectWithPath);
  boolean canDelete=currentPath.canDeletePathPoint(menuChoice);
  if (!canDelete) {
    Object[] options={"String_Node_Str"};
    int answer=JOptionPane.showOptionDialog(this,"String_Node_Str","String_Node_Str",JOptionPane.OK_OPTION,JOptionPane.WARNING_MESSAGE,null,options,options[0]);
    ViewDB.getInstance().setSelectedObject(mp);
  }
 else {
    ModelVisualizationJson modelViz=ViewDB.getInstance().getModelVisualizationJson(currentModel);
    modelViz.deletePathPointVisuals(currentPath,menuChoice);
    updatePathDisplay(EditOperation.RemovePoint,menuChoice);
    openSimContext.deletePathPoint(currentPath,menuChoice);
    ViewDB.getInstance().removeObjectsBelongingToMuscleFromSelection(objectWithPath);
    setupComponent(objectWithPath);
    Model model=currentModel;
    Vector<OpenSimObject> objs=new Vector<OpenSimObject>(1);
    objs.add(mp);
    ObjectsDeletedEvent evnt=new ObjectsDeletedEvent(this,model,objs);
    OpenSimDB.getInstance().setChanged();
    OpenSimDB.getInstance().notifyObservers(evnt);
  }
}
Program: 147090
Project: 147090
Buggy source:
public double getMarkerScaleFactor(){
  if (motionDisplayer == null) {
    motionDisplayer=dMotion.getMotionDisplayer();
    markersDisplayer=motionDisplayer.getMarkersRep();
  }
  if (markersDisplayer == null)   markersDisplayer=motionDisplayer.getMarkersRep();
  return markersDisplayer.getScaleFactor();
}

Fixed version (ground truth):
public double getMarkerScaleFactor(){
  if (motionDisplayer == null) {
    motionDisplayer=dMotion.getMotionDisplayer();
  }
  return motionDisplayer.getExperimentalMarkerScaleFactor();
}
Program: 147091
Project: 147091
Buggy source:
public Color getColor(){
  if (motionDisplayer == null) {
    motionDisplayer=dMotion.getMotionDisplayer();
    markersDisplayer=motionDisplayer.getMarkersRep();
  }
  if (markersDisplayer == null)   markersDisplayer=motionDisplayer.getMarkersRep();
  return markersDisplayer.getColor();
}

Fixed version (ground truth):
public Color getColor(){
  if (motionDisplayer == null) {
    motionDisplayer=dMotion.getMotionDisplayer();
  }
  Vec3 colorAsVec3=motionDisplayer.getDefaultExperimentalMarkerColor();
  return new Color((float)colorAsVec3.get(0),(float)colorAsVec3.get(1),(float)colorAsVec3.get(2));
}
Program: 147092
Project: 147092
Buggy source:
void setMarkerScaleFactorUI(final double newFactor,boolean allowUndo){
  final double oldMarkerScaleFactor=getMarkerScaleFactor();
  if (allowUndo) {
    AbstractUndoableEdit auEdit=new AbstractUndoableEdit(){
      @Override public void undo() throws CannotUndoException {
        super.undo();
        setMarkerScaleFactorUI(oldMarkerScaleFactor,false);
      }
      @Override public void redo() throws CannotRedoException {
        super.redo();
        setMarkerScaleFactorUI(newFactor,true);
      }
    }
;
    ExplorerTopComponent.addUndoableEdit(auEdit);
  }
  markersDisplayer.setScaleFactor(newFactor);
  ViewDB.repaintAll();
  refreshNode();
}

Fixed version (ground truth):
void setMarkerScaleFactorUI(final double newFactor,boolean allowUndo){
  final double oldMarkerScaleFactor=getMarkerScaleFactor();
  if (allowUndo) {
    AbstractUndoableEdit auEdit=new AbstractUndoableEdit(){
      @Override public void undo() throws CannotUndoException {
        super.undo();
        setMarkerScaleFactorUI(oldMarkerScaleFactor,false);
      }
      @Override public void redo() throws CannotRedoException {
        super.redo();
        setMarkerScaleFactorUI(newFactor,true);
      }
    }
;
    ExplorerTopComponent.addUndoableEdit(auEdit);
  }
  motionDisplayer.setExperimentalMarkerScaleFactor(newFactor);
  ViewDB.repaintAll();
  refreshNode();
}
Program: 147093
Project: 147093
Buggy source:
void setForceScaleFactorUI(final double newFactor,boolean allowUndo){
  final double oldForceScaleFactor=getForceScaleFactor();
  if (allowUndo) {
    AbstractUndoableEdit auEdit=new AbstractUndoableEdit(){
      @Override public void undo() throws CannotUndoException {
        super.undo();
        setForceScaleFactorUI(oldForceScaleFactor,false);
      }
      @Override public void redo() throws CannotRedoException {
        super.redo();
        setForceScaleFactorUI(newFactor,true);
      }
    }
;
    ExplorerTopComponent.addUndoableEdit(auEdit);
  }
  forcesDisplayer.setScaleFactor(newFactor);
  ViewDB.repaintAll();
  refreshNode();
}

Fixed version (ground truth):
void setForceScaleFactorUI(final double newFactor,boolean allowUndo){
  final double oldForceScaleFactor=getForceScaleFactor();
  if (allowUndo) {
    AbstractUndoableEdit auEdit=new AbstractUndoableEdit(){
      @Override public void undo() throws CannotUndoException {
        super.undo();
        setForceScaleFactorUI(oldForceScaleFactor,false);
      }
      @Override public void redo() throws CannotRedoException {
        super.redo();
        setForceScaleFactorUI(newFactor,true);
      }
    }
;
    ExplorerTopComponent.addUndoableEdit(auEdit);
  }
  ViewDB.repaintAll();
  refreshNode();
}
Program: 147094
Project: 147094
Buggy source:
public double getForceScaleFactor(){
  if (forcesDisplayer == null)   connectForceDisplayer(dMotion);
  return forcesDisplayer.getScaleFactor();
}

Fixed version (ground truth):
public double getForceScaleFactor(){
  return 1.0;
}
Program: 147095
Project: 147095
Buggy source:
public Color getColor(){
  if (forcesDisplayer == null)   connectForceDisplayer(dMotion);
  return forcesDisplayer.getColor();
}

Fixed version (ground truth):
public Color getColor(){
  if (motionDisplayer == null) {
    motionDisplayer=dMotion.getMotionDisplayer();
  }
  return motionDisplayer.getDefaultForceColor();
}
Program: 147096
Project: 147096
Buggy source:
/** 
 * Creates a new instance of ExperimentalForceNode 
 */
public ExperimentalForceSetNode(AnnotatedMotion dMotion){
  nodeName=bundle.getString("String_Node_Str");
  setName(nodeName);
  setDisplayName(nodeName);
  setShortDescription(bundle.getString("String_Node_Str"));
  this.dMotion=dMotion;
  createChildren();
}

Fixed version (ground truth):
/** 
 * Creates a new instance of ExperimentalForceNode 
 */
public ExperimentalForceSetNode(AnnotatedMotion dMotion){
  nodeName=bundle.getString("String_Node_Str");
  setName(nodeName);
  setDisplayName(nodeName);
  setShortDescription(bundle.getString("String_Node_Str"));
  this.dMotion=dMotion;
  createChildren();
  if (motionDisplayer == null) {
    motionDisplayer=dMotion.getMotionDisplayer();
  }
}
Program: 147097
Project: 147097
Buggy source:
/** 
 * @param defaultForceColor the defaultForceColor to set
 */
public void setDefaultForceColor(Color defaultForceColor){
  float[] colorFloat=new float[3];
  defaultForceColor.getColorComponents(colorFloat);
  for (int i=0; i < 3; i++)   this.defaultForceColor[i]=(double)colorFloat[i];
  getGroundForcesRep().setColor(defaultForceColor);
}

Fixed version (ground truth):
/** 
 * @param defaultForceColor the defaultForceColor to set
 */
public void setDefaultForceColor(Color defaultForceColor){
  float[] colorFloat=new float[3];
  defaultForceColor.getColorComponents(colorFloat);
  for (int i=0; i < 3; i++)   this.defaultForceColor[i]=(double)colorFloat[i];
  Vec3 colorAsVec3=new Vec3();
  for (int i=0; i < 3; i++)   colorAsVec3.set(i,this.defaultForceColor[i]);
  this.defaultExperimentalMarkerColor=colorAsVec3;
  Set<OpenSimObject> expermintalDataObjects=mapComponentToUUID.keySet();
  for (  OpenSimObject expObj : expermintalDataObjects) {
    if (expObj instanceof MotionObjectPointForce) {
      UUID expObjectUUID=mapComponentToUUID.get(expObj).get(0);
      String colorString=JSONUtilities.mapColorToRGBA(getDefaultExperimentalMarkerColor());
      ViewDB.getInstance().applyColorToObjectByUUID(model,expObjectUUID,colorAsVec3);
    }
  }
}
Program: 147099
Project: 147099
Buggy source:
/** 
 * Creates a new instance of ViewDB 
 */
private ViewDB(){
  applyPreferences();
  r=myLookup.lookupResult(OpenSimObject.class);
  jsondb=JSONUtilities.createTopLevelJson();
}

Fixed version (ground truth):
/** 
 * Creates a new instance of ViewDB 
 */
private ViewDB(){
  applyPreferences();
  r=myLookup.lookupResult(OpenSimObject.class);
  websocketdb=WebSocketDB.getInstance();
  jsondb=JSONUtilities.createTopLevelJson();
}
Program: 147100
Project: 147100
Buggy source:
/** 
 * Enforce a singleton pattern
 */
public static ViewDB getInstance(){
  if (instance == null)   instance=new ViewDB();
  websocketdb=WebSocketDB.getInstance();
  websocketdb.setObserver(instance);
  return instance;
}

Fixed version (ground truth):
/** 
 * Enforce a singleton pattern
 */
public static ViewDB getInstance(){
  if (instance == null) {
    instance=new ViewDB();
    websocketdb.setObserver(instance);
  }
  return instance;
}
Program: 147101
Project: 147101
Buggy source:
public double calcDerivative(double normFiberLength,int order){
  return opensimSimulationJNI.ActiveForceLengthCurve_calcDerivative(swigCPtr,this,normFiberLength,order);
}

Fixed version (ground truth):
public double calcDerivative(StdVectorInt derivComponents,Vector x){
  return opensimSimulationJNI.ActiveForceLengthCurve_calcDerivative__SWIG_1(swigCPtr,this,StdVectorInt.getCPtr(derivComponents),derivComponents,Vector.getCPtr(x),x);
}
Program: 147102
Project: 147102
Buggy source:
public double calcDerivative(double cosPennationAngle,int order){
  return opensimSimulationJNI.FiberCompressiveForceCosPennationCurve_calcDerivative(swigCPtr,this,cosPennationAngle,order);
}

Fixed version (ground truth):
public double calcDerivative(StdVectorInt derivComponents,Vector x){
  return opensimSimulationJNI.FiberCompressiveForceCosPennationCurve_calcDerivative__SWIG_1(swigCPtr,this,StdVectorInt.getCPtr(derivComponents),derivComponents,Vector.getCPtr(x),x);
}
Program: 147103
Project: 147103
Buggy source:
public double calcDerivative(double aNormLength,int order){
  return opensimSimulationJNI.FiberCompressiveForceLengthCurve_calcDerivative(swigCPtr,this,aNormLength,order);
}

Fixed version (ground truth):
public double calcDerivative(StdVectorInt derivComponents,Vector x){
  return opensimSimulationJNI.FiberCompressiveForceLengthCurve_calcDerivative__SWIG_1(swigCPtr,this,StdVectorInt.getCPtr(derivComponents),derivComponents,Vector.getCPtr(x),x);
}
Program: 147104
Project: 147104
Buggy source:
public double calcDerivative(double normFiberLength,int order){
  return opensimSimulationJNI.FiberForceLengthCurve_calcDerivative(swigCPtr,this,normFiberLength,order);
}

Fixed version (ground truth):
public double calcDerivative(StdVectorInt derivComponents,Vector x){
  return opensimSimulationJNI.FiberForceLengthCurve_calcDerivative__SWIG_1(swigCPtr,this,StdVectorInt.getCPtr(derivComponents),derivComponents,Vector.getCPtr(x),x);
}
Program: 147105
Project: 147105
Buggy source:
public boolean set(int aIndex,Force aForce){
  return opensimSimulationJNI.ForceSet_set(swigCPtr,this,aIndex,Force.getCPtr(aForce),aForce);
}

Fixed version (ground truth):
public boolean set(int aIndex,Force aForce){
  return opensimSimulationJNI.ForceSet_set__SWIG_1(swigCPtr,this,aIndex,Force.getCPtr(aForce),aForce);
}
Program: 147106
Project: 147106
Buggy source:
public double calcDerivative(double normFiberVelocity,int order){
  return opensimSimulationJNI.ForceVelocityCurve_calcDerivative(swigCPtr,this,normFiberVelocity,order);
}

Fixed version (ground truth):
public double calcDerivative(StdVectorInt derivComponents,Vector x){
  return opensimSimulationJNI.ForceVelocityCurve_calcDerivative__SWIG_1(swigCPtr,this,StdVectorInt.getCPtr(derivComponents),derivComponents,Vector.getCPtr(x),x);
}
Program: 147107
Project: 147107
Buggy source:
public double calcDerivative(double aForceVelocityMultiplier,int order){
  return opensimSimulationJNI.ForceVelocityInverseCurve_calcDerivative(swigCPtr,this,aForceVelocityMultiplier,order);
}

Fixed version (ground truth):
public double calcDerivative(StdVectorInt derivComponents,Vector x){
  return opensimSimulationJNI.ForceVelocityInverseCurve_calcDerivative__SWIG_1(swigCPtr,this,StdVectorInt.getCPtr(derivComponents),derivComponents,Vector.getCPtr(x),x);
}
Program: 147108
Project: 147108
Buggy source:
public void changeFrame(PhysicalFrame aPhysicalFrame){
  opensimSimulationJNI.Marker_changeFrame(swigCPtr,this,PhysicalFrame.getCPtr(aPhysicalFrame),aPhysicalFrame);
}

Fixed version (ground truth):
public void changeFrame(PhysicalFrame parentFrame){
  opensimSimulationJNI.Marker_changeFrame(swigCPtr,this,PhysicalFrame.getCPtr(parentFrame),parentFrame);
}
Program: 147109
Project: 147109
Buggy source:
public void changeFramePreserveLocation(State s,PhysicalFrame aPhysicalFrame){
  opensimSimulationJNI.Marker_changeFramePreserveLocation(swigCPtr,this,State.getCPtr(s),s,PhysicalFrame.getCPtr(aPhysicalFrame),aPhysicalFrame);
}

Fixed version (ground truth):
public void changeFramePreserveLocation(State s,PhysicalFrame newParentFrame){
  opensimSimulationJNI.Marker_changeFramePreserveLocation(swigCPtr,this,State.getCPtr(s),s,PhysicalFrame.getCPtr(newParentFrame),newParentFrame);
}
Program: 147110
Project: 147110
Buggy source:
public double calcDerivative(double x,int order){
  return opensimCommonJNI.SmoothSegmentedFunction_calcDerivative(swigCPtr,this,x,order);
}

Fixed version (ground truth):
public double calcDerivative(double x,int order){
  return opensimCommonJNI.SmoothSegmentedFunction_calcDerivative__SWIG_0(swigCPtr,this,x,order);
}
Program: 147111
Project: 147111
Buggy source:
public double calcDerivative(double aNormLength,int order){
  return opensimSimulationJNI.TendonForceLengthCurve_calcDerivative(swigCPtr,this,aNormLength,order);
}

Fixed version (ground truth):
public double calcDerivative(StdVectorInt derivComponents,Vector x){
  return opensimSimulationJNI.TendonForceLengthCurve_calcDerivative__SWIG_1(swigCPtr,this,StdVectorInt.getCPtr(derivComponents),derivComponents,Vector.getCPtr(x),x);
}
Program: 147112
Project: 147112
Buggy source:
public void connectToModelAndBody(Model aModel,Body aBody){
  opensimSimulationJNI.WrapDoubleCylinderObst_connectToModelAndBody(swigCPtr,this,Model.getCPtr(aModel),aModel,Body.getCPtr(aBody),aBody);
}

Fixed version (ground truth):
public void connectToModelAndBody(Model aModel,PhysicalFrame aBody){
  opensimSimulationJNI.WrapDoubleCylinderObst_connectToModelAndBody(swigCPtr,this,Model.getCPtr(aModel),aModel,PhysicalFrame.getCPtr(aBody),aBody);
}
Program: 147113
Project: 147113
Buggy source:
public Color getColor(){
  if (motionDisplayer == null) {
    motionDisplayer=dMotion.getMotionDisplayer();
    markersDisplayer=motionDisplayer.getMarkersRep();
  }
  if (markersDisplayer == null)   markersDisplayer=motionDisplayer.getMarkersRep();
  return markersDisplayer.getColor();
}

Fixed version (ground truth):
public Color getColor(){
  if (motionDisplayer == null) {
    motionDisplayer=dMotion.getMotionDisplayer();
  }
  Vec3 colorAsVec3=motionDisplayer.getDefaultExperimentalMarkerColor();
  return new Color((float)colorAsVec3.get(0),(float)colorAsVec3.get(1),(float)colorAsVec3.get(2));
}
Program: 147114
Project: 147114
Buggy source:
public void updateMotionObjects(){
  if (simmMotionData instanceof AnnotatedMotion) {
    AnnotatedMotion mot=(AnnotatedMotion)simmMotionData;
    currentScaleFactor=mot.getDisplayForceScale();
    currentForceShape=mot.getDisplayForceShape();
    AddMotionObjectsRep(model);
    Vector<ExperimentalDataObject> objects=mot.getClassified();
    mot.setMotionDisplayer(this);
    for (    ExperimentalDataObject nextObject : objects) {
      if (nextObject.getObjectType() == ExperimentalDataItemType.MarkerData) {
        bindMarkerToVisualizerObjectKeepHandle(nextObject);
      }
 else       if (nextObject.getObjectType() == ExperimentalDataItemType.PointForceData) {
        bindForceVisualizerObjectKeepHandle(nextObject);
      }
 else       if (nextObject.getObjectType() == ExperimentalDataItemType.BodyForceData) {
        bindForceVisualizerObjectKeepHandle(nextObject);
      }
    }
    return;
  }
}

Fixed version (ground truth):
public void updateMotionObjects(){
  if (simmMotionData instanceof AnnotatedMotion) {
    AnnotatedMotion mot=(AnnotatedMotion)simmMotionData;
    currentScaleFactor=mot.getDisplayForceScale();
    currentForceShape=mot.getDisplayForceShape();
    Vector<ExperimentalDataObject> objects=mot.getClassified();
    mot.setMotionDisplayer(this);
    for (    ExperimentalDataObject nextObject : objects) {
      if (nextObject.getObjectType() == ExperimentalDataItemType.MarkerData) {
        bindMarkerToVisualizerObjectKeepHandle(nextObject);
      }
 else       if (nextObject.getObjectType() == ExperimentalDataItemType.PointForceData) {
        bindForceVisualizerObjectKeepHandle(nextObject);
      }
 else       if (nextObject.getObjectType() == ExperimentalDataItemType.BodyForceData) {
        bindForceVisualizerObjectKeepHandle(nextObject);
      }
    }
    return;
  }
}
Program: 147117
Project: 147117
Buggy source:
public int step(State s,int stepNumber){
  int retValue=0;
  processStep(s,stepNumber);
  return retValue;
}

Fixed version (ground truth):
public int step(State s,int stepNumber){
  int retValue=0;
  if (ownsStorage && stepNumber == 0)   storage.purge();
  processStep(s,stepNumber);
  return retValue;
}
Program: 147118
Project: 147118
Buggy source:
/** 
 * A variation of performAction that takes the desired representation and applies it to the model
 */
public void performAction(int newRep,int newShading){
  Node[] selected=ExplorerTopComponent.findInstance().getExplorerManager().getSelectedNodes();
  for (int i=0; i < selected.length; i++) {
    OpenSimObjectNode objectNode=(OpenSimObjectNode)selected[i];
    if (objectNode instanceof ColorableInterface) {
      ((ColorableInterface)objectNode).setDisplayPreference(newRep);
    }
 else {
      ViewDB.getInstance().setObjectRepresentation(objectNode.getOpenSimObject(),newRep,newShading);
      objectNode.refreshNode();
    }
  }
}

Fixed version (ground truth):
/** 
 * A variation of performAction that takes the desired representation and applies it to the model
 */
public void performAction(int newRep,int newShading){
  ViewDB.getInstance().setApplyAppearanceChange(false);
  Vector<OneComponentNode> nodes=collectAffectedComponentNodes();
  for (int i=0; i < nodes.size(); i++) {
    OpenSimObjectNode objectNode=(OpenSimObjectNode)nodes.get(i);
    if (objectNode instanceof ColorableInterface) {
      ((ColorableInterface)objectNode).setDisplayPreference(newRep);
    }
  }
  ViewDB.getInstance().setApplyAppearanceChange(true);
}
Program: 147119
Project: 147119
Buggy source:
public boolean isEnabled(){
  Node[] selected=ExplorerTopComponent.findInstance().getExplorerManager().getSelectedNodes();
  return true;
}

Fixed version (ground truth):
public boolean isEnabled(){
  return true;
}
Program: 147120
Project: 147120
Buggy source:
public static void ChangeUserSelectedNodesColor(Color newColor){
  Node[] selected=ExplorerTopComponent.findInstance().getExplorerManager().getSelectedNodes();
  for (int i=0; i < selected.length; i++) {
    if (!(selected[i] instanceof OpenSimObjectNode)) {
      continue;
    }
    OpenSimObjectNode objectNode=(OpenSimObjectNode)selected[i];
    ObjectDisplayColorAction.ChangeUserSelectedNodeColor(objectNode,newColor,false);
  }
  ViewDB.getInstance().repaintAll();
}

Fixed version (ground truth):
public static void ChangeUserSelectedNodesColor(Vector<OneComponentNode> nodes,Color newColor){
  float[] newColorComponentsAsFloatArray=newColor.getRGBComponents(null);
  double[] newColorComponentsAsDoubleArray={newColorComponentsAsFloatArray[0],newColorComponentsAsFloatArray[1],newColorComponentsAsFloatArray[2]};
  for (  OneComponentNode nextNode : nodes) {
    ObjectDisplayColorAction.applyOperationToNode(nextNode,newColorComponentsAsDoubleArray);
  }
  ViewDB.getInstance().repaintAll();
}
Program: 147121
Project: 147121
Buggy source:
public void performAction(){
  JColorChooser objectColorChooser=new JColorChooser();
  Color newColor=objectColorChooser.showDialog((JFrame)WindowManager.getDefault().getMainWindow(),"String_Node_Str",Color.WHITE);
  ObjectDisplayColorAction.ChangeUserSelectedNodesColor(newColor);
}

Fixed version (ground truth):
public void performAction(){
  JColorChooser objectColorChooser=new JColorChooser();
  Color newColor=objectColorChooser.showDialog((JFrame)WindowManager.getDefault().getMainWindow(),"String_Node_Str",Color.WHITE);
  Vector<OneComponentNode> nodes=collectAffectedComponentNodes();
  ViewDB.getInstance().setApplyAppearanceChange(false);
  ObjectDisplayColorAction.ChangeUserSelectedNodesColor(nodes,newColor);
  ViewDB.getInstance().setApplyAppearanceChange(true);
}
Program: 147122
Project: 147122
Buggy source:
private static void applyOperationToNode(final OpenSimObjectNode objectNode,double[] newColorComponents){
  OpenSimObject obj=objectNode.getOpenSimObject();
  Children ch=objectNode.getChildren();
  if (ch.getNodesCount() > 0) {
    Node[] childNodes=ch.getNodes();
    for (int child=0; child < childNodes.length; child++) {
      if (!(childNodes[child] instanceof OpenSimObjectNode)) {
        continue;
      }
      OpenSimObjectNode childNode=(OpenSimObjectNode)childNodes[child];
      ObjectDisplayColorAction.applyOperationToNode(childNode,newColorComponents);
    }
  }
 else {
    boolean hasColor=(objectNode instanceof ColorableInterface);
    if (hasColor) {
      Color newColor=new Color((float)newColorComponents[0],(float)newColorComponents[1],(float)newColorComponents[2]);
      ((ColorableInterface)objectNode).setColor(newColor);
    }
 else {
      ViewDB.getInstance().setObjectColor(obj,newColorComponents);
    }
    objectNode.refreshNode();
    if (ViewDB.isVtkGraphicsAvailable())     ViewDB.getInstance().updateDisplay(objectNode.getModelForNode(),((OpenSimObjectNode)objectNode).getOwnerComponent());
  }
}

Fixed version (ground truth):
private static void applyOperationToNode(final OneComponentNode objectNode,double[] newColorComponents){
  boolean hasColor=(objectNode instanceof ColorableInterface);
  if (hasColor) {
    Color newColor=new Color((float)newColorComponents[0],(float)newColorComponents[1],(float)newColorComponents[2]);
    ((ColorableInterface)objectNode).setColor(newColor);
  }
  objectNode.refreshNode();
}
Program: 147123
Project: 147123
Buggy source:
public void performAction(){
  Vector<OneComponentNode> objects=new Vector<OneComponentNode>();
  Node[] selected=ExplorerTopComponent.findInstance().getExplorerManager().getSelectedNodes();
  for (int i=0; i < selected.length; i++) {
    if (selected[i] instanceof OneComponentNode)     collectDescendentNodes((OneComponentNode)selected[i],objects);
  }
  ObjectDisplayOpacityPanel.showDialog(objects);
}

Fixed version (ground truth):
public void performAction(){
  Vector<OneComponentNode> objects=collectAffectedComponentNodes();
  ViewDB.getInstance().setApplyAppearanceChange(false);
  ObjectDisplayOpacityPanel.showDialog(objects);
  ViewDB.getInstance().setApplyAppearanceChange(true);
}
Program: 147124
Project: 147124
Buggy source:
public boolean isEnabled(){
  Node[] selected=ExplorerTopComponent.findInstance().getExplorerManager().getSelectedNodes();
  boolean isColorable=true;
  for (int i=0; i < selected.length && isColorable; i++) {
    isColorable=(selected[i] instanceof OpenSimObjectNode);
    if (isColorable) {
      OpenSimObjectNode objectNode=(OpenSimObjectNode)selected[i];
      isColorable=objectNode.getValidDisplayOptions().contains(displayOption.Colorable);
    }
  }
  return isColorable;
}

Fixed version (ground truth):
public boolean isEnabled(){
  Node[] selected=ExplorerTopComponent.findInstance().getExplorerManager().getSelectedNodes();
  boolean isColorable=true;
  for (int i=0; i < selected.length && isColorable; i++) {
    isColorable=(selected[i] instanceof OpenSimObjectNode);
    if (isColorable) {
      OpenSimObjectNode objectNode=(OpenSimObjectNode)selected[i];
      isColorable=objectNode.getValidDisplayOptions().contains(OpenSimObjectNode.displayOption.Colorable);
    }
  }
  return isColorable;
}
Program: 147126
Project: 147126
Buggy source:
public JSONObject createFrameMessageJson(){
  JSONObject msg=new JSONObject();
  Iterator<Integer> bodyIdIter=mapBodyIndicesToFrames.keySet().iterator();
  msg.put("String_Node_Str","String_Node_Str");
  JSONArray bodyTransforms_json=new JSONArray();
  msg.put("String_Node_Str",bodyTransforms_json);
  while (bodyIdIter.hasNext()) {
    int bodyId=bodyIdIter.next();
    JSONObject oneBodyXform_json=new JSONObject();
    PhysicalFrame bodyFrame=mapBodyIndicesToFrames.get(bodyId);
    Transform xform=bodyFrame.getTransformInGround(state);
    oneBodyXform_json.put("String_Node_Str",mapBodyIndicesToJson.get(bodyId).get("String_Node_Str"));
    oneBodyXform_json.put("String_Node_Str",JSONUtilities.createMatrixFromTransform(xform,new Vec3(1.,1.,1.),visScaleFactor));
    bodyTransforms_json.add(oneBodyXform_json);
  }
  JSONArray geompaths_json=new JSONArray();
  msg.put("String_Node_Str",geompaths_json);
  Set<GeometryPath> paths=pathList.keySet();
  Iterator<GeometryPath> pathIter=paths.iterator();
  while (pathIter.hasNext()) {
    GeometryPath geomPathObject=pathIter.next();
    UUID pathUUID=pathList.get(geomPathObject);
    JSONObject pathUpdate_json=new JSONObject();
    pathUpdate_json.put("String_Node_Str",pathUUID.toString());
    Vec3 pathColor=geomPathObject.getColor(state);
    String colorString=JSONUtilities.mapColorToRGBA(pathColor);
    pathUpdate_json.put("String_Node_Str",colorString);
    geompaths_json.add(pathUpdate_json);
  }
  return msg;
}

Fixed version (ground truth):
public JSONObject createFrameMessageJson(){
  JSONObject msg=new JSONObject();
  Iterator<Integer> bodyIdIter=mapBodyIndicesToFrames.keySet().iterator();
  msg.put("String_Node_Str","String_Node_Str");
  JSONArray bodyTransforms_json=new JSONArray();
  msg.put("String_Node_Str",bodyTransforms_json);
  if (ready) {
    while (bodyIdIter.hasNext()) {
      int bodyId=bodyIdIter.next();
      JSONObject oneBodyXform_json=new JSONObject();
      PhysicalFrame bodyFrame=mapBodyIndicesToFrames.get(bodyId);
      Transform xform=bodyFrame.getTransformInGround(state);
      oneBodyXform_json.put("String_Node_Str",mapBodyIndicesToJson.get(bodyId).get("String_Node_Str"));
      oneBodyXform_json.put("String_Node_Str",JSONUtilities.createMatrixFromTransform(xform,new Vec3(1.,1.,1.),visScaleFactor));
      bodyTransforms_json.add(oneBodyXform_json);
    }
    JSONArray geompaths_json=new JSONArray();
    msg.put("String_Node_Str",geompaths_json);
    Set<GeometryPath> paths=pathList.keySet();
    Iterator<GeometryPath> pathIter=paths.iterator();
    while (pathIter.hasNext()) {
      GeometryPath geomPathObject=pathIter.next();
      UUID pathUUID=pathList.get(geomPathObject);
      JSONObject pathUpdate_json=new JSONObject();
      pathUpdate_json.put("String_Node_Str",pathUUID.toString());
      Vec3 pathColor=geomPathObject.getColor(state);
      String colorString=JSONUtilities.mapColorToRGBA(pathColor);
      pathUpdate_json.put("String_Node_Str",colorString);
      geompaths_json.add(pathUpdate_json);
    }
  }
  return msg;
}
Program: 147127
Project: 147127
Buggy source:
public ModelVisualizationJson(JSONObject jsonTopIn,Model model){
  createModelJsonNode();
  createJsonForModel(model);
}

Fixed version (ground truth):
public ModelVisualizationJson(JSONObject jsonTopIn,Model model){
  if (verbose)   System.out.println("String_Node_Str" + model.getName());
  createModelJsonNode();
  createJsonForModel(model);
  ready=true;
  if (verbose)   System.out.println("String_Node_Str" + model.getName());
}
Program: 147128
Project: 147128
Buggy source:
public void setCurrentJson(){
  Model cModel=getCurrentModel();
  if (cModel != null && mapModelsToJsons.containsKey(cModel)) {
    currentJson=mapModelsToJsons.get(cModel);
    JSONObject msg=currentJson.createSetCurrentModelJson();
    websocketdb.broadcastMessageJson(msg,null);
    System.out.println(msg.toJSONString());
  }
}

Fixed version (ground truth):
public void setCurrentJson(){
  Model cModel=getCurrentModel();
  if (cModel != null && mapModelsToJsons.containsKey(cModel)) {
    currentJson=mapModelsToJsons.get(cModel);
    JSONObject msg=currentJson.createSetCurrentModelJson();
    websocketdb.broadcastMessageJson(msg,null);
    if (debugLevel > 1)     System.out.println(msg.toJSONString());
  }
}
Program: 147129
Project: 147129
Buggy source:
public void exportAllModelsToJson(VisWebSocket socket){
  Object[] models=OpenSimDB.getInstance().getAllModels();
  for (int i=0; i < models.length; i++) {
    Model model=(Model)models[i];
    ModelVisualizationJson vizJson=null;
    if (getInstance().mapModelsToJsons.containsKey(model)) {
      vizJson=getInstance().mapModelsToJsons.get(model);
    }
 else {
      vizJson=new ModelVisualizationJson(jsondb,model);
      getInstance().addModelVisuals(model,vizJson);
    }
    exportModelJsonToVisualizer(vizJson,socket);
  }
}

Fixed version (ground truth):
public void exportAllModelsToJson(VisWebSocket socket){
  Object[] models=OpenSimDB.getInstance().getAllModels();
  for (int i=0; i < models.length; i++) {
    Model model=(Model)models[i];
    ModelVisualizationJson vizJson=null;
    if (debugLevel > 1)     System.out.println("String_Node_Str");
    if (getInstance().mapModelsToJsons.containsKey(model)) {
      vizJson=getInstance().mapModelsToJsons.get(model);
    }
 else {
      vizJson=createJsonFroModel(jsondb,model);
    }
    exportModelJsonToVisualizer(vizJson,socket);
  }
}
Program: 147131
Project: 147131
Buggy source:
public void setCurrentJson(){
  Model cModel=getCurrentModel();
  if (cModel != null && mapModelsToJsons.containsKey(cModel)) {
    currentJson=mapModelsToJsons.get(cModel);
    JSONObject msg=currentJson.createSetCurrentModelJson();
    websocketdb.broadcastMessageJson(msg,null);
    System.out.println(msg.toJSONString());
  }
}

Fixed version (ground truth):
public void setCurrentJson(){
  Model cModel=getCurrentModel();
  if (cModel != null && mapModelsToJsons.containsKey(cModel)) {
    currentJson=mapModelsToJsons.get(cModel);
    JSONObject msg=currentJson.createSetCurrentModelJson();
    websocketdb.broadcastMessageJson(msg,null);
    if (debugLevel > 1)     System.out.println(msg.toJSONString());
  }
}