nus-yam/ex-repair huggingface dataset:
Program: 30307
Project: 30307
Buggy source:
@Override protected void updateModel(String property,String value){
  if (property.equals(DESC_PROP)) {
    doc.setRootAttr(actor,"String_Node_Str",value);
  }
 else   if (property.equals(POS_X_PROP)) {
    Vector2 pos=doc.getPos(actor);
    UndoOp undoOp=new UndoSetAttr(Ctx.project.getSelectedChapter(),Ctx.project.getSelectedActor(),"String_Node_Str",Param.toStringParam(pos));
    Ctx.project.getUndoStack().add(undoOp);
    try {
      pos.x=Float.parseFloat(value);
    }
 catch (    NumberFormatException e) {
    }
    doc.setPos(actor,pos);
  }
 else   if (property.equals(POS_Y_PROP)) {
    Vector2 pos=doc.getPos(actor);
    UndoOp undoOp=new UndoSetAttr(Ctx.project.getSelectedChapter(),Ctx.project.getSelectedActor(),"String_Node_Str",Param.toStringParam(pos));
    Ctx.project.getUndoStack().add(undoOp);
    try {
      pos.y=Float.parseFloat(value);
    }
 catch (    NumberFormatException e) {
    }
    doc.setPos(actor,pos);
  }
 else   if (property.equals(VISIBLE_PROP)) {
    doc.setRootAttr(actor,XMLConstants.VISIBLE_ATTR,value);
  }
 else   if (property.equals(ACTIVE_PROP)) {
    doc.setRootAttr(actor,"String_Node_Str",value);
  }
 else   if (property.equals(STATE_PROP)) {
    doc.setRootAttr(actor,"String_Node_Str",value);
  }
}

Fixed version (ground truth):
@Override protected void updateModel(String property,String value){
  if (property.equals(DESC_PROP)) {
    doc.setRootAttr(actor,XMLConstants.DESC_ATTR,value);
  }
 else   if (property.equals(POS_X_PROP)) {
    Vector2 pos=doc.getPos(actor);
    UndoOp undoOp=new UndoSetAttr(Ctx.project.getSelectedChapter(),Ctx.project.getSelectedActor(),XMLConstants.POS_ATTR,Param.toStringParam(pos));
    Ctx.project.getUndoStack().add(undoOp);
    try {
      pos.x=Float.parseFloat(value);
    }
 catch (    NumberFormatException e) {
    }
    doc.setPos(actor,pos);
  }
 else   if (property.equals(POS_Y_PROP)) {
    Vector2 pos=doc.getPos(actor);
    UndoOp undoOp=new UndoSetAttr(Ctx.project.getSelectedChapter(),Ctx.project.getSelectedActor(),XMLConstants.POS_ATTR,Param.toStringParam(pos));
    Ctx.project.getUndoStack().add(undoOp);
    try {
      pos.y=Float.parseFloat(value);
    }
 catch (    NumberFormatException e) {
    }
    doc.setPos(actor,pos);
  }
 else   if (property.equals(VISIBLE_PROP)) {
    doc.setRootAttr(actor,XMLConstants.VISIBLE_ATTR,value);
  }
 else   if (property.equals(INTERACTION_PROP)) {
    doc.setRootAttr(actor,XMLConstants.INTERACTION_ATTR,value);
  }
 else   if (property.equals(STATE_PROP)) {
    doc.setRootAttr(actor,XMLConstants.STATE_ATTR,value);
  }
 else   if (property.equals(BBOX_FROM_RENDERER_PROP)) {
    boolean v=true;
    try {
      v=Boolean.parseBoolean(value);
    }
 catch (    ParseException e) {
    }
    if (v)     doc.setBbox(actor,null);
 else     doc.setRootAttr(actor,XMLConstants.BBOX_ATTR,null);
  }
}
Program: 30308
Project: 30308
Buggy source:
public void setActorDocument(ChapterDocument doc,Element a){
  this.doc=doc;
  this.actor=a;
  clearProps();
  if (a != null) {
    Vector2 pos=doc.getPos(a);
    addProperty(POS_X_PROP,Float.toString(pos.x),Types.FLOAT);
    addProperty(POS_Y_PROP,Float.toString(pos.y),Types.FLOAT);
    addProperty(VISIBLE_PROP,doc.getRootAttr(a,XMLConstants.VISIBLE_ATTR),Types.BOOLEAN);
    if (!a.getAttribute(XMLConstants.TYPE_ATTR).equals(XMLConstants.OBSTACLE_VALUE)) {
      addProperty(DESC_PROP,doc.getRootAttr(a,"String_Node_Str"));
      addProperty(ACTIVE_PROP,doc.getRootAttr(a,"String_Node_Str"),Types.BOOLEAN);
      addProperty(STATE_PROP,doc.getRootAttr(a,"String_Node_Str"));
    }
    doc.addPropertyChangeListener(propertyChangeListener);
    invalidateHierarchy();
  }
}

Fixed version (ground truth):
public void setActorDocument(ChapterDocument doc,Element a){
  this.doc=doc;
  this.actor=a;
  clearProps();
  if (a != null) {
    Vector2 pos=doc.getPos(a);
    addProperty(POS_X_PROP,Float.toString(pos.x),Types.FLOAT);
    addProperty(POS_Y_PROP,Float.toString(pos.y),Types.FLOAT);
    addProperty(VISIBLE_PROP,doc.getRootAttr(a,XMLConstants.VISIBLE_ATTR),Types.BOOLEAN);
    if (!a.getAttribute(XMLConstants.TYPE_ATTR).equals(XMLConstants.OBSTACLE_VALUE)) {
      addProperty(DESC_PROP,doc.getRootAttr(a,XMLConstants.DESC_ATTR));
      addProperty(INTERACTION_PROP,doc.getRootAttr(a,XMLConstants.INTERACTION_ATTR),Types.BOOLEAN);
      addProperty(STATE_PROP,doc.getRootAttr(a,XMLConstants.STATE_ATTR));
    }
    if (a.getAttribute(XMLConstants.TYPE_ATTR).equals(XMLConstants.SPRITE_VALUE)) {
      boolean v=doc.getRootAttr(a,XMLConstants.BBOX_ATTR) == null;
      addProperty(BBOX_FROM_RENDERER_PROP,Boolean.toString(v),Types.BOOLEAN);
    }
    doc.addPropertyChangeListener(propertyChangeListener);
    invalidateHierarchy();
  }
}
Program: 30309
Project: 30309
Buggy source:
@Override public void propertyChange(PropertyChangeEvent evt){
  EditorLogger.debug("String_Node_Str" + evt.getPropertyName());
  setActorDocument(doc,actor);
}

