nus-yam/ex-repair huggingface dataset:
Program: 74460
Project: 74460
Buggy source:
/** 
 * Convert the specified token into a token having the type represented by this object.
 * @param token a token.
 * @return a token.
 * @exception IllegalActionException If lossless conversioncannot be done.
 */
public Token convert(Token token) throws IllegalActionException {
  if (token instanceof ObjectToken) {
    ObjectToken objectToken=(ObjectToken)token;
    Object value=objectToken.getValue();
    if (_class == null || _class.isInstance(value)) {
      return new ObjectToken(value,_class);
    }
  }
  throw new IllegalArgumentException(Token.notSupportedConversionMessage(token,this.toString()));
}

Fixed version (ground truth):
/** 
 * Convert the specified token into a token having the type represented by this object.
 * @param token a token.
 * @return a token.
 * @exception IllegalActionException If lossless conversioncannot be done.
 */
public Token convert(Token token) throws IllegalActionException {
  if (token instanceof ObjectToken) {
    ObjectToken objectToken=(ObjectToken)token;
    Object value=objectToken.getValue();
    if (value == null || _class == null || _class.isInstance(value)) {
      return new ObjectToken(value,_class);
    }
  }
  throw new IllegalArgumentException(Token.notSupportedConversionMessage(token,this.toString()));
}
Program: 74462
Project: 74462
Buggy source:
/** 
 * only for debugging purposes
 * @throws IllegalActionException
 */
private void _printStatus() throws IllegalActionException {
  double d=getModelTime().getDoubleValue();
  StringBuilder sb=new StringBuilder();
  Formatter formatter=new Formatter(sb,Locale.US);
  formatter.format("String_Node_Str",new Object[]{new Double.valueOf(d),getController().currentState().getName(),_currentSchedule.currentScheduleTime,_currentSchedule.modeSchedule.size(),_currentSchedule.currentPositionInSlot,_schedule.size()});
  System.out.println();
  System.out.print(sb + "String_Node_Str");
}

Fixed version (ground truth):
/** 
 * only for debugging purposes
 * @throws IllegalActionException
 */
private void _printStatus() throws IllegalActionException {
  double d=getModelTime().getDoubleValue();
  StringBuilder sb=new StringBuilder();
  Formatter formatter=new Formatter(sb,Locale.US);
  formatter.format("String_Node_Str",new Object[]{Double.valueOf(d),getController().currentState().getName(),_currentSchedule.currentScheduleTime,_currentSchedule.modeSchedule.size(),_currentSchedule.currentPositionInSlot,_schedule.size()});
  System.out.println();
  System.out.print(sb + "String_Node_Str");
}
Program: 74463
Project: 74463
Buggy source:
private static Variable _searchIn(Variable exclude,NamedObj container,String name){
  Attribute result=container.getAttribute(name);
  if ((result != null) && result instanceof Variable && (result != exclude)) {
    return (Variable)result;
  }
 else {
    Iterator extenders=container.attributeList(ScopeExtender.class).iterator();
    while (extenders.hasNext()) {
      ScopeExtender extender=(ScopeExtender)extenders.next();
      result=extender.getAttribute(name);
      if ((result != null) && result instanceof Variable && (result != exclude)) {
        return (Variable)result;
      }
      return null;
    }
  }
  return null;
}

Fixed version (ground truth):
private static Variable _searchIn(Variable exclude,NamedObj container,String name){
  Attribute result=container.getAttribute(name);
  if ((result != null) && result instanceof Variable && (result != exclude)) {
    return (Variable)result;
  }
 else {
    Iterator extenders=container.attributeList(ScopeExtender.class).iterator();
    while (extenders.hasNext()) {
      ScopeExtender extender=(ScopeExtender)extenders.next();
      result=extender.getAttribute(name);
      if ((result != null) && result instanceof Variable && (result != exclude)) {
        return (Variable)result;
      }
    }
  }
  return null;
}
Program: 74464
Project: 74464
Buggy source:
/** 
 * wake up all waiting threads. The threads decide themselves if they have anything to do.
 */
public void notifyWaitingThreads(){
  Set set=(Set)_waitingPlatforms.clone();
  Iterator it=set.iterator();
  while (it.hasNext()) {
    Thread thread=(Thread)it.next();
    if (_debugging)     _debug("String_Node_Str" + thread.getName() + "String_Node_Str");
    threadUnblocked(thread,null);
  }
  _waitingPlatforms.clear();
}

Fixed version (ground truth):
/** 
 * wake up all waiting threads. The threads decide themselves if they have anything to do.
 */
public void notifyWaitingThreads(){
  try {
    Set set=(Set)_waitingPlatforms.clone();
    Iterator it=set.iterator();
    while (it.hasNext()) {
      Thread thread=(Thread)it.next();
      if (_debugging)       _debug("String_Node_Str" + thread.getName() + "String_Node_Str");
      threadUnblocked(thread,null);
    }
    _waitingPlatforms.clear();
  }
 catch (  Exception ex) {
  }
}
Program: 74465
Project: 74465
Buggy source:
public void initialize(Hashtable nodesActors){
  nodes.clear();
  plot.clear(false);
  plot.clearLegends();
  nodes.addAll(nodesActors.keySet());
  nodeActive=new boolean[nodes.size()];
  this.nodeActors=nodesActors;
  for (int i=0; i < nodes.size(); i++) {
    Actor node=(Actor)nodes.get(i);
    nodeActorStrings.add(node.getName());
    if (plot == null)     return;
    plot.addLegend(nodeActorStrings.indexOf(node.getName()),node.getName());
    List actors=(List)nodeActors.get(node);
    for (int j=0; j < actors.size(); j++) {
      Actor actor=(Actor)actors.get(j);
      nodeActorStrings.add(node.getName() + "String_Node_Str" + actor.getName());
      plot.addLegend(nodeActorStrings.indexOf(node.getName() + "String_Node_Str" + actor.getName()),node.getName() + "String_Node_Str" + actor.getName());
    }
  }
  plot.doLayout();
}

