Program: 72776
Project: 72776
Buggy source:
public void saveModel() throws IllegalActionException {
  for (int i=0; i < getRowCount() - 1; i++) {
    String selfTransitionExpression="String_Node_Str";
    String enterModeExpression="String_Node_Str";
    String guard="String_Node_Str";
    String value="String_Node_Str";
    State state=(State)_model.getEntity((String)getValueAt(i,0));
    for (int j=0; j < getColumnCount() - 1; j++) {
      int contentIndex=_getContentIndex(i,j);
      String condition=(String)getValueAt(i,j + 1);
      value=(String)getValueAt(getRowCount() - 1,j + 1);
      String[] conditions=_handleInmodeExpression(condition,value,state);
      String enterModeCondition="String_Node_Str";
      if (condition.contains("String_Node_Str")) {
        enterModeCondition="String_Node_Str";
      }
 else {
        enterModeCondition=conditions[1];
      }
      condition=conditions[0];
      if (condition.equals("String_Node_Str")) {
        condition="String_Node_Str";
      }
      if (!guard.equals("String_Node_Str")) {
        guard=guard + "String_Node_Str";
      }
      guard=guard + condition;
      if (enterModeCondition.equals("String_Node_Str")) {
        enterModeCondition="String_Node_Str";
      }
      selfTransitionExpression=selfTransitionExpression + "String_Node_Str" + condition+ "String_Node_Str"+ value+ "String_Node_Str";
      enterModeExpression=enterModeExpression + "String_Node_Str" + enterModeCondition+ "String_Node_Str"+ value+ "String_Node_Str";
    }
    selfTransitionExpression=selfTransitionExpression + "String_Node_Str" + value;
    enterModeExpression=enterModeExpression + "String_Node_Str" + value;
    for (int j=0; j < getColumnCount() - 1; j++) {
      selfTransitionExpression=selfTransitionExpression + "String_Node_Str";
      enterModeExpression=enterModeExpression + "String_Node_Str";
    }
    Transition transition=SCRTableHelper.getSelfTransition(state,_parameter);
    if (transition == null) {
      try {
        transition=new Transition(_model,((CompositeEntity)_model).uniqueName(state.getName() + "String_Node_Str"));
        state.outgoingPort.link(transition);
        state.incomingPort.link(transition);
      }
 catch (      IllegalActionException e) {
        e.printStackTrace();
      }
catch (      NameDuplicationException e) {
        e.printStackTrace();
      }
    }
    transition.setActions.setExpression(_parameter.getName() + "String_Node_Str" + selfTransitionExpression);
    transition.guardExpression.setExpression(guard);
    boolean noSetActionSet=true;
    for (    Object relation : state.incomingPort.linkedRelationList()) {
      if (!state.outgoingPort.linkedRelationList().contains(relation)) {
        transition=(Transition)relation;
        String newExpression=_parameter.getName() + "String_Node_Str" + enterModeExpression;
        String expression=transition.setActions.getExpression();
        System.out.println("String_Node_Str" + expression);
        try {
          if (transition.setActions.getDestinations().contains(_parameter)) {
            int index=expression.indexOf(_parameter.getName() + "String_Node_Str");
            String before=expression.substring(0,index);
            int afterIdx=expression.indexOf("String_Node_Str",index + 1);
            String after="String_Node_Str";
            if (afterIdx > 0) {
              after=expression.substring(afterIdx).trim();
              if (after.startsWith("String_Node_Str")) {
                after=after.substring(1).trim();
              }
            }
            expression=before + after;
            expression=expression.trim();
          }
          if (!expression.equals("String_Node_Str") && !expression.endsWith("String_Node_Str")) {
            expression=expression + "String_Node_Str";
          }
          System.out.println("String_Node_Str" + expression + newExpression);
          transition.setActions.setExpression(expression + newExpression);
          transition.setActions.setPersistent(true);
          noSetActionSet=false;
        }
 catch (        IllegalActionException e) {
          throw e;
        }
      }
    }
    if (noSetActionSet) {
      throw new IllegalActionException(_model,"String_Node_Str" + state.getName());
    }
  }
}