Fixed version (ground truth):
@Override public void propertyChange(PropertyChangeEvent evt){
  EditorLogger.debug("String_Node_Str" + evt.getPropertyName());
  updateField(evt.getPropertyName());
}
Program: 30310
Project: 30310
Buggy source:
public void setSceneDocument(ChapterDocument doc,Element scn){
  this.scn=scn;
  this.doc=doc;
  clearProps();
  if (scn != null) {
    addProperty(MUSIC_PROP,doc.getMusic(scn));
    addProperty(LOOP_MUSIC_PROP,doc.getRootAttr(scn,"String_Node_Str"),Types.BOOLEAN);
    addProperty(INITIAL_MUSIC_DELAY_PROP,doc.getRootAttr(scn,"String_Node_Str"),Types.FLOAT);
    addProperty(REPEAT_MUSIC_DELAY_PROP,doc.getRootAttr(scn,"String_Node_Str"),Types.FLOAT);
    this.doc.addPropertyChangeListener("String_Node_Str",propertyChangeListener);
    invalidateHierarchy();
  }
}

Fixed version (ground truth):
public void setSceneDocument(ChapterDocument doc,Element scn){
  this.scn=scn;
  this.doc=doc;
  clearProps();
  if (scn != null) {
    addProperty(MUSIC_PROP,doc.getMusic(scn));
    addProperty(LOOP_MUSIC_PROP,doc.getRootAttr(scn,XMLConstants.LOOP_MUSIC_ATTR),Types.BOOLEAN);
    addProperty(INITIAL_MUSIC_DELAY_PROP,doc.getRootAttr(scn,XMLConstants.INITIAL_MUSIC_DELAY_ATTR),Types.FLOAT);
    addProperty(REPEAT_MUSIC_DELAY_PROP,doc.getRootAttr(scn,XMLConstants.REPEAT_MUSIC_DELAY_ATTR),Types.FLOAT);
    this.doc.addPropertyChangeListener("String_Node_Str",propertyChangeListener);
    invalidateHierarchy();
  }
}
Program: 30311
Project: 30311
Buggy source:
@Override protected void updateModel(String property,String value){
  if (property.equals(MUSIC_PROP)) {
    doc.setRootAttr(scn,"String_Node_Str",value);
  }
 else   if (property.equals(LOOP_MUSIC_PROP)) {
    doc.setRootAttr(scn,"String_Node_Str",value);
  }
 else   if (property.equals(INITIAL_MUSIC_DELAY_PROP)) {
    doc.setRootAttr(scn,"String_Node_Str",value);
  }
 else   if (property.equals(REPEAT_MUSIC_DELAY_PROP)) {
    doc.setRootAttr(scn,"String_Node_Str",value);
  }
}

Fixed version (ground truth):
@Override protected void updateModel(String property,String value){
  if (property.equals(MUSIC_PROP)) {
    doc.setRootAttr(scn,"String_Node_Str",value);
  }
 else   if (property.equals(LOOP_MUSIC_PROP)) {
    doc.setRootAttr(scn,XMLConstants.LOOP_MUSIC_ATTR,value);
  }
 else   if (property.equals(INITIAL_MUSIC_DELAY_PROP)) {
    doc.setRootAttr(scn,XMLConstants.INITIAL_MUSIC_DELAY_ATTR,value);
  }
 else   if (property.equals(REPEAT_MUSIC_DELAY_PROP)) {
    doc.setRootAttr(scn,XMLConstants.REPEAT_MUSIC_DELAY_ATTR,value);
  }
}
Program: 30312
Project: 30312
Buggy source:
@Override public void keyTyped(TextField actor,char c){
  updateModel(actor.getName(),((TextField)actor).getText());
}

Fixed version (ground truth):
@Override public void keyTyped(TextField actor,char c){
}
Program: 30313
Project: 30313
Buggy source:
private void typeChanged(){
  int i=((OptionsInputPanel)typePanel).getSelectedIndex();
  setInfo(TYPES_INFO[i]);
  hideAllInputs();
  if (!ChapterDocument.ACTOR_TYPES[i].equals(XMLConstants.OBSTACLE_VALUE)) {
    setVisible(inputs[4],true);
    setVisible(inputs[5],true);
    setVisible(inputs[6],true);
  }
  if (ChapterDocument.ACTOR_TYPES[i].equals(XMLConstants.SPRITE_VALUE) || ChapterDocument.ACTOR_TYPES[i].equals(XMLConstants.CHARACTER_VALUE)) {
    setVisible(inputs[7],true);
    setVisible(inputs[8],true);
    setVisible(inputs[9],true);
    setVisible(inputs[10],true);
  }
  if (ChapterDocument.ACTOR_TYPES[i].equals(XMLConstants.CHARACTER_VALUE)) {
    setVisible(inputs[11],true);
  }
  rendererChanged();
}

Fixed version (ground truth):
private void typeChanged(){
  int i=((OptionsInputPanel)typePanel).getSelectedIndex();
  setInfo(TYPES_INFO[i]);
  hideAllInputs();
  if (!ChapterDocument.ACTOR_TYPES[i].equals(XMLConstants.OBSTACLE_VALUE)) {
    setVisible(inputs[4],true);
    setVisible(inputs[5],true);
    setVisible(inputs[6],true);
    setVisible(inputs[10],true);
  }
  if (ChapterDocument.ACTOR_TYPES[i].equals(XMLConstants.SPRITE_VALUE) || ChapterDocument.ACTOR_TYPES[i].equals(XMLConstants.CHARACTER_VALUE)) {
    setVisible(inputs[7],true);
    setVisible(inputs[8],true);
    setVisible(inputs[9],true);
  }
  if (ChapterDocument.ACTOR_TYPES[i].equals(XMLConstants.CHARACTER_VALUE)) {
    setVisible(inputs[11],true);
  }
  rendererChanged();
}
Program: 30315
Project: 30315
Buggy source:
public void setSelectedFA(String selFA){
  if (selectedActor instanceof SpriteActor) {
    ActorRenderer s=((SpriteActor)selectedActor).getRenderer();
    if (selFA == null || s.getAnimations().get(selFA) == null || s.getAnimations().get(AnimationDesc.getFlipId(selFA)) == null) {
      selFA=((SpriteActor)selectedActor).getRenderer().getInitAnimation();
    }
    if (selFA != null && (s.getAnimations().get(selFA) != null || s.getAnimations().get(AnimationDesc.getFlipId(selFA)) != null)) {
      setAnimation(s.getAnimations().get(selFA));
      if (inScene || s.getCurrentAnimation() == null || ((SpriteActor)selectedActor).getRenderer().getInitAnimation().equals(selFA)) {
        try {
          ((SpriteActor)selectedActor).startAnimation(selFA,Tween.Type.REPEAT,Tween.INFINITY,null);
        }
 catch (        Exception e) {
          setAnimation(null);
          ((SpriteActor)selectedActor).getRenderer().getAnimations().remove(selFA);
        }
      }
    }
 else {
      setAnimation(null);
    }
  }
 else {
    setAnimation(null);
  }
}