Fixed version (ground truth):
public void initialize(Hashtable nodesActors){
  nodes.clear();
  if (plot != null) {
    plot.clear(false);
    plot.clearLegends();
    nodes.addAll(nodesActors.keySet());
    nodeActive=new boolean[nodes.size()];
    this.nodeActors=nodesActors;
    for (int i=0; i < nodes.size(); i++) {
      Actor node=(Actor)nodes.get(i);
      nodeActorStrings.add(node.getName());
      if (plot == null)       return;
      plot.addLegend(nodeActorStrings.indexOf(node.getName()),node.getName());
      List actors=(List)nodeActors.get(node);
      for (int j=0; j < actors.size(); j++) {
        Actor actor=(Actor)actors.get(j);
        nodeActorStrings.add(node.getName() + "String_Node_Str" + actor.getName());
        plot.addLegend(nodeActorStrings.indexOf(node.getName() + "String_Node_Str" + actor.getName()),node.getName() + "String_Node_Str" + actor.getName());
      }
    }
    plot.doLayout();
  }
}
Program: 74474
Project: 74474
Buggy source:
/** 
 * Return the value in the token as a short.
 * @return The value contained in this token as a short.
 */
public short shortValue(){
  return _value;
}

Fixed version (ground truth):
/** 
 * Return the value in the token as a short.
 * @return The value contained in this token as a short.
 */
public short shortValue(){
  return unsignedConvert(_value);
}
Program: 74475
Project: 74475
Buggy source:
/** 
 * Convert a byte to an integer, treating the byte as an unsigned value in the range 0 through 255.  Note that Java defines the byte as having a value ranging from -128 through 127, so 256 is added if this value is negative.
 * @param value The byte to convert to an unsigned byte.
 * @return An integer in the range 0 through 255.
 */
public static int unsignedConvert(byte value){
  int intValue=value;
  if (intValue < 0) {
    intValue+=256;
  }
  return intValue;
}

Fixed version (ground truth):
/** 
 * Convert a byte to an integer, treating the byte as an unsigned value in the range 0 through 255.  Note that Java defines the byte as having a value ranging from -128 through 127, so 256 is added if this value is negative.
 * @param value The byte to convert to an unsigned byte.
 * @return An integer in the range 0 through 255.
 */
public static short unsignedConvert(byte value){
  short intValue=value;
  if (intValue < 0) {
    intValue+=256;
  }
  return intValue;
}
Program: 74476
Project: 74476
Buggy source:
private void _deleteFolder(File folder) throws Exception {
  String childs[]=null;
  childs=folder.list();
  if (childs == null || childs.length <= 0) {
    folder.delete();
  }
  for (int i=0; i < childs.length; i++) {
    String childName=childs[i];
    String childPath=folder.getPath() + File.separator + childName;
    File filePath=new File(childPath);
    if (filePath.exists() && filePath.isFile()) {
      filePath.delete();
    }
 else     if (filePath.exists() && filePath.isDirectory()) {
      _deleteFolder(filePath);
    }
  }
  folder.delete();
}

Fixed version (ground truth):
private void _deleteFolder(File folder) throws Exception {
  String childs[]=null;
  childs=folder.list();
  if (childs == null || childs.length <= 0) {
    boolean isDeleted=folder.delete();
  }
 else {
    for (int i=0; i < childs.length; i++) {
      String childName=childs[i];
      String childPath=folder.getPath() + File.separator + childName;
      File filePath=new File(childPath);
      if (filePath.exists() && filePath.isFile()) {
        filePath.delete();
      }
 else       if (filePath.exists() && filePath.isDirectory()) {
        _deleteFolder(filePath);
      }
    }
    boolean isDeleted=folder.delete();
  }
}
Program: 74478
Project: 74478
Buggy source:
private REDModuleNameInitialBean(){
  _name=new String("String_Node_Str");
  _initialStateDescription=new String("String_Node_Str");
}

Fixed version (ground truth):
private REDModuleNameInitialBean(){
}
Program: 74481
Project: 74481
Buggy source:
/** 
 * This function would try to generate an equivalent system with  a flattened view. It would perform a rewriting of each ModalModel with hierarchy to a FSMActor. Note that in our current  implementation this kind of rewriting only supports to state  refinements.
 * @param originalCompositeActor 
 * @return a flattened equivalent system.
 */
public static CompositeActor generateEquivalentSystemWithoutHierachy(CompositeActor originalCompositeActor){
  ArrayList<FSMActor> list=new ArrayList<FSMActor>();
  try {
    if ((((CompositeActor)originalCompositeActor).entityList()).size() > 0) {
      Iterator it=(((CompositeActor)originalCompositeActor).entityList()).iterator();
      while (it.hasNext()) {
        Entity innerEntity=(Entity)it.next();
        if (innerEntity instanceof ModalModel) {
          FSMActor newActor=(FSMActor)_rewriteModalModelWithStateRefinementToFSMActor((ModalModel)innerEntity);
          (((CompositeActor)originalCompositeActor).entityList()).remove(innerEntity);
          list.add(newActor);
        }
      }
    }
  }
 catch (  Exception ex) {
    ex.printStackTrace();
  }
  for (int i=0; i < list.size(); i++) {
    (((CompositeActor)originalCompositeActor).entityList()).add(list.get(i));
  }
  return originalCompositeActor;
}

Fixed version (ground truth):
/** 
 * This function would try to generate an equivalent system with  a flattened view. It would perform a rewriting of each ModalModel with hierarchy to a FSMActor. Note that in our current  implementation this kind of rewriting only supports to state  refinements.
 * @param originalCompositeActor 
 * @return a flattened equivalent system.
 */