Fixed version (ground truth):
public void saveModel() throws IllegalActionException {
  for (int i=0; i < getRowCount() - 1; i++) {
    StringBuffer selfTransitionExpression=new StringBuffer();
    StringBuffer enterModeExpression=new StringBuffer();
    String guard="String_Node_Str";
    String value="String_Node_Str";
    State state=(State)_model.getEntity((String)getValueAt(i,0));
    for (int j=0; j < getColumnCount() - 1; j++) {
      int contentIndex=_getContentIndex(i,j);
      String condition=(String)getValueAt(i,j + 1);
      value=(String)getValueAt(getRowCount() - 1,j + 1);
      String[] conditions=_handleInmodeExpression(condition,value,state);
      String enterModeCondition="String_Node_Str";
      if (condition.contains("String_Node_Str")) {
        enterModeCondition="String_Node_Str";
      }
 else {
        enterModeCondition=conditions[1];
      }
      condition=conditions[0];
      if (condition.equals("String_Node_Str")) {
        condition="String_Node_Str";
      }
      if (!guard.equals("String_Node_Str")) {
        guard=guard + "String_Node_Str";
      }
      guard=guard + condition;
      if (enterModeCondition.equals("String_Node_Str")) {
        enterModeCondition="String_Node_Str";
      }
      selfTransitionExpression=selfTransitionExpression.append("String_Node_Str" + condition + "String_Node_Str"+ value+ "String_Node_Str");
      enterModeExpression=enterModeExpression.append("String_Node_Str" + enterModeCondition + "String_Node_Str"+ value+ "String_Node_Str");
    }
    selfTransitionExpression=selfTransitionExpression.append("String_Node_Str" + value);
    enterModeExpression=enterModeExpression.append("String_Node_Str" + value);
    for (int j=0; j < getColumnCount() - 1; j++) {
      selfTransitionExpression=selfTransitionExpression.append("String_Node_Str");
      enterModeExpression=enterModeExpression.append("String_Node_Str");
    }
    Transition transition=SCRTableHelper.getSelfTransition(state,_parameter);
    if (transition == null) {
      try {
        transition=new Transition(_model,((CompositeEntity)_model).uniqueName(state.getName() + "String_Node_Str"));
        state.outgoingPort.link(transition);
        state.incomingPort.link(transition);
      }
 catch (      IllegalActionException e) {
        e.printStackTrace();
      }
catch (      NameDuplicationException e) {
        e.printStackTrace();
      }
    }
    transition.setActions.setExpression(_parameter.getName() + "String_Node_Str" + selfTransitionExpression);
    transition.guardExpression.setExpression(guard);
    boolean noSetActionSet=true;
    for (    Object relation : state.incomingPort.linkedRelationList()) {
      if (!state.outgoingPort.linkedRelationList().contains(relation)) {
        transition=(Transition)relation;
        String newExpression=_parameter.getName() + "String_Node_Str" + enterModeExpression;
        String expression=transition.setActions.getExpression();
        System.out.println("String_Node_Str" + expression);
        try {
          if (transition.setActions.getDestinations().contains(_parameter)) {
            int index=expression.indexOf(_parameter.getName() + "String_Node_Str");
            String before=expression.substring(0,index);
            int afterIdx=expression.indexOf("String_Node_Str",index + 1);
            String after="String_Node_Str";
            if (afterIdx > 0) {
              after=expression.substring(afterIdx).trim();
              if (after.startsWith("String_Node_Str")) {
                after=after.substring(1).trim();
              }
            }
            expression=before + after;
            expression=expression.trim();
          }
          if (!expression.equals("String_Node_Str") && !expression.endsWith("String_Node_Str")) {
            expression=expression + "String_Node_Str";
          }
          System.out.println("String_Node_Str" + expression + newExpression);
          transition.setActions.setExpression(expression + newExpression);
          transition.setActions.setPersistent(true);
          noSetActionSet=false;
        }
 catch (        IllegalActionException e) {
          throw e;
        }
      }
    }
    if (noSetActionSet) {
      throw new IllegalActionException(_model,"String_Node_Str" + state.getName());
    }
  }
}