Fixed version (ground truth):
public void setSelectedFA(String selFA){
  if (selectedActor instanceof SpriteActor) {
    ActorRenderer s=((SpriteActor)selectedActor).getRenderer();
    if (selFA == null || (s.getAnimations().get(selFA) == null && s.getAnimations().get(AnimationDesc.getFlipId(selFA)) == null)) {
      selFA=((SpriteActor)selectedActor).getRenderer().getInitAnimation();
    }
    if (selFA != null && (s.getAnimations().get(selFA) != null || s.getAnimations().get(AnimationDesc.getFlipId(selFA)) != null)) {
      setAnimation(s.getAnimations().get(selFA));
      if (inScene || s.getCurrentAnimation() == null || ((SpriteActor)selectedActor).getRenderer().getInitAnimation().equals(selFA)) {
        try {
          ((SpriteActor)selectedActor).startAnimation(selFA,Tween.Type.REPEAT,Tween.INFINITY,null);
        }
 catch (        Exception e) {
          setAnimation(null);
          ((SpriteActor)selectedActor).getRenderer().getAnimations().remove(selFA);
        }
      }
    }
 else {
      setAnimation(null);
    }
  }
 else {
    setAnimation(null);
  }
}
Program: 30317
Project: 30317
Buggy source:
private String[] getSources(){
  String path=null;
  String renderer=parent.getAttribute(XMLConstants.RENDERER_ATTR);
  if (renderer.equals(XMLConstants.ATLAS_VALUE)) {
    path=Ctx.project.getProjectPath() + Project.ATLASES_PATH + "String_Node_Str"+ Ctx.project.getResDir();
    ext="String_Node_Str";
  }
 else   if (renderer.equals(XMLConstants.S3D_VALUE)) {
    path=Ctx.project.getProjectPath() + Project.SPRITE3D_PATH;
    ext="String_Node_Str";
  }
 else   if (renderer.equals(XMLConstants.SPINE_VALUE)) {
    path=Ctx.project.getProjectPath() + Project.SPINE_PATH;
    ext="String_Node_Str";
  }
 else   if (renderer.equals(XMLConstants.IMAGE_VALUE)) {
    path=Ctx.project.getProjectPath() + Project.IMAGE_PATH + "String_Node_Str"+ Ctx.project.getResDir();
    ext="String_Node_Str";
  }
  File f=new File(path);
  String sources[]=f.list(new FilenameFilter(){
    @Override public boolean accept(    File arg0,    String arg1){
      if (arg1.endsWith(ext))       return true;
      return false;
    }
  }
);
  if (sources != null) {
    Arrays.sort(sources);
    for (int i=0; i < sources.length; i++)     sources[i]=sources[i].substring(0,sources[i].length() - ext.length());
  }
 else {
    sources=new String[0];
  }
  return sources;
}

Fixed version (ground truth):
private String[] getSources(){
  String path=null;
  String renderer=parent.getAttribute(XMLConstants.RENDERER_ATTR);
  if (renderer.equals(XMLConstants.ATLAS_VALUE)) {
    path=Ctx.project.getProjectPath() + Project.ATLASES_PATH + "String_Node_Str"+ Ctx.project.getResDir();
    ext=ATLAS_EXT;
  }
 else   if (renderer.equals(XMLConstants.S3D_VALUE)) {
    path=Ctx.project.getProjectPath() + Project.SPRITE3D_PATH;
    ext=G3DB_EXT;
  }
 else   if (renderer.equals(XMLConstants.SPINE_VALUE)) {
    path=Ctx.project.getProjectPath() + Project.SPINE_PATH;
    ext=SPINE_EXT;
  }
 else   if (renderer.equals(XMLConstants.IMAGE_VALUE)) {
    path=Ctx.project.getProjectPath() + Project.IMAGE_PATH + "String_Node_Str"+ Ctx.project.getResDir();
    ext="String_Node_Str";
  }
  File f=new File(path);
  String sources[]=f.list(new FilenameFilter(){
    @Override public boolean accept(    File arg0,    String arg1){
      if (arg1.endsWith(ext))       return true;
      return false;
    }
  }
);
  if (sources != null) {
    Arrays.sort(sources);
    for (int i=0; i < sources.length; i++)     sources[i]=sources[i].substring(0,sources[i].length() - ext.length());
  }
 else {
    sources=new String[0];
  }
  return sources;
}
Program: 30318
Project: 30318
Buggy source:
@Override public String getText(){
  return input.getSelected();
}

Fixed version (ground truth):
@Override public String getText(){
  return input.getSelected() == null ? "String_Node_Str" : input.getSelected();
}
Program: 30320
Project: 30320
Buggy source:
@Override public void write(Json json){
  json.writeValue("String_Node_Str",fanims,HashMap.class,AnimationDesc.class);
  String currentAnimationId=null;
  if (currentAnimation != null)   currentAnimationId=currentAnimation.id;
  json.writeValue("String_Node_Str",currentAnimationId,currentAnimationId == null ? null : String.class);
  json.writeValue("String_Node_Str",initAnimation);
  json.writeValue("String_Node_Str",flipX);
  if (animationCbSer != null)   json.writeValue("String_Node_Str",animationCbSer);
 else   json.writeValue("String_Node_Str",ActionCallbackSerialization.find(animationCb),animationCb == null ? null : String.class);
  json.writeValue("String_Node_Str",currentCount);
  json.writeValue("String_Node_Str",currentAnimationType.getTweenId());
  json.writeValue("String_Node_Str",lastAnimationTime);
  json.writeValue("String_Node_Str",complete);
}