public static CompositeActor generateEquivalentSystemWithoutHierachy(CompositeActor originalCompositeActor) throws NameDuplicationException, IllegalActionException, CloneNotSupportedException {
  ArrayList<FSMActor> list=new ArrayList<FSMActor>();
  if ((((CompositeActor)originalCompositeActor).entityList()).size() > 0) {
    Iterator it=(((CompositeActor)originalCompositeActor).entityList()).iterator();
    while (it.hasNext()) {
      Entity innerEntity=(Entity)it.next();
      if (innerEntity instanceof ModalModel) {
        FSMActor newActor=(FSMActor)_rewriteModalModelWithStateRefinementToFSMActor((ModalModel)innerEntity);
        (((CompositeActor)originalCompositeActor).entityList()).remove(innerEntity);
        list.add(newActor);
      }
    }
  }
  for (int i=0; i < list.size(); i++) {
    (((CompositeActor)originalCompositeActor).entityList()).add(list.get(i));
  }
  return originalCompositeActor;
}
Program: 74485
Project: 74485
Buggy source:
/** 
 * Add commands to the specified menu and toolbar, as appropriate for this controller. In this class, commands are added to create ports and relations.
 * @param menu The menu to add to, or null if none.
 * @param toolbar The toolbar to add to, or null if none.
 */
public void addToMenuAndToolbar(JMenu menu,JToolBar toolbar){
  super.addToMenuAndToolbar(menu,toolbar);
}

Fixed version (ground truth):
/** 
 * Add commands to the specified menu and toolbar, as appropriate for this controller. In this class, commands are added to create ports and relations.
 * @param menu The menu to add to, or null if none.
 * @param toolbar The toolbar to add to, or null if none.
 */
public void addToMenuAndToolbar(JMenu menu,JToolBar toolbar){
  super.addToMenuAndToolbar(menu,toolbar);
  menu.addSeparator();
  diva.gui.GUIUtilities.addMenuItem(menu,_newFmvStateAction);
  diva.gui.GUIUtilities.addToolBarButton(toolbar,_newFmvStateAction);
}
Program: 74487
Project: 74487
Buggy source:
/** 
 * Perform an enumeration of the state in this FmvAutomaton and return a HashSet of states.
 * @return A HashSet of states of a particular FmvAutomaton
 */
private HashSet<State> _enumerateStateSet() throws IllegalActionException {
  HashSet<State> returnStateSet=new HashSet<State>();
  try {
    HashMap<String,State> frontier=new HashMap<String,State>();
    State stateInThis=this.getInitialState();
    String name=stateInThis.getName();
    frontier.put(name,stateInThis);
    returnStateSet.add(stateInThis);
    while (!frontier.isEmpty()) {
      Iterator<String> iterator=frontier.keySet().iterator();
      name=(String)iterator.next();
      if (name != null)       stateInThis=(State)frontier.remove(name);
      ComponentPort outPort=stateInThis.outgoingPort;
      Iterator transitions=outPort.linkedRelationList().iterator();
      while (transitions.hasNext()) {
        Transition transition=(Transition)transitions.next();
        State destinationInThis=transition.destinationState();
        if (!returnStateSet.contains(destinationInThis)) {
          frontier.put(destinationInThis.getName(),destinationInThis);
          returnStateSet.add(destinationInThis);
        }
      }
    }
  }
 catch (  Exception exception) {
    throw new IllegalActionException("String_Node_Str" + exception.getMessage());
  }
  return returnStateSet;
}

Fixed version (ground truth):
/** 
 * Perform an enumeration of the state in this FmvAutomaton and return a HashSet of states.
 * @return A HashSet of states of a particular FmvAutomaton
 */
private HashSet<State> _enumerateStateSet() throws IllegalActionException {
  HashSet<State> returnStateSet=new HashSet<State>();
  try {
    HashMap<String,State> frontier=new HashMap<String,State>();
    State stateInThis=this.getInitialState();
    String name=(stateInThis == null ? "String_Node_Str" : stateInThis.getName());
    frontier.put(name,stateInThis);
    returnStateSet.add(stateInThis);
    while (!frontier.isEmpty()) {
      Iterator<String> iterator=frontier.keySet().iterator();
      name=(String)iterator.next();
      if (name != null)       stateInThis=(State)frontier.remove(name);
      ComponentPort outPort=stateInThis.outgoingPort;
      Iterator transitions=outPort.linkedRelationList().iterator();
      while (transitions.hasNext()) {
        Transition transition=(Transition)transitions.next();
        State destinationInThis=transition.destinationState();
        if (!returnStateSet.contains(destinationInThis)) {
          frontier.put(destinationInThis.getName(),destinationInThis);
          returnStateSet.add(destinationInThis);
        }
      }
    }
  }
 catch (  Exception exception) {
    throw new IllegalActionException("String_Node_Str" + exception.getMessage());
  }
  return returnStateSet;
}
Program: 74489
Project: 74489
Buggy source:
public Object next() throws NoSuchElementException {
  if (cursor <= 0) {
    throw new NoSuchElementException("String_Node_Str" + cursor + "String_Node_Str"+ _elements.size());
  }
  cursor--;
  return _elements.get(cursor);
}

Fixed version (ground truth):
public Object next() throws NoSuchElementException {
  if (cursor <= 0) {
    throw new NoSuchElementException("String_Node_Str" + cursor + "String_Node_Str"+ _currentFigures.size());
  }
  cursor--;
  return _currentFigures.get(cursor);
}
Program: 74490
Project: 74490
Buggy source:
/** 
 * Remove the figure at the given position in the list. See the implemented method for a detailed description.
 */
public void remove(int index){
  _elements.remove(_elements.size() - 1 - index);
}

Fixed version (ground truth):
public void remove(){
  throw new UnsupportedOperationException("String_Node_Str");
}
Program: 74491
Project: 74491
Buggy source:
/** 
 * Return the figures from lowest index to highest index.
 */
public Iterator figuresFromFront(){
}

Fixed version (ground truth):
/** 
 * Return the figures from lowest index to highest index.
 */
public Iterator figuresFromFront(){
  return new Iterator(){
    int cursor=_currentFigures.size();
    public boolean hasNext(){
      return cursor > 0;
    }
    public Object next() throws NoSuchElementException {
      if (cursor <= 0) {
        throw new NoSuchElementException("String_Node_Str" + cursor + "String_Node_Str"+ _currentFigures.size());
      }
      cursor--;
      return _currentFigures.get(cursor);
    }
    public void remove(){
      throw new UnsupportedOperationException("String_Node_Str");
    }
  }
;
}
Program: 74492
Project: 74492
Buggy source:
/** 
 * create empty fields for the main attribute as well as any params or ports that exist in the target
 * @param target the namedobj to create the empty attributes for
 */
public void createEmptyFields(NamedObj target){
  try {
    ConfigurableAttribute authorAtt=new ConfigurableAttribute(this,"String_Node_Str");
    ConfigurableAttribute versionAtt=new ConfigurableAttribute(this,"String_Node_Str");
    ConfigurableAttribute descriptionAtt=new ConfigurableAttribute(this,"String_Node_Str");
    ConfigurableAttribute uldAtt=new ConfigurableAttribute(this,"String_Node_Str");
    this.author="String_Node_Str";
    this.version="String_Node_Str";
    this.description="String_Node_Str";
    this.userLevelDocumentation="String_Node_Str";
    Iterator attItt=target.attributeList().iterator();
    while (attItt.hasNext()) {
      Attribute a=(Attribute)attItt.next();
      String aname=a.getName();
      System.out.println("String_Node_Str" + aname + "String_Node_Str");
      if (aname.trim().indexOf("String_Node_Str") != 0 && !aname.equals("String_Node_Str")) {
        propertyHash.put(a.getName(),"String_Node_Str");
      }
    }
    if (target instanceof Entity) {
      Iterator portItt=((Entity)target).portList().iterator();
      while (portItt.hasNext()) {
        Port p=(Port)portItt.next();
        portHash.put(p.getName(),"String_Node_Str");
      }
    }
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
/** 
 * create empty fields for the main attribute as well as any params or ports that exist in the target
 * @param target the namedobj to create the empty attributes for
 */
public void createEmptyFields(NamedObj target){
  try {
    ConfigurableAttribute authorAtt=new ConfigurableAttribute(this,"String_Node_Str");
    ConfigurableAttribute versionAtt=new ConfigurableAttribute(this,"String_Node_Str");
    ConfigurableAttribute descriptionAtt=new ConfigurableAttribute(this,"String_Node_Str");
    ConfigurableAttribute uldAtt=new ConfigurableAttribute(this,"String_Node_Str");
    this.author="String_Node_Str";
    this.version="String_Node_Str";
    this.description="String_Node_Str";
    this.userLevelDocumentation="String_Node_Str";
    Iterator attItt=target.attributeList().iterator();
    while (attItt.hasNext()) {
      Attribute a=(Attribute)attItt.next();
      String aname=a.getName();
      if (!aname.substring(0,1).equals("String_Node_Str") && !aname.equals("String_Node_Str")) {
        propertyHash.put(a.getName(),"String_Node_Str");
      }
    }
    if (target instanceof Entity) {
      Iterator portItt=((Entity)target).portList().iterator();
      while (portItt.hasNext()) {
        Port p=(Port)portItt.next();
        portHash.put(p.getName(),"String_Node_Str");
      }
    }
  }
 catch (  Exception e) {
    System.out.println("String_Node_Str" + e.getMessage());
  }
}
Program: 74493
Project: 74493
Buggy source:
/** 
 * Populates the members of KeplerDocumentationAttribute from another given KeplerDccumentationAtttribute.
 * @param da The DocumentationAttribute from which to copy attributes.
 */
public void createInstanceFromExisting(KeplerDocumentationAttribute da){
  Iterator itt=da.attributeList().iterator();
  while (itt.hasNext()) {
    ConfigurableAttribute att=(ConfigurableAttribute)itt.next();
    String attName=att.getName();
    if (attName.equals("String_Node_Str")) {
      this.description=att.getConfigureText();
    }
 else     if (attName.equals("String_Node_Str")) {
      this.author=att.getConfigureText();
    }
 else     if (attName.equals("String_Node_Str")) {
      this.version=att.getConfigureText();
    }
 else     if (attName.equals("String_Node_Str")) {
      this.userLevelDocumentation=att.getConfigureText();
    }
 else     if (attName.indexOf("String_Node_Str") != -1) {
      String portName=attName.substring(attName.indexOf("String_Node_Str") + 1,attName.length());
      String portDesc=att.getConfigureText();
      portHash.put(portName,portDesc);
    }
 else     if (attName.indexOf("String_Node_Str") != -1) {
      String propName=attName.substring(attName.indexOf("String_Node_Str") + 1,attName.length());
      String propDesc=att.getConfigureText();
      propertyHash.put(propName,propDesc);
    }
  }
}

Fixed version (ground truth):
/** 
 * Populates the members of KeplerDocumentationAttribute from another given KeplerDccumentationAtttribute.
 * @param da The DocumentationAttribute from which to copy attributes.
 */
public void createInstanceFromExisting(KeplerDocumentationAttribute da){
  Iterator itt=da.attributeList().iterator();
  while (itt.hasNext()) {
    ConfigurableAttribute att=(ConfigurableAttribute)itt.next();
    String attName=att.getName();
    if (attName.equals("String_Node_Str")) {
      this.description=att.getConfigureText();
    }
 else     if (attName.equals("String_Node_Str")) {
      this.author=att.getConfigureText();
    }
 else     if (attName.equals("String_Node_Str")) {
      this.version=att.getConfigureText();
    }
 else     if (attName.equals("String_Node_Str")) {
      this.userLevelDocumentation=att.getConfigureText();
    }
 else     if (attName.indexOf("String_Node_Str") != -1) {
      String portName=attName.substring(attName.indexOf("String_Node_Str") + 1,attName.length());
      String portDesc=att.getConfigureText();
      if (portName != null) {
        if (portDesc == null) {
          portDesc="String_Node_Str";
        }
        portHash.put(portName,portDesc);
      }
    }
 else     if (attName.indexOf("String_Node_Str") != -1) {
      String propName=attName.substring(attName.indexOf("String_Node_Str") + 1,attName.length());
      String propDesc=att.getConfigureText();
      if (propName != null) {
        if (propDesc == null) {
          propDesc="String_Node_Str";
        }
        propertyHash.put(propName,propDesc);
      }
    }
  }
}
Program: 74494
Project: 74494
Buggy source:
protected void changeEmbeddedCCode() throws IllegalActionException {
  BufferedReader reader=codeBlockFile.openForReading();
  if (reader == null) {
    System.out.println("String_Node_Str");
  }
  String code=new String();
  try {
    String str;
    while ((str=reader.readLine()) != null) {
      code=code.concat(str + "String_Node_Str");
    }
  }
 catch (  IOException e) {
    throw new IllegalActionException("String_Node_Str" + codeBlockFile.getExpression());
  }
  embeddedCCode.setExpression(code);
}

Fixed version (ground truth):
public void changeEmbeddedCCode() throws IllegalActionException {
  BufferedReader reader=codeBlockFile.openForReading();
  if (reader == null) {
    System.out.println("String_Node_Str");
  }
  String code=new String();
  try {
    String str;
    while ((str=reader.readLine()) != null) {
      code=code.concat(str + "String_Node_Str");
    }
  }
 catch (  IOException e) {
    throw new IllegalActionException("String_Node_Str" + codeBlockFile.getExpression());
  }
  embeddedCCode.setExpression(code);
}
Program: 74495
Project: 74495
Buggy source:
protected void _generateAndCompileCCode() throws IllegalActionException {
  if (_codeFile.lastModified() > _timeOfModification) {
    attributeChanged(codeBlockFile);
  }
  changeEmbeddedCCode();
  System.out.println(embeddedCCode.getExpression());
  System.out.println("String_Node_Str");
  super._generateAndCompileCCode();
}

Fixed version (ground truth):
protected void _generateAndCompileCCode() throws IllegalActionException {
  if (_codeFile.lastModified() > _timeOfModification) {
    attributeChanged(codeBlockFile);
  }
  changeEmbeddedCCode();
  super._generateAndCompileCCode();
}
Program: 74497
Project: 74497
Buggy source:
/** 
 * Add port to the port hashtable.
 * @param name The name of the port.
 * @param value A String representing the port.
 */
public void addPort(String name,String value){
  portHash.put(name,value);
}

Fixed version (ground truth):
/** 
 * Add port to the port hashtable.
 * @param name The name of the port.
 * @param value A String representing the port.
 */
public void addPort(String name,String value) throws IllegalActionException, NameDuplicationException {
  portHash.put(name,value);
  ConfigurableAttribute port=new ConfigurableAttribute(this,"String_Node_Str" + name);
}
Program: 74498
Project: 74498
Buggy source:
/** 
 * Add a property to the property hashtable.
 * @param name The name of the property.
 * @param value A string representing the propety.
 */
public void addProperty(String name,String value){
  propertyHash.put(name,value);
}

Fixed version (ground truth):
/** 
 * Add a property to the property hashtable.
 * @param name The name of the property.
 * @param value A string representing the propety.
 */
public void addProperty(String name,String value) throws NameDuplicationException, IllegalActionException {
  propertyHash.put(name,value);
  ConfigurableAttribute ca=new ConfigurableAttribute(this,"String_Node_Str" + name);
}
Program: 74500
Project: 74500
Buggy source:
private static LibraryAttribute _importActorLibrary(Tableau tableau,LibraryAttribute gtLibrary){
  try {
    Configuration configuration=(Configuration)tableau.toplevel();
    CompositeEntity actorLibrary=(CompositeEntity)configuration.getEntity("String_Node_Str");
    CompositeEntity library=gtLibrary.getLibrary();
    for (    Object entityObject : actorLibrary.entityList()) {
      try {
        ComponentEntity libraryEntity=(ComponentEntity)entityObject;
        ComponentEntity entity=(ComponentEntity)libraryEntity.clone(library.workspace());
        entity.setContainer(library);
      }
 catch (      Exception e) {
      }
    }
    gtLibrary.setLibrary(library);
  }
 catch (  Exception e) {
  }
  return gtLibrary;
}

Fixed version (ground truth):
private static LibraryAttribute _importActorLibrary(Tableau tableau,LibraryAttribute gtLibrary){
  if (gtLibrary != null) {
    try {
      Configuration configuration=(Configuration)tableau.toplevel();
      CompositeEntity actorLibrary=(CompositeEntity)configuration.getEntity("String_Node_Str");
      CompositeEntity library=gtLibrary.getLibrary();
      for (      Object entityObject : actorLibrary.entityList()) {
        try {
          ComponentEntity libraryEntity=(ComponentEntity)entityObject;
          ComponentEntity entity=(ComponentEntity)libraryEntity.clone(library.workspace());
          entity.setContainer(library);
        }
 catch (        Exception e) {
        }
      }
      gtLibrary.setLibrary(library);
    }
 catch (    Exception e) {
    }
  }
  return gtLibrary;
}
Program: 74504
Project: 74504
Buggy source:
public boolean isEnabled(int index){
  return _enablements[index];
}

Fixed version (ground truth):
public boolean isEnabled(int index){
  if (!getElements()[index].canDisable()) {
    return true;
  }
 else {
    return _enablements[index];
  }
}
Program: 74505
Project: 74505
Buggy source:
/** 
 * Look up and return the type of the attribute with the specified name in the scope. Return null if such an attribute does not exist.
 * @return The attribute with the specified name in the scope.
 * @exception IllegalActionException If a value in the scopeexists with the given name, but cannot be evaluated.
 */
public ptolemy.data.type.Type getType(String name) throws IllegalActionException {
  Port port=(Port)_identifierToPort.get(name);
  if ((port != null) && port instanceof Typeable) {
    if (name.endsWith("String_Node_Str")) {
      return BaseType.BOOLEAN;
    }
 else     if (name.endsWith("String_Node_Str")) {
      String portName=name.substring(0,name.length() - 5);
      if (port == _identifierToPort.get(portName)) {
        Type portType=((Typeable)port).getType();
        if (portType instanceof ArrayType) {
          return portType;
        }
 else {
          return new ArrayType(portType);
        }
      }
    }
    return ((Typeable)port).getType();
  }
  Variable result=getScopedVariable(null,FSMActor.this,name);
  if (result != null) {
    return result.getType();
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Look up and return the type of the attribute with the specified name in the scope. Return null if such an attribute does not exist.
 * @return The attribute with the specified name in the scope.
 * @exception IllegalActionException If a value in the scopeexists with the given name, but cannot be evaluated.
 */
public ptolemy.data.type.Type getType(String name) throws IllegalActionException {
  Port port=(Port)_identifierToPort.get(name);
  if ((port != null) && port instanceof Typeable) {
    if (name.endsWith("String_Node_Str")) {
      return BaseType.BOOLEAN;
    }
 else     if (name.endsWith("String_Node_Str")) {
      String portName=name.substring(0,name.length() - 5);
      if (port == _identifierToPort.get(portName)) {
        Type portType=((Typeable)port).getType();
        return new ArrayType(portType);
      }
    }
    return ((Typeable)port).getType();
  }
  Variable result=getScopedVariable(null,FSMActor.this,name);
  if (result != null) {
    return result.getType();
  }
 else {
    return null;
  }
}
Program: 74506
Project: 74506
Buggy source:
/** 
 * Look up and return the type of the attribute with the specified name in the scope. Return null if such an attribute does not exist.
 * @return The attribute with the specified name in the scope.
 * @exception IllegalActionException If a value in the scopeexists with the given name, but cannot be evaluated.
 */
public ptolemy.data.type.Type getType(String name) throws IllegalActionException {
  Port port=(Port)_identifierToPort.get(name);
  if ((port != null) && port instanceof Typeable) {
    return ((Typeable)port).getType();
  }
  Variable result=getScopedVariable(null,FSMActor.this,name);
  if (result != null) {
    return result.getType();
  }
 else {
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Look up and return the type of the attribute with the specified name in the scope. Return null if such an attribute does not exist.
 * @return The attribute with the specified name in the scope.
 * @exception IllegalActionException If a value in the scopeexists with the given name, but cannot be evaluated.
 */
public ptolemy.data.type.Type getType(String name) throws IllegalActionException {
  Port port=(Port)_identifierToPort.get(name);
  if ((port != null) && port instanceof Typeable) {
    if (name.endsWith("String_Node_Str")) {
      return BaseType.BOOLEAN;
    }
 else     if (name.endsWith("String_Node_Str")) {
      String portName=name.substring(0,name.length() - 5);
      if (port == _identifierToPort.get(portName)) {
        Type portType=((Typeable)port).getType();
        if (portType instanceof ArrayType) {
          return portType;
        }
 else {
          return new ArrayType(portType);
        }
      }
    }
    return ((Typeable)port).getType();
  }
  Variable result=getScopedVariable(null,FSMActor.this,name);
  if (result != null) {
    return result.getType();
  }
 else {
    return null;
  }
}
Program: 74507
Project: 74507
Buggy source:
public NamedObjVariable(NamedObj container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  setToken(new NamedObjToken(container));
  setPersistent(false);
}

Fixed version (ground truth):
public NamedObjVariable(NamedObj container,String name) throws IllegalActionException, NameDuplicationException {
  super(container,name);
  setToken(new NamedObjToken(container));
  _setTokenWithContainer=true;
  setPersistent(false);
}
Program: 74508
Project: 74508
Buggy source:
private File[] _getModelFiles(){
  TransformationRule rule=getTransformationRule();
  Pattern pattern=rule.getPattern();
  DefaultDirectoryAttribute attribute=(DefaultDirectoryAttribute)pattern.getAttribute("String_Node_Str");
  File directoryFile=null;
  String fileFilter="String_Node_Str";
  boolean subdirs=true;
  if (attribute != null) {
    try {
      directoryFile=attribute.directory.asFile();
      fileFilter=attribute.fileFilter.getExpression();
      subdirs=((BooleanToken)attribute.subdirs.getToken()).booleanValue();
    }
 catch (    IllegalActionException e) {
      throw new KernelRuntimeException(e,"String_Node_Str" + "String_Node_Str");
    }
  }
  if (directoryFile == null) {
    ComponentDialog dialog=new ComponentDialog(GTRuleGraphFrame.this,"String_Node_Str",new Configurer(_attribute));
    if (dialog.buttonPressed().equalsIgnoreCase("String_Node_Str")) {
      try {
        directoryFile=_attribute.directory.asFile();
        fileFilter=_attribute.fileFilter.getExpression();
        subdirs=((BooleanToken)_attribute.subdirs.getToken()).booleanValue();
      }
 catch (      IllegalActionException e) {
        throw new KernelRuntimeException(e,"String_Node_Str" + "String_Node_Str");
      }
    }
  }
  if (directoryFile != null && !directoryFile.exists()) {
    MessageHandler.error("String_Node_Str" + directoryFile.getPath() + "String_Node_Str");
    return null;
  }
  File[] files=_listFiles(directoryFile,subdirs,fileFilter);
  return files;
}

Fixed version (ground truth):
private File[] _getModelFiles(){
  TransformationRule rule=getTransformationRule();
  Pattern pattern=rule.getPattern();
  DefaultDirectoryAttribute attribute=(DefaultDirectoryAttribute)pattern.getAttribute("String_Node_Str");
  File directoryFile=null;
  String fileFilter="String_Node_Str";
  boolean subdirs=true;
  if (attribute != null) {
    try {
      directoryFile=attribute.directory.asFile();
      fileFilter=attribute.fileFilter.getExpression();
      subdirs=((BooleanToken)attribute.subdirs.getToken()).booleanValue();
    }
 catch (    IllegalActionException e) {
      throw new KernelRuntimeException(e,"String_Node_Str" + "String_Node_Str");
    }
  }
  if (directoryFile == null) {
    ComponentDialog dialog=new ComponentDialog(GTRuleGraphFrame.this,"String_Node_Str",new Configurer(_attribute));
    if (dialog.buttonPressed().equalsIgnoreCase("String_Node_Str")) {
      try {
        directoryFile=_attribute.directory.asFile();
        fileFilter=_attribute.fileFilter.getExpression();
        subdirs=((BooleanToken)_attribute.subdirs.getToken()).booleanValue();
      }
 catch (      IllegalActionException e) {
        throw new KernelRuntimeException(e,"String_Node_Str" + "String_Node_Str");
      }
    }
  }
  if (directoryFile != null && !directoryFile.exists()) {
    MessageHandler.error("String_Node_Str" + directoryFile.getPath() + "String_Node_Str");
    return null;
  }
  if (directoryFile == null) {
    return null;
  }
 else {
    File[] files=_listFiles(directoryFile,subdirs,fileFilter);
    return files;
  }
}
Program: 74509
Project: 74509
Buggy source:
/** 
 * Mark the contents of this object as being derived objects. Specifically, the derivation depth of the immediately contained objects is set to one greater than the <i>depth</i> argument, and then this method is called on that object with an argument one greater than the <i>depth</i> argument. For the contained objects, this will also cancel any previous call to setPersistent(true), since it's a derived object.
 * @param depth The derivation depth for this object, whichshould be 0 except on recursive calls.
 * @see #setDerivedLevel(int)
 */
protected void _markContentsDerived(int depth){
  depth=depth + 1;
  Iterator objects=containedObjectsIterator();
  while (objects.hasNext()) {
    NamedObj containedObject=(NamedObj)objects.next();
    containedObject.setDerivedLevel(depth);
    containedObject._markContentsDerived(depth);
    if ((containedObject._isPersistent != null) && containedObject._isPersistent.booleanValue()) {
      containedObject._isPersistent=null;
    }
  }
}

Fixed version (ground truth):
/** 
 * Mark the contents of this object as being derived objects. Specifically, the derivation depth of the immediately contained objects is set to one greater than the <i>depth</i> argument, and then this method is called on that object with an argument one greater than the <i>depth</i> argument. For the contained objects, this will also cancel any previous call to setPersistent(true), since it's a derived object.
 * @param depth The derivation depth for this object, whichshould be 0 except on recursive calls.
 * @see #setDerivedLevel(int)
 */
protected void _markContentsDerived(int depth){
  depth=depth + 1;
  Iterator objects=containedObjectsIterator();
  while (objects.hasNext()) {
    NamedObj containedObject=(NamedObj)objects.next();
    if (depth < containedObject._derivedLevel) {
      containedObject._derivedLevel=depth;
    }
    containedObject._markContentsDerived(depth);
    if ((containedObject._isPersistent != null) && containedObject._isPersistent.booleanValue()) {
      containedObject._isPersistent=null;
    }
  }
}
Program: 74512
Project: 74512
Buggy source:
/** 
 * Read the input, if there is any, and issue a change request to apply the MoML in the input to the displayed model.
 * @exception IllegalActionException If there is an error readingthe input.
 */
public void fire() throws IllegalActionException {
  super.fire();
  for (int i=0; i < input.getWidth(); i++) {
    if (input.hasToken(i)) {
      if (_tableaus[i] != null) {
        _tableaus[i].close();
        _tableaus[i]=null;
      }
      Entity model=((ActorToken)input.get(0)).getEntity();
      Configuration configuration=(Configuration)Configuration.findEffigy(toplevel()).toplevel();
      try {
        _parser.reset();
        NamedObj newModel=_parser.parse(model.exportMoML());
        _tableaus[i]=configuration.openModel(newModel);
      }
 catch (      NameDuplicationException e) {
        throw new IllegalActionException(this,e,"String_Node_Str");
      }
catch (      Exception e) {
        throw new IllegalActionException(this,e,"String_Node_Str");
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Read the input, if there is any, and issue a change request to apply the MoML in the input to the displayed model.
 * @exception IllegalActionException If there is an error readingthe input.
 */
public void fire() throws IllegalActionException {
  super.fire();
  for (int i=0; i < input.getWidth(); i++) {
    if (input.hasToken(i)) {
synchronized (this) {
        if (_tableaus[i] != null) {
          _tableaus[i].close();
          _tableaus[i]=null;
        }
        Entity model=((ActorToken)input.get(0)).getEntity();
        Configuration configuration=(Configuration)Configuration.findEffigy(toplevel()).toplevel();
        try {
          _parser.reset();
          NamedObj newModel=_parser.parse(model.exportMoML());
          _tableaus[i]=configuration.openModel(newModel);
          _tableaus[i].getFrame().addWindowListener(this);
        }
 catch (        NameDuplicationException e) {
          throw new IllegalActionException(this,e,"String_Node_Str");
        }
catch (        Exception e) {
          throw new IllegalActionException(this,e,"String_Node_Str");
        }
      }
    }
  }
}
Program: 74513
Project: 74513
Buggy source:
public void initialize() throws IllegalActionException {
  super.initialize();
  if (_tableaus != null) {
    for (    Tableau tableau : _tableaus) {
      if (tableau != null) {
        tableau.close();
      }
    }
  }
  _tableaus=new Tableau[input.getWidth()];
}

Fixed version (ground truth):
public void initialize() throws IllegalActionException {
  super.initialize();
synchronized (this) {
    if (_tableaus != null) {
      for (      Tableau tableau : _tableaus) {
        if (tableau != null) {
          tableau.close();
        }
      }
    }
    _tableaus=new Tableau[input.getWidth()];
  }
}
Program: 74514
Project: 74514
Buggy source:
private void _removeObjects(CompositeEntity replacement,CompositeEntity host) throws TransformationException {
  List<NamedObj> childrenToRemove=new LinkedList<NamedObj>();
  boolean boxingRemoved=true;
  while (boxingRemoved) {
    Collection<?> children=_getChildren(host,false,false,true,true);
    childrenToRemove.clear();
    for (    Object childObject : children) {
      NamedObj child=(NamedObj)childObject;
      NamedObj replacementChild=(NamedObj)_replacementToHost.getKey(child);
      if (childObject instanceof CompositeEntity) {
        if (replacementChild == null && _matchResult.containsValue(child) || replacementChild != null && replacementChild.getContainer() != replacement) {
          childrenToRemove.add(child);
        }
      }
    }
    for (    NamedObj child : childrenToRemove) {
      _removeObject(child);
    }
    boxingRemoved=childrenToRemove.size() > 0;
  }
  Collection<?> children=_getChildren(host,false,false,true,true);
  childrenToRemove.clear();
  for (  Object childObject : children) {
    NamedObj child=(NamedObj)childObject;
    NamedObj replacementChild=(NamedObj)_replacementToHost.getKey(child);
    if (!(childObject instanceof CompositeEntity)) {
      if (replacementChild == null && _matchResult.containsValue(child) || replacementChild != null && replacementChild.getContainer() != replacement) {
        childrenToRemove.add(child);
      }
    }
  }
  for (  NamedObj child : childrenToRemove) {
    _removeObject(child);
  }
}

Fixed version (ground truth):
private void _removeObjects(CompositeEntity host) throws TransformationException {
  CompositeEntity replacement=(CompositeEntity)_replacementToHost.getKey(host);
  Collection<?> children=_getChildren(host,false,false,true,true);
  List<NamedObj> childrenToRemove=new LinkedList<NamedObj>();
  Set<NamedObj> newChildren=new HashSet<NamedObj>();
  while (!children.isEmpty()) {
    childrenToRemove.clear();
    for (    Object childObject : children) {
      NamedObj child=(NamedObj)childObject;
      NamedObj replacementChild=(NamedObj)_replacementToHost.getKey(child);
      if (replacementChild == null && _matchResult.containsValue(child) || replacementChild != null && replacementChild.getContainer() != replacement) {
        childrenToRemove.add(child);
      }
    }
    newChildren.clear();
    for (    NamedObj child : childrenToRemove) {
      Set<NamedObj> newlyAddedChildren=_removeObject(child);
      if (newlyAddedChildren != null) {
        newChildren.addAll(newlyAddedChildren);
      }
    }
    children=newChildren;
  }
  for (  Object compositeChild : host.entityList(CompositeEntity.class)) {
    _removeObjects((CompositeEntity)compositeChild);
  }
}
Program: 74515
Project: 74515
Buggy source:
private void _initPatternToReplacement(NamedObj replacement){
  NamedObj pattern=GTTools.getCorrespondingPatternObject(replacement);
  if (pattern != null) {
    _patternToReplacement.put(pattern,replacement);
    if (pattern instanceof Entity && replacement instanceof Entity) {
      Entity patternEntity=(Entity)pattern;
      Entity replacementEntity=(Entity)replacement;
      List<?> patternPortList=patternEntity.portList();
      List<?> replacementPortList=replacementEntity.portList();
      for (int i=0; i < patternPortList.size(); i++) {
        Port patternPort=(Port)patternPortList.get(i);
        Port replacementPort=(Port)replacementPortList.get(i);
        _patternToReplacement.put(patternPort,replacementPort);
      }
    }
  }
  Collection<?> children=_getChildren(replacement,false,false,true,true);
  for (  Object child : children) {
    _initPatternToReplacement((NamedObj)child);
  }
}

Fixed version (ground truth):
private void _initPatternToReplacement(NamedObj replacement){
  NamedObj pattern;
  if (replacement == _replacement) {
    pattern=_pattern;
  }
 else {
    pattern=GTTools.getCorrespondingPatternObject(replacement);
  }
  if (pattern != null) {
    _patternToReplacement.put(pattern,replacement);
    if (pattern instanceof Entity && replacement instanceof Entity) {
      Entity patternEntity=(Entity)pattern;
      Entity replacementEntity=(Entity)replacement;
      List<?> patternPortList=patternEntity.portList();
      List<?> replacementPortList=replacementEntity.portList();
      for (int i=0; i < patternPortList.size(); i++) {
        Port patternPort=(Port)patternPortList.get(i);
        Port replacementPort=(Port)replacementPortList.get(i);
        _patternToReplacement.put(patternPort,replacementPort);
      }
    }
  }
  Collection<?> children=_getChildren(replacement,false,false,true,true);
  for (  Object child : children) {
    _initPatternToReplacement((NamedObj)child);
  }
}
Program: 74516
Project: 74516
Buggy source:
protected void _execute() throws TransformationException {
  for (  MatchResult matchResult : _matchResults) {
    _matchResult=matchResult;
    _host=(CompositeEntity)_matchResult.get(_pattern);
    if (_host == null) {
      throw new TransformationException("String_Node_Str" + "String_Node_Str");
    }
    _init();
    _performOperations();
    _recordMoML();
    _removeObjects();
    _addObjects();
    _addConnections();
    _wrapup();
  }
}

Fixed version (ground truth):
protected void _execute() throws TransformationException {
  for (  MatchResult matchResult : _matchResults) {
    _matchResult=(MatchResult)matchResult.clone();
    _host=(CompositeEntity)_matchResult.get(_pattern);
    if (_host == null) {
      throw new TransformationException("String_Node_Str" + "String_Node_Str");
    }
    _init();
    _performOperations();
    _recordMoML();
    _removeObjects();
    _addObjects();
    _addConnections();
    _hideRelations();
    _wrapup();
  }
}