Fixed version (ground truth):
@Override public void write(Json json){
  json.writeValue("String_Node_Str",fanims,HashMap.class,AnimationDesc.class);
  String currentAnimationId=null;
  if (currentAnimation != null)   currentAnimationId=currentAnimation.id;
  json.writeValue("String_Node_Str",currentAnimationId,currentAnimationId == null ? null : String.class);
  json.writeValue("String_Node_Str",initAnimation);
  json.writeValue("String_Node_Str",flipX);
  if (animationCbSer != null)   json.writeValue("String_Node_Str",animationCbSer);
 else   json.writeValue("String_Node_Str",ActionCallbackSerialization.find(animationCb),animationCb == null ? null : String.class);
  json.writeValue("String_Node_Str",currentCount);
  if (currentAnimationId != null)   json.writeValue("String_Node_Str",currentAnimationType.getTweenId());
  json.writeValue("String_Node_Str",lastAnimationTime);
  json.writeValue("String_Node_Str",complete);
}
Program: 30321
Project: 30321
Buggy source:
@SuppressWarnings("String_Node_Str") @Override public void read(Json json,JsonValue jsonData){
  fanims=json.readValue("String_Node_Str",HashMap.class,AnimationDesc.class,jsonData);
  String currentAnimationId=json.readValue("String_Node_Str",String.class,jsonData);
  if (currentAnimationId != null)   currentAnimation=fanims.get(currentAnimationId);
  initAnimation=json.readValue("String_Node_Str",String.class,jsonData);
  flipX=json.readValue("String_Node_Str",Boolean.class,jsonData);
  animationCbSer=json.readValue("String_Node_Str",String.class,jsonData);
  currentCount=json.readValue("String_Node_Str",Integer.class,jsonData);
  currentAnimationType=Tween.Type.fromTweenId(json.readValue("String_Node_Str",Integer.class,jsonData));
  lastAnimationTime=json.readValue("String_Node_Str",Float.class,jsonData);
  complete=json.readValue("String_Node_Str",Boolean.class,jsonData);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") @Override public void read(Json json,JsonValue jsonData){
  fanims=json.readValue("String_Node_Str",HashMap.class,AnimationDesc.class,jsonData);
  String currentAnimationId=json.readValue("String_Node_Str",String.class,jsonData);
  if (currentAnimationId != null)   currentAnimation=fanims.get(currentAnimationId);
  initAnimation=json.readValue("String_Node_Str",String.class,jsonData);
  flipX=json.readValue("String_Node_Str",Boolean.class,jsonData);
  animationCbSer=json.readValue("String_Node_Str",String.class,jsonData);
  currentCount=json.readValue("String_Node_Str",Integer.class,jsonData);
  if (currentAnimationId != null)   currentAnimationType=Tween.Type.fromTweenId(json.readValue("String_Node_Str",Integer.class,jsonData));
  lastAnimationTime=json.readValue("String_Node_Str",Float.class,jsonData);
  complete=json.readValue("String_Node_Str",Boolean.class,jsonData);
}
Program: 30322
Project: 30322
Buggy source:
@Override public void setParams(HashMap<String,String> params){
  actor=params.get("String_Node_Str");
  if (params.get("String_Node_Str") != null) {
    pos=Param.parseVector2(params.get("String_Node_Str"));
  }
 else   if (params.get("String_Node_Str") != null) {
    target=params.get("String_Node_Str");
    if (anchor == null) {
      anchor=Anchor.CENTER;
    }
 else {
      anchor=Anchor.valueOf(params.get("String_Node_Str").toUpperCase());
    }
    distance=Param.parseVector2(params.get("String_Node_Str"));
    if (distance == null)     distance=new Vector2();
  }
  if (params.get("String_Node_Str") != null) {
    wait=Boolean.parseBoolean(params.get("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Override public void setParams(HashMap<String,String> params){
  actor=params.get("String_Node_Str");
  if (params.get("String_Node_Str") != null) {
    pos=Param.parseVector2(params.get("String_Node_Str"));
  }
 else   if (params.get("String_Node_Str") != null) {
    target=params.get("String_Node_Str");
    if (params.get("String_Node_Str") == null) {
      anchor=Anchor.CENTER;
    }
 else {
      anchor=Anchor.valueOf(params.get("String_Node_Str").toUpperCase());
    }
    distance=Param.parseVector2(params.get("String_Node_Str"));
    if (distance == null)     distance=new Vector2();
  }
  if (params.get("String_Node_Str") != null) {
    wait=Boolean.parseBoolean(params.get("String_Node_Str"));
  }
}
Program: 30323
Project: 30323
Buggy source:
@Override public boolean run(ActionCallback cb){
  Scene scn=this.sceneActorRef.getScene();
  InteractiveActor actor=(InteractiveActor)scn.getActor(this.sceneActorRef.getActorId(),false);
  if (this.sceneActorRef.getSceneId() != null) {
    actor.loadAssets();
    EngineAssetManager.getInstance().finishLoading();
    actor.retrieveAssets();
  }
  scn.removeActor(actor);
  if (actor instanceof SpriteActor) {
    SpriteActor a=(SpriteActor)actor;
    if (animation != null)     a.startAnimation(animation,null);
 else     if (a.getRenderer().getAnimations().get(a.getId() + "String_Node_Str") != null)     a.startAnimation(a.getId() + "String_Node_Str",null);
    World.getInstance().getInventory().addItem(a);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean run(ActionCallback cb){
  Scene scn=this.sceneActorRef.getScene();
  InteractiveActor actor=(InteractiveActor)scn.getActor(this.sceneActorRef.getActorId(),false);
  scn.removeActor(actor);
  if (scn != World.getInstance().getCurrentScene()) {
    actor.loadAssets();
    EngineAssetManager.getInstance().finishLoading();
    actor.retrieveAssets();
  }
  if (actor instanceof SpriteActor) {
    SpriteActor a=(SpriteActor)actor;
    if (animation != null)     a.startAnimation(animation,null);
 else     if (a.getRenderer().getAnimations().get(a.getId() + "String_Node_Str") != null)     a.startAnimation(a.getId() + "String_Node_Str",null);
    World.getInstance().getInventory().addItem(a);
  }
  return false;
}
Program: 30324
Project: 30324
Buggy source:
@Override public boolean run(ActionCallback cb){
  float scale=EngineAssetManager.getInstance().getScale();
  BaseActor actor=World.getInstance().getCurrentScene().getActor(actorId,false);
  if (speed == 0 || !(actor instanceof SpriteActor)) {
    actor.setPosition(pos.x * scale,pos.y * scale);
    return false;
  }
 else {
    float s;
    if (mode != null && mode.equals("String_Node_Str")) {
      Vector2 p0=new Vector2(actor.getX(),actor.getY());
      s=p0.dst(pos.x * scale,pos.y * scale) / (scale * speed);
    }
 else {
      s=speed;
    }
    ((SpriteActor)actor).startPosAnimation(repeat,count,s,pos.x * scale,pos.y * scale,interpolation,wait ? cb : null);
  }
  return wait;
}

Fixed version (ground truth):
@Override public boolean run(ActionCallback cb){
  float scale=EngineAssetManager.getInstance().getScale();
  BaseActor actor=World.getInstance().getCurrentScene().getActor(actorId,false);
  if (speed == 0 || !(actor instanceof SpriteActor)) {
    actor.setPosition(pos.x * scale,pos.y * scale);
    return false;
  }
 else {
    float s;
    if (mode != null && mode == Mode.SPEED) {
      Vector2 p0=new Vector2(actor.getX(),actor.getY());
      s=p0.dst(pos.x * scale,pos.y * scale) / (scale * speed);
    }
 else {
      s=speed;
    }
    ((SpriteActor)actor).startPosAnimation(repeat,count,s,pos.x * scale,pos.y * scale,interpolation,wait ? cb : null);
  }
  return wait;
}
Program: 30325
Project: 30325
Buggy source:
private String[] getMusicList(){
  String path=Ctx.project.getProjectPath() + Project.MUSIC_PATH;
  File f=new File(path);
  String musicFiles[]=f.list(new FilenameFilter(){
    @Override public boolean accept(    File arg0,    String arg1){
      if (arg1.endsWith("String_Node_Str") || arg1.endsWith("String_Node_Str"))       return true;
      return false;
    }
  }
);
  Arrays.sort(musicFiles);
  String musicFiles2[]=new String[musicFiles.length + 1];
  musicFiles2[0]="String_Node_Str";
  for (int i=0; i < musicFiles.length; i++)   musicFiles2[i + 1]=musicFiles[i];
  return musicFiles2;
}

Fixed version (ground truth):
private String[] getMusicList(){
  String path=Ctx.project.getProjectPath() + Project.MUSIC_PATH;
  File f=new File(path);
  String musicFiles[]=f.list(new FilenameFilter(){
    @Override public boolean accept(    File arg0,    String arg1){
      if (arg1.endsWith("String_Node_Str") || arg1.endsWith("String_Node_Str"))       return true;
      return false;
    }
  }
);
  if (musicFiles == null)   return new String[0];
  Arrays.sort(musicFiles);
  String musicFiles2[]=new String[musicFiles.length + 1];
  musicFiles2[0]="String_Node_Str";
  for (int i=0; i < musicFiles.length; i++)   musicFiles2[i + 1]=musicFiles[i];
  return musicFiles2;
}
Program: 30326
Project: 30326
Buggy source:
private void computeBbox(){
  if (bbox.getVertices() == null || bbox.getVertices().length != 8) {
    bbox.setVertices(new float[8]);
  }
  float[] verts=bbox.getVertices();
  verts[0]=-getWidth() / 2;
  verts[1]=0f;
  verts[2]=-getWidth() / 2;
  verts[3]=getHeight();
  verts[4]=getWidth() / 2;
  verts[5]=getHeight();
  verts[6]=getWidth() / 2;
  verts[7]=0f;
  bbox.dirty();
}

Fixed version (ground truth):
private void computeBbox(){
  if (bbox == null)   return;
  if (bbox.getVertices() == null || bbox.getVertices().length != 8) {
    bbox.setVertices(new float[8]);
  }
  float[] verts=bbox.getVertices();
  verts[0]=-getWidth() / 2;
  verts[1]=0f;
  verts[2]=-getWidth() / 2;
  verts[3]=getHeight();
  verts[4]=getWidth() / 2;
  verts[5]=getHeight();
  verts[6]=getWidth() / 2;
  verts[7]=0f;
  bbox.dirty();
}
Program: 30327
Project: 30327
Buggy source:
/** 
 * If 'player' if far from 'actor', we bring it close.  If 'player' is closed from 'actor' do nothing. TODO: DOESN'T WORK NOW
 * @param player
 * @param actor
 */
@SuppressWarnings("String_Node_Str") private void goNear(CharacterActor player,BaseActor actor,ActionCallback cb){
  Rectangle rdest=actor.getBBox().getBoundingRectangle();
  Vector2 p0=new Vector2(player.getX(),player.getY());
  Vector2 p1=new Vector2(rdest.x,rdest.y);
  Vector2 p2=new Vector2(rdest.x + rdest.width,rdest.y);
  Vector2 p3=new Vector2(rdest.x + rdest.width / 2,rdest.y);
  float d1=p0.dst(p1);
  float d2=p0.dst(p2);
  float d3=p0.dst(p3);
  Vector2 pf;
  if (d1 < d2 && d1 < d3) {
    pf=p1;
  }
 else   if (d2 < d1 && d2 < d3) {
    pf=p2;
  }
 else {
    pf=p3;
  }
  player.goTo(pf,cb);
}

Fixed version (ground truth):
/** 
 * If 'player' if far from 'actor', we bring it close. If 'player' is closed from 'actor' do nothing. TODO: DOESN'T WORK NOW
 * @param player
 * @param actor
 */
@SuppressWarnings("String_Node_Str") private void goNear(CharacterActor player,BaseActor actor,ActionCallback cb){
  Rectangle rdest=actor.getBBox().getBoundingRectangle();
  Vector2 p0=new Vector2(player.getX(),player.getY());
  Vector2 p1=new Vector2(rdest.x,rdest.y);
  Vector2 p2=new Vector2(rdest.x + rdest.width,rdest.y);
  Vector2 p3=new Vector2(rdest.x + rdest.width / 2,rdest.y);
  float d1=p0.dst(p1);
  float d2=p0.dst(p2);
  float d3=p0.dst(p3);
  Vector2 pf;
  if (d1 < d2 && d1 < d3) {
    pf=p1;
  }
 else   if (d2 < d1 && d2 < d3) {
    pf=p2;
  }
 else {
    pf=p3;
  }
  player.goTo(pf,cb);
}
Program: 30328
Project: 30328
Buggy source:
@Override public void setParams(HashMap<String,String> params){
  actor=params.get("String_Node_Str");
  if (params.get("String_Node_Str") != null) {
    pos=Param.parseVector2(params.get("String_Node_Str"));
  }
 else   if (params.get("String_Node_Str") != null) {
    target=params.get("String_Node_Str");
    anchor=Anchor.valueOf(params.get("String_Node_Str").toUpperCase());
    if (anchor == null)     anchor=Anchor.CENTER;
    distance=Param.parseVector2(params.get("String_Node_Str"));
    if (distance == null)     distance=new Vector2();
  }
  if (params.get("String_Node_Str") != null) {
    wait=Boolean.parseBoolean(params.get("String_Node_Str"));
  }
}

Fixed version (ground truth):
@Override public void setParams(HashMap<String,String> params){
  actor=params.get("String_Node_Str");
  if (params.get("String_Node_Str") != null) {
    pos=Param.parseVector2(params.get("String_Node_Str"));
  }
 else   if (params.get("String_Node_Str") != null) {
    target=params.get("String_Node_Str");
    if (anchor == null) {
      anchor=Anchor.CENTER;
    }
 else {
      anchor=Anchor.valueOf(params.get("String_Node_Str").toUpperCase());
    }
    distance=Param.parseVector2(params.get("String_Node_Str"));
    if (distance == null)     distance=new Vector2();
  }
  if (params.get("String_Node_Str") != null) {
    wait=Boolean.parseBoolean(params.get("String_Node_Str"));
  }
}
Program: 30329
Project: 30329
Buggy source:
@Override public boolean run(ActionCallback cb){
  Scene scn=this.sceneActorRef.getScene();
  InteractiveActor actor=(InteractiveActor)scn.getActor(this.sceneActorRef.getSceneId(),false);
  if (this.sceneActorRef.getSceneId() != null) {
    actor.loadAssets();
    EngineAssetManager.getInstance().finishLoading();
    actor.retrieveAssets();
  }
  scn.removeActor(actor);
  if (actor instanceof SpriteActor) {
    SpriteActor a=(SpriteActor)actor;
    if (animation != null)     a.startAnimation(animation,null);
 else     if (a.getRenderer().getAnimations().get(a.getId() + "String_Node_Str") != null)     a.startAnimation(a.getId() + "String_Node_Str",null);
    World.getInstance().getInventory().addItem(a);
  }
  return false;
}

Fixed version (ground truth):
@Override public boolean run(ActionCallback cb){
  Scene scn=this.sceneActorRef.getScene();
  InteractiveActor actor=(InteractiveActor)scn.getActor(this.sceneActorRef.getActorId(),false);
  if (this.sceneActorRef.getSceneId() != null) {
    actor.loadAssets();
    EngineAssetManager.getInstance().finishLoading();
    actor.retrieveAssets();
  }
  scn.removeActor(actor);
  if (actor instanceof SpriteActor) {
    SpriteActor a=(SpriteActor)actor;
    if (animation != null)     a.startAnimation(animation,null);
 else     if (a.getRenderer().getAnimations().get(a.getId() + "String_Node_Str") != null)     a.startAnimation(a.getId() + "String_Node_Str",null);
    World.getInstance().getInventory().addItem(a);
  }
  return false;
}
Program: 30330
Project: 30330
Buggy source:
@Override public void setParams(HashMap<String,String> params){
  actorId=params.get("String_Node_Str");
  pos=Param.parseVector2(params.get("String_Node_Str"));
  speed=Float.parseFloat(params.get("String_Node_Str"));
  if (params.get("String_Node_Str") != null) {
    count=Integer.parseInt(params.get("String_Node_Str"));
  }
  mode=Mode.valueOf(params.get("String_Node_Str").trim().toUpperCase());
  if (params.get("String_Node_Str") != null) {
    wait=Boolean.parseBoolean(params.get("String_Node_Str"));
  }
  if (params.get("String_Node_Str") != null) {
    String repeatStr=params.get("String_Node_Str");
    repeat=Tween.Type.valueOf(repeatStr.trim().toUpperCase());
  }
  interpolation=InterpolationMode.valueOf(params.get("String_Node_Str").trim().toUpperCase());
}

Fixed version (ground truth):
@Override public void setParams(HashMap<String,String> params){
  actorId=params.get("String_Node_Str");
  pos=Param.parseVector2(params.get("String_Node_Str"));
  speed=Float.parseFloat(params.get("String_Node_Str"));
  if (params.get("String_Node_Str") != null) {
    count=Integer.parseInt(params.get("String_Node_Str"));
  }
  if (params.get("String_Node_Str") != null) {
    mode=Mode.valueOf(params.get("String_Node_Str").trim().toUpperCase());
  }
  if (params.get("String_Node_Str") != null) {
    wait=Boolean.parseBoolean(params.get("String_Node_Str"));
  }
  if (params.get("String_Node_Str") != null) {
    String repeatStr=params.get("String_Node_Str");
    repeat=Tween.Type.valueOf(repeatStr.trim().toUpperCase());
  }
  if (params.get("String_Node_Str") != null) {
    interpolation=InterpolationMode.valueOf(params.get("String_Node_Str").trim().toUpperCase());
  }
}
Program: 30331
Project: 30331
Buggy source:
public Scene getScene(){
  final World world=World.getInstance();
  if (sceneId != null && sceneId.trim().isEmpty()) {
    return world.getScene(sceneId);
  }
 else {
    return world.getCurrentScene();
  }
}

Fixed version (ground truth):
public Scene getScene(){
  final World world=World.getInstance();
  if (sceneId != null && !sceneId.trim().isEmpty()) {
    return world.getScene(sceneId);
  }
 else {
    return world.getCurrentScene();
  }
}
Program: 30334
Project: 30334
Buggy source:
@SuppressWarnings("String_Node_Str") public void load(String name){
  String gameStateFileName;
  String recordFileName;
  if (name != null) {
    gameStateFileName=name + GAMESTATE_EXT;
    recordFileName=name + RECORD_EXT;
  }
 else {
    gameStateFileName=DEFAULT_RECORD_FILENAME + GAMESTATE_EXT;
    recordFileName=DEFAULT_RECORD_FILENAME + RECORD_EXT;
  }
  FileHandle verbsFile=EngineAssetManager.getInstance().getUserFile(recordFileName);
  if (!verbsFile.exists())   verbsFile=Gdx.files.internal("String_Node_Str" + recordFileName);
  if (verbsFile.exists()) {
    FileHandle gameStateFile=EngineAssetManager.getInstance().getUserFile(gameStateFileName);
    if (!gameStateFile.exists())     gameStateFile=Gdx.files.internal("String_Node_Str" + gameStateFileName);
    if (gameStateFile.exists())     World.getInstance().loadGameState(gameStateFile);
 else     EngineLogger.error("String_Node_Str");
    list=new Json().fromJson(ArrayList.class,TimeVerb.class,verbsFile.reader("String_Node_Str"));
  }
 else {
    EngineLogger.error("String_Node_Str");
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public void load(){
  String gameStateFileName=fileName + GAMESTATE_EXT;
  String recordFileName=fileName + RECORD_EXT;
  FileHandle verbsFile=EngineAssetManager.getInstance().getUserFile(recordFileName);
  if (!verbsFile.exists())   verbsFile=Gdx.files.internal("String_Node_Str" + recordFileName);
  if (verbsFile.exists()) {
    FileHandle gameStateFile=EngineAssetManager.getInstance().getUserFile(gameStateFileName);
    if (!gameStateFile.exists())     gameStateFile=Gdx.files.internal("String_Node_Str" + gameStateFileName);
    if (gameStateFile.exists())     World.getInstance().loadGameState(gameStateFile);
 else     EngineLogger.error("String_Node_Str");
    list=new Json().fromJson(ArrayList.class,TimeVerb.class,verbsFile.reader("String_Node_Str"));
  }
 else {
    EngineLogger.error("String_Node_Str");
  }
}
Program: 30335
Project: 30335
Buggy source:
public void setRecording(boolean recording){
  this.recording=recording;
  time=0;
  pos=0;
  if (recording) {
    EngineLogger.debug("String_Node_Str");
    World.getInstance().saveGameState(DEFAULT_RECORD_FILENAME + GAMESTATE_EXT);
  }
 else   save();
}

Fixed version (ground truth):
public void setRecording(boolean recording){
  this.recording=recording;
  time=0;
  pos=0;
  if (recording) {
    EngineLogger.debug("String_Node_Str");
    World.getInstance().saveGameState(fileName + GAMESTATE_EXT);
  }
 else   save();
}
Program: 30336
Project: 30336
Buggy source:
public void save(){
  Json json=new Json();
  String s=json.prettyPrint(list);
  Writer w=EngineAssetManager.getInstance().getUserFile(DEFAULT_RECORD_FILENAME + RECORD_EXT).writer(false,"String_Node_Str");
  try {
    w.write(s);
    w.close();
  }
 catch (  IOException e) {
    EngineLogger.error("String_Node_Str",e);
  }
}

Fixed version (ground truth):
public void save(){
  Json json=new Json();
  String s=json.prettyPrint(list);
  Writer w=EngineAssetManager.getInstance().getUserFile(fileName + RECORD_EXT).writer(false,"String_Node_Str");
  try {
    w.write(s);
    w.close();
  }
 catch (  IOException e) {
    EngineLogger.error("String_Node_Str",e);
  }
}
Program: 30337
Project: 30337
Buggy source:
@Override public void act(float delta){
  if (projectLoadedFlag) {
    projectLoadedFlag=false;
    if (scn != null) {
      scn.dispose();
      EngineAssetManager.getInstance().dispose();
      scn=null;
    }
    EngineAssetManager.createEditInstance(Ctx.project.getProjectDir().getAbsolutePath() + Project.ASSETS_PATH,Ctx.project.getWorld().getWidth(),Ctx.project.getWorld().getHeight());
    setSelectedScene(Ctx.project.getSelectedScene());
    setSelectedActor(Ctx.project.getSelectedActor());
    setSelectedFA(Ctx.project.getSelectedFA());
  }
  if (scn != null && animation && !loading && !loadingError) {
    faRenderer.update(delta);
    scn.update(delta);
  }
}

Fixed version (ground truth):
@Override public void act(float delta){
  if (projectLoadedFlag) {
    projectLoadedFlag=false;
    if (scn != null) {
      scn.dispose();
      EngineAssetManager.getInstance().dispose();
      scn=null;
    }
    EngineAssetManager.createEditInstance(Ctx.project.getProjectDir().getAbsolutePath() + Project.ASSETS_PATH,Ctx.project.getWorld().getWidth(),Ctx.project.getWorld().getHeight());
    setSelectedScene(Ctx.project.getSelectedScene());
    setSelectedActor(Ctx.project.getSelectedActor());
    setSelectedFA(Ctx.project.getSelectedFA());
  }
  if (scn != null && animation && !loading && !loadingError) {
    if (!inScene)     faRenderer.update(delta);
    scn.update(delta);
  }
}
Program: 30338
Project: 30338
Buggy source:
public void setTab(int i){
  Actor panel=tabs.get(i).content;
  tabs.get(i).button.setChecked(true);
  body.clear();
  body.setActor(panel);
}

Fixed version (ground truth):
public void setTab(int i){
  Actor panel=tabs.get(i).content;
  tabs.get(i).button.setChecked(true);
  body.setActor(null);
  body.clear();
  body.setActor(panel);
}
Program: 30339
Project: 30339
Buggy source:
public void clear(){
  Array<Button> buttons=buttonGroup.getButtons();
  buttons.clear();
  header.clear();
  tabs.clear();
  body.clear();
}

Fixed version (ground truth):
public void clear(){
  Array<Button> buttons=buttonGroup.getButtons();
  buttons.clear();
  header.clear();
  tabs.clear();
  body.setActor(null);
  body.clear();
}
Program: 30340
Project: 30340
Buggy source:
@Override public void setParams(HashMap<String,String> params){
  actorId=params.get("String_Node_Str");
  animation=params.get("String_Node_Str");
  String a[]=Param.parseString2(animation);
  if (a[0] != null)   actorId=a[0];
  animation=a[1];
  if (params.get("String_Node_Str") != null) {
    Vector2 p=Param.parseVector2(params.get("String_Node_Str"));
    posx=p.x;
    posy=p.y;
  }
  if (params.get("String_Node_Str") != null) {
    boolean absolute=Boolean.parseBoolean(params.get("String_Node_Str"));
    if (absolute)     setPos=SET_POS_ABSOLUTE;
 else     setPos=SET_POS_RELATIVE;
  }
  if (params.get("String_Node_Str") != null) {
    count=Integer.parseInt(params.get("String_Node_Str"));
  }
  if (params.get("String_Node_Str") != null) {
    setWait(Boolean.parseBoolean(params.get("String_Node_Str")));
  }
  if (params.get("String_Node_Str") != null) {
    String repeatStr=params.get("String_Node_Str");
    if (repeatStr.equalsIgnoreCase("String_Node_Str")) {
      repeat=Tween.REPEAT;
    }
 else     if (repeatStr.equalsIgnoreCase("String_Node_Str")) {
      repeat=Tween.PINGPONG;
    }
 else     if (repeatStr.equalsIgnoreCase("String_Node_Str")) {
      repeat=Tween.NO_REPEAT;
    }
 else     if (repeatStr.equalsIgnoreCase("String_Node_Str")) {
      repeat=Tween.REVERSE;
    }
 else {
      repeat=Tween.FROM_FA;
    }
  }
}

Fixed version (ground truth):
@Override public void setParams(HashMap<String,String> params){
  actorId=params.get("String_Node_Str");
  animation=params.get("String_Node_Str");
  String a[]=Param.parseString2(animation);
  if (a[0] != null)   actorId=a[0];
  animation=a[1];
  if (params.get("String_Node_Str") != null) {
    Vector2 p=Param.parseVector2(params.get("String_Node_Str"));
    posx=p.x;
    posy=p.y;
    setPos=SET_POS_ABSOLUTE;
  }
  if (params.get("String_Node_Str") != null) {
    boolean absolute=Boolean.parseBoolean(params.get("String_Node_Str"));
    if (absolute)     setPos=SET_POS_ABSOLUTE;
 else     setPos=SET_POS_RELATIVE;
  }
  if (params.get("String_Node_Str") != null) {
    count=Integer.parseInt(params.get("String_Node_Str"));
  }
  if (params.get("String_Node_Str") != null) {
    setWait(Boolean.parseBoolean(params.get("String_Node_Str")));
  }
  if (params.get("String_Node_Str") != null) {
    String repeatStr=params.get("String_Node_Str");
    if (repeatStr.equalsIgnoreCase("String_Node_Str")) {
      repeat=Tween.REPEAT;
    }
 else     if (repeatStr.equalsIgnoreCase("String_Node_Str")) {
      repeat=Tween.PINGPONG;
    }
 else     if (repeatStr.equalsIgnoreCase("String_Node_Str")) {
      repeat=Tween.NO_REPEAT;
    }
 else     if (repeatStr.equalsIgnoreCase("String_Node_Str")) {
      repeat=Tween.REVERSE;
    }
 else {
      repeat=Tween.FROM_FA;
    }
  }
}
Program: 30341
Project: 30341
Buggy source:
private static void getUsedKeys(Element e,ArrayList<String> usedKeys){
  NamedNodeMap attrs=e.getAttributes();
  for (int i=0; i < attrs.getLength(); i++) {
    if (attrs.item(i).getNodeValue().charAt(0) == BaseDocument.I18NPREFIX) {
      usedKeys.add(attrs.item(i).getNodeValue().substring(1));
    }
  }
  NodeList childs=e.getChildNodes();
  for (int i=0; i < childs.getLength(); i++) {
    if (childs.item(i) instanceof Element)     getUsedKeys((Element)childs.item(i),usedKeys);
  }
}

Fixed version (ground truth):
private static void getUsedKeys(Element e,ArrayList<String> usedKeys){
  NamedNodeMap attrs=e.getAttributes();
  for (int i=0; i < attrs.getLength(); i++) {
    if (attrs.item(i).getNodeValue().length() > 0 && attrs.item(i).getNodeValue().charAt(0) == BaseDocument.I18NPREFIX) {
      usedKeys.add(attrs.item(i).getNodeValue().substring(1));
    }
  }
  NodeList childs=e.getChildNodes();
  for (int i=0; i < childs.getLength(); i++) {
    if (childs.item(i) instanceof Element)     getUsedKeys((Element)childs.item(i),usedKeys);
  }
}
Program: 30342
Project: 30342
Buggy source:
private void fillAnimations(){
  @SuppressWarnings("String_Node_Str") SelectBox<String> cb=(SelectBox<String>)inputs[1].getField();
  cb.clearItems();
  if (e == null)   cb.getItems().add("String_Node_Str");
  String ids[]=spriteWidget.getAnimations();
  for (  String s : ids)   cb.getItems().add(s);
  cb.getList().setItems(cb.getItems());
  cb.invalidateHierarchy();
  setAnimation();
}

Fixed version (ground truth):
private void fillAnimations(){
  @SuppressWarnings("String_Node_Str") SelectBox<String> cb=(SelectBox<String>)inputs[1].getField();
  cb.clearItems();
  if (e == null)   cb.getItems().add("String_Node_Str");
  String ids[]=spriteWidget.getAnimations();
  for (  String s : ids)   cb.getItems().add(s);
  cb.getList().setItems(cb.getItems());
  if (cb.getItems().size > 0)   cb.setSelectedIndex(0);
  cb.invalidateHierarchy();
  setAnimation();
}
Program: 30343
Project: 30343
Buggy source:
/** 
 * Extract an image from a texture atlas.
 * @param page The image file related to the page the region is in
 * @param region The region to extract
 * @param outputDirFile The output directory
 * @param padding padding (in pixels) to apply to the image
 * @return The extracted image
 */
private BufferedImage extractImage(BufferedImage page,Region region,File outputDirFile,int padding){
  BufferedImage splitImage=null;
  if (region.rotate) {
    BufferedImage srcImage=page.getSubimage(region.left,region.top,region.height,region.width);
    splitImage=new BufferedImage(region.height,region.width,page.getType());
    AffineTransform transform=new AffineTransform();
    transform.rotate(Math.toRadians(90.0));
    transform.translate(0,-region.width);
    AffineTransformOp op=new AffineTransformOp(transform,AffineTransformOp.TYPE_BILINEAR);
    op.filter(srcImage,splitImage);
  }
 else {
    splitImage=page.getSubimage(region.left,region.top,region.width,region.height);
  }
  if (padding > 0) {
    BufferedImage paddedImage=new BufferedImage(splitImage.getWidth() + padding * 2,splitImage.getHeight() + padding * 2,page.getType());
    Graphics2D g2=paddedImage.createGraphics();
    g2.drawImage(splitImage,padding,padding,null);
    g2.dispose();
    return paddedImage;
  }
 else {
    return splitImage;
  }
}

Fixed version (ground truth):
/** 
 * Extract an image from a texture atlas.
 * @param page The image file related to the page the region is in
 * @param region The region to extract
 * @param outputDirFile The output directory
 * @param padding padding (in pixels) to apply to the image
 * @return The extracted image
 */
private BufferedImage extractImage(BufferedImage page,Region region,File outputDirFile,int padding){
  BufferedImage splitImage=null;
  if (region.rotate) {
    BufferedImage srcImage=page.getSubimage(region.left,region.top,region.height,region.width);
    splitImage=new BufferedImage(region.width,region.height,page.getType());
    AffineTransform transform=new AffineTransform();
    transform.rotate(Math.toRadians(90.0));
    transform.translate(0,-region.width);
    AffineTransformOp op=new AffineTransformOp(transform,AffineTransformOp.TYPE_BILINEAR);
    op.filter(srcImage,splitImage);
  }
 else {
    splitImage=page.getSubimage(region.left,region.top,region.width,region.height);
  }
  if (padding > 0) {
    BufferedImage paddedImage=new BufferedImage(splitImage.getWidth() + padding * 2,splitImage.getHeight() + padding * 2,page.getType());
    Graphics2D g2=paddedImage.createGraphics();
    g2.drawImage(splitImage,padding,padding,null);
    g2.dispose();
    return paddedImage;
  }
 else {
    return splitImage;
  }
}
Program: 30344
Project: 30344
Buggy source:
/** 
 * Try to load the save game if exists. In other case, load the game from XML.
 * @throws IOException
 * @throws SAXException
 * @throws ParserConfigurationException
 */
public void load(){
  if (FileUtils.exists(EngineAssetManager.getInstance().getUserFile(GAMESTATE_FILENAME))) {
    try {
      instance.loadGameState();
    }
 catch (    Exception e) {
      EngineLogger.error("String_Node_Str",e);
      instance.loadXMLChapter(null);
    }
  }
 else {
    instance.loadXMLChapter(null);
  }
}

Fixed version (ground truth):
/** 
 * Try to load the save game if exists. In other case, load the game from XML.
 * @throws IOException
 * @throws SAXException
 * @throws ParserConfigurationException
 */
public void load(){
  if (EngineAssetManager.getInstance().getUserFile(GAMESTATE_FILENAME).exists()) {
    try {
      instance.loadGameState();
    }
 catch (    Exception e) {
      EngineLogger.error("String_Node_Str",e);
      instance.loadXMLChapter(null);
    }
  }
 else {
    instance.loadXMLChapter(null);
  }
}
Program: 30345
Project: 30345
Buggy source:
public boolean savedGameExists(){
  return FileUtils.exists(EngineAssetManager.getInstance().getUserFile(GAMESTATE_FILENAME));
}

Fixed version (ground truth):
public boolean savedGameExists(){
  return EngineAssetManager.getInstance().getUserFile(GAMESTATE_FILENAME).exists();
}
Program: 30346
Project: 30346
Buggy source:
public void loadGameState(FileHandle savedFile){
  EngineLogger.debug("String_Node_Str");
  if (!disposed)   dispose();
  init();
  if (FileUtils.exists(savedFile)) {
    assetState=AssetState.LOAD_ASSETS;
    new Json().fromJson(World.class,savedFile.reader("String_Node_Str"));
  }
 else {
    EngineLogger.error("String_Node_Str");
  }
}

Fixed version (ground truth):
public void loadGameState(FileHandle savedFile){
  EngineLogger.debug("String_Node_Str");
  if (!disposed)   dispose();
  init();
  if (savedFile.exists()) {
    assetState=AssetState.LOAD_ASSETS;
    new Json().fromJson(World.class,savedFile.reader("String_Node_Str"));
  }
 else {
    EngineLogger.error("String_Node_Str");
  }
}
Program: 30348
Project: 30348
Buggy source:
public void clicked(InputEvent event,float x,float y){
  World.getInstance().dispose();
  Gdx.app.exit();
}

Fixed version (ground truth):
public void clicked(InputEvent event,float x,float y){
  Gdx.app.exit();
}
Program: 30349
Project: 30349
Buggy source:
public void play(){
  if (loop)   s.loop();
 else   s.play(volume);
}

Fixed version (ground truth):
public void play(){
  if (s == null)   return;
  if (loop)   s.loop();
 else   s.play(volume);
}
Program: 30350
Project: 30350
Buggy source:
public void stop(){
  s.stop();
}

Fixed version (ground truth):
public void stop(){
  if (s == null)   return;
  s.stop();
}
Program: 30351
Project: 30351
Buggy source:
public static boolean runGradle(File workingDir,String parameters){
  String exec=workingDir.getAbsolutePath() + "String_Node_Str" + (System.getProperty("String_Node_Str").contains("String_Node_Str") ? "String_Node_Str" : "String_Node_Str");
  String command=exec + "String_Node_Str" + parameters;
  EditorLogger.debug("String_Node_Str" + command + "String_Node_Str");
  try {
    final Process process=new ProcessBuilder(command.split("String_Node_Str")).directory(workingDir).inheritIO().start();
    process.waitFor();
    return process.exitValue() == 0;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return false;
  }
}

Fixed version (ground truth):
public static boolean runGradle(File workingDir,String parameters){
  String exec=workingDir.getAbsolutePath() + "String_Node_Str" + (System.getProperty("String_Node_Str").contains("String_Node_Str") ? "String_Node_Str" : "String_Node_Str");
  String command=exec + "String_Node_Str" + parameters;
  EditorLogger.debug("String_Node_Str" + command + "String_Node_Str");
  try {
    final Process process=new ProcessBuilder(command.split("String_Node_Str")).directory(workingDir).start();
    process.waitFor();
    return process.exitValue() == 0;
  }
 catch (  Exception e) {
    e.printStackTrace();
    return false;
  }
}