nus-yam/ex-repair huggingface dataset:
Program: 10378
Project: 10378
Buggy source:
/** 
 * Returns a default value string of the specified type.
 */
@Requires("String_Node_Str") @Ensures("String_Node_Str") protected static String getDefaultValue(TypeName type){
  String name=type.getDeclaredName();
  if (name.equals("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (numericTypes.contains(name)) {
    return "String_Node_Str";
  }
 else {
    return "String_Node_Str" + name + "String_Node_Str";
  }
}

Fixed version (ground truth):
/** 
 * Returns a default value string of the specified type.
 */
@Requires("String_Node_Str") @Ensures("String_Node_Str") protected static String getDefaultValue(TypeName type){
  String name=type.getDeclaredName();
  if (name.equals("String_Node_Str")) {
    return "String_Node_Str";
  }
 else   if (numericTypes.contains(name)) {
    return "String_Node_Str" + name + "String_Node_Str";
  }
 else {
    return "String_Node_Str" + name + "String_Node_Str";
  }
}
Program: 10379
Project: 10379
Buggy source:
@Override public UICollectionViewCell getCellForItem(UICollectionView collectionView,NSIndexPath indexPath){
  final AAPLGridViewCell cell=(AAPLGridViewCell)collectionView.dequeueReusableCell(CellReuseIdentifier,indexPath);
  final long currentTag=cell.getTag() + 1;
  cell.setTag(currentTag);
  PHAsset asset=assetsFetchResults.get(indexPath.getItem());
  imageManager.requestImageForAsset(asset,assetGridThumbnailSize,PHImageContentMode.AspectFill,null,new VoidBlock2<UIImage,NSDictionary<NSString,NSObject>>(){
    @Override public void invoke(    UIImage result,    NSDictionary<NSString,NSObject> b){
      if (cell.getTag() == currentTag) {
        cell.setThumbnailImage(result);
      }
    }
  }
);
  return cell;
}

Fixed version (ground truth):
@Override public UICollectionViewCell getCellForItem(UICollectionView collectionView,NSIndexPath indexPath){
  final AAPLGridViewCell cell=(AAPLGridViewCell)collectionView.dequeueReusableCell(CellReuseIdentifier,indexPath);
  final long currentTag=cell.getTag() + 1;
  cell.setTag(currentTag);
  PHAsset asset=assetsFetchResults.get(indexPath.getItem());
  imageManager.requestImageForAsset(asset,assetGridThumbnailSize,PHImageContentMode.AspectFill,null,(image,result) -> {
    if (cell.getTag() == currentTag) {
      cell.setThumbnailImage(image);
    }
  }
);
  return cell;
}
Program: 10380
Project: 10380
Buggy source:
@Override public void run(){
  PHAssetChangeRequest assetChangeRequest=PHAssetChangeRequest.createImageAssetCreationRequest(image);
  if (assetCollection != null) {
    PHAssetCollectionChangeRequest assetCollectionChangeRequest=new PHAssetCollectionChangeRequest(assetCollection);
    assetCollectionChangeRequest.addAssets(new NSArray<>(assetChangeRequest.getPlaceholderForCreatedAsset()));
  }
}

Fixed version (ground truth):
@Override public void run(){
  NSIndexSet removedIndexes=collectionChanges.getRemovedIndexes();
  if (removedIndexes != null && removedIndexes.size() > 0) {
    collectionView.deleteItems(getIndexPathsFromIndexesWithSection(removedIndexes,0));
  }
  NSIndexSet insertedIndexes=collectionChanges.getInsertedIndexes();
  if (insertedIndexes != null && insertedIndexes.size() > 0) {
    collectionView.insertItems(getIndexPathsFromIndexesWithSection(insertedIndexes,0));
  }
  NSIndexSet changedIndexes=collectionChanges.getChangedIndexes();
  if (changedIndexes != null && changedIndexes.size() > 0) {
    collectionView.reloadItems(getIndexPathsFromIndexesWithSection(changedIndexes,0));
  }
}
Program: 10381
Project: 10381
Buggy source:
@IBAction private void handleAddButtonItem(NSObject sender){
  CGRect rect=Math.random() % 2 == 0 ? new CGRect(0,0,400,300) : new CGRect(0,0,300,400);
  UIGraphics.beginImageContext(rect.getSize(),false,1.0);
  UIColor.fromHSBA(Math.random() % 100 / 100,1,1,1).setFill();
  UIGraphics.rectFill(rect,CGBlendMode.Normal);
  final UIImage image=UIGraphics.getImageFromCurrentImageContext();
  UIGraphics.endImageContext();
  PHPhotoLibrary.getSharedPhotoLibrary().performChanges(new Runnable(){
    @Override public void run(){
      PHAssetChangeRequest assetChangeRequest=PHAssetChangeRequest.createImageAssetCreationRequest(image);
      if (assetCollection != null) {
        PHAssetCollectionChangeRequest assetCollectionChangeRequest=new PHAssetCollectionChangeRequest(assetCollection);
        assetCollectionChangeRequest.addAssets(new NSArray<>(assetChangeRequest.getPlaceholderForCreatedAsset()));
      }
    }
  }
,new VoidBlock2<Boolean,NSError>(){
    @Override public void invoke(    Boolean success,    NSError error){
      if (!success) {
        System.err.println("String_Node_Str" + error);
      }
    }
  }
);
}

Fixed version (ground truth):
@IBAction private void handleAddButtonItem(NSObject sender){
  CGRect rect=Math.random() % 2 == 0 ? new CGRect(0,0,400,300) : new CGRect(0,0,300,400);
  UIGraphics.beginImageContext(rect.getSize(),false,1.0);
  UIColor.fromHSBA(Math.random() % 100 / 100,1,1,1).setFill();
  UIGraphics.rectFill(rect,CGBlendMode.Normal);
  final UIImage image=UIGraphics.getImageFromCurrentImageContext();
  UIGraphics.endImageContext();
  PHPhotoLibrary.getSharedPhotoLibrary().performChanges(() -> {
    PHAssetChangeRequest assetChangeRequest=PHAssetChangeRequest.createImageAssetCreationRequest(image);
    if (assetCollection != null) {
      PHAssetCollectionChangeRequest assetCollectionChangeRequest=new PHAssetCollectionChangeRequest(assetCollection);
      assetCollectionChangeRequest.addAssets(new NSArray<>(assetChangeRequest.getPlaceholderForCreatedAsset()));
    }
  }
,(success,error) -> {
    if (!success) {
      System.err.println("String_Node_Str" + error);
    }
  }
);
}
Program: 10383
Project: 10383
Buggy source:
private void updateCachedAssets(){
  boolean isViewVisible=isViewLoaded() && getView().getWindow() != null;
  if (!isViewVisible)   return;
  CGRect preheatRect=getCollectionView().getBounds();
  preheatRect=preheatRect.inset(0.0,-0.5 * preheatRect.getHeight());
  double delta=Math.abs(preheatRect.getMidY() - previousPreheatRect.getMidY());
  if (delta > getCollectionView().getBounds().getHeight() / 3.0) {
    final NSArray<NSIndexPath> addedIndexPaths=new NSMutableArray<>();
    final NSArray<NSIndexPath> removedIndexPaths=new NSMutableArray<>();
    computeDifferenceBetweenRects(previousPreheatRect,preheatRect,new VoidBlock1<CGRect>(){
      @Override public void invoke(      CGRect removedRect){
        NSArray<NSIndexPath> indexPaths=getIndexPathsForElementsInRect(removedRect);
        if (indexPaths != null) {
          removedIndexPaths.addAll(indexPaths);
        }
      }
    }
,new VoidBlock1<CGRect>(){
      @Override public void invoke(      CGRect addedRect){
        NSArray<NSIndexPath> indexPaths=getIndexPathsForElementsInRect(addedRect);
        if (indexPaths != null) {
          addedIndexPaths.addAll(indexPaths);
        }
      }
    }
);
    NSArray<PHAsset> assetsToStartCaching=getAssetsAtIndexPaths(addedIndexPaths);
    NSArray<PHAsset> assetsToStopCaching=getAssetsAtIndexPaths(removedIndexPaths);
    imageManager.startCachingImagesForAssets(assetsToStartCaching,assetGridThumbnailSize,PHImageContentMode.AspectFill,null);
    imageManager.stopCachingImagesForAssets(assetsToStopCaching,assetGridThumbnailSize,PHImageContentMode.AspectFill,null);
    previousPreheatRect=preheatRect;
  }
}

Fixed version (ground truth):
private void updateCachedAssets(){
  boolean isViewVisible=isViewLoaded() && getView().getWindow() != null;
  if (!isViewVisible)   return;
  CGRect preheatRect=getCollectionView().getBounds();
  preheatRect=preheatRect.inset(0.0,-0.5 * preheatRect.getHeight());
  double delta=Math.abs(preheatRect.getMidY() - previousPreheatRect.getMidY());
  if (delta > getCollectionView().getBounds().getHeight() / 3.0) {
    final NSArray<NSIndexPath> addedIndexPaths=new NSMutableArray<>();
    final NSArray<NSIndexPath> removedIndexPaths=new NSMutableArray<>();
    computeDifferenceBetweenRects(previousPreheatRect,preheatRect,(removedRect) -> {
      NSArray<NSIndexPath> indexPaths=getIndexPathsForElementsInRect(removedRect);
      if (indexPaths != null) {
        removedIndexPaths.addAll(indexPaths);
      }
    }
,(addedRect) -> {
      NSArray<NSIndexPath> indexPaths=getIndexPathsForElementsInRect(addedRect);
      if (indexPaths != null) {
        addedIndexPaths.addAll(indexPaths);
      }
    }
);
    NSArray<PHAsset> assetsToStartCaching=getAssetsAtIndexPaths(addedIndexPaths);
    NSArray<PHAsset> assetsToStopCaching=getAssetsAtIndexPaths(removedIndexPaths);
    imageManager.startCachingImagesForAssets(assetsToStartCaching,assetGridThumbnailSize,PHImageContentMode.AspectFill,null);
    imageManager.stopCachingImagesForAssets(assetsToStopCaching,assetGridThumbnailSize,PHImageContentMode.AspectFill,null);
    previousPreheatRect=preheatRect;
  }
}
Program: 10384
Project: 10384
Buggy source:
private NSArray<NSIndexPath> getIndexPathsFromIndexesWithSection(NSIndexSet indexSet,final long section){
  final NSArray<NSIndexPath> indexPaths=new NSMutableArray<>(indexSet.size());
  indexSet.enumerateIndexes(new VoidBlock2<Long,BooleanPtr>(){
    @Override public void invoke(    Long idx,    BooleanPtr stop){
      indexPaths.add(NSIndexPath.item(idx,section));
    }
  }
);
  return indexPaths;
}

Fixed version (ground truth):
private NSArray<NSIndexPath> getIndexPathsFromIndexesWithSection(NSIndexSet indexSet,final long section){
  final NSArray<NSIndexPath> indexPaths=new NSMutableArray<>(indexSet.size());
  indexSet.enumerateIndexes((idx,stop) -> {
    indexPaths.add(NSIndexPath.item(idx,section));
  }
);
  return indexPaths;
}
Program: 10385
Project: 10385
Buggy source:
@Override public UITableViewCell getCellForRow(UITableView tableView,NSIndexPath indexPath){
  final String cellIdentifier="String_Node_Str";
  GTLPlusPerson personToShow=myPeeps.get(indexPath.getRow());
  UITableViewCell cell=tableView.dequeueReusableCell(cellIdentifier);
  if (cell == null) {
    cell=new UITableViewCell(UITableViewCellStyle.Default,cellIdentifier);
  }
  if (personToShow.getImage() != null) {
    cell.getImageView().setImage(UIImage.create(NSData.read(new NSURL(personToShow.getImage().getUrl()))));
  }
  Log.d("String_Node_Str",personToShow.getImage().getUrl());
  cell.getTextLabel().setText(personToShow.getDisplayName());
  return cell;
}

Fixed version (ground truth):
@Override public UITableViewCell getCellForRow(UITableView tableView,NSIndexPath indexPath){
  final String cellIdentifier="String_Node_Str";
  GTLPlusPerson personToShow=myPeeps.get(indexPath.getRow());
  UITableViewCell cell=tableView.dequeueReusableCell(cellIdentifier);
  if (cell == null) {
    cell=new UITableViewCell(UITableViewCellStyle.Default,cellIdentifier);
  }
  if (personToShow.getImage() != null) {
    cell.getImageView().setImage(new UIImage(NSData.read(new NSURL(personToShow.getImage().getUrl()))));
  }
  Log.d("String_Node_Str",personToShow.getImage().getUrl());
  cell.getTextLabel().setText(personToShow.getDisplayName());
  return cell;
}
Program: 10387
Project: 10387
Buggy source:
private void loadWorldTiles(){
  System.out.println("String_Node_Str");
  NSDate startDate=new NSDate();
  SKTextureAtlas tileAtlas=SKTextureAtlas.create("String_Node_Str");
  sharedBackgroundTiles=new NSMutableArray<>(1024);
  System.out.println("String_Node_Str");
  for (int y=0; y < WORLD_TILE_DIVISOR; y++) {
    for (int x=0; x < WORLD_TILE_DIVISOR; x++) {
      int tileNumber=(y * WORLD_TILE_DIVISOR) + x;
      SKSpriteNode tileNode=SKSpriteNode.create(tileAtlas.getTexture(String.format("String_Node_Str",tileNumber)));
      CGPoint position=new CGPoint((x * WORLD_TILE_SIZE) - WORLD_CENTER,(WORLD_SIZE - (y * WORLD_TILE_SIZE)) - WORLD_CENTER);
      tileNode.setPosition(position);
      tileNode.setZPosition(-1.0);
      tileNode.setBlendMode(SKBlendMode.Replace);
      sharedBackgroundTiles.add(tileNode);
    }
  }
  System.out.println(String.format("String_Node_Str",new NSDate().getTimeIntervalSince(startDate)));
}

Fixed version (ground truth):
private void loadWorldTiles(){
  System.out.println("String_Node_Str");
  NSDate startDate=new NSDate();
  SKTextureAtlas tileAtlas=new SKTextureAtlas("String_Node_Str");
  sharedBackgroundTiles=new NSMutableArray<>(1024);
  System.out.println("String_Node_Str");
  for (int y=0; y < WORLD_TILE_DIVISOR; y++) {
    for (int x=0; x < WORLD_TILE_DIVISOR; x++) {
      int tileNumber=(y * WORLD_TILE_DIVISOR) + x;
      SKSpriteNode tileNode=new SKSpriteNode(tileAtlas.getTexture(String.format("String_Node_Str",tileNumber)));
      CGPoint position=new CGPoint((x * WORLD_TILE_SIZE) - WORLD_CENTER,(WORLD_SIZE - (y * WORLD_TILE_SIZE)) - WORLD_CENTER);
      tileNode.setPosition(position);
      tileNode.setZPosition(-1.0);
      tileNode.setBlendMode(SKBlendMode.Replace);
      sharedBackgroundTiles.add(tileNode);
    }
  }
  System.out.println(String.format("String_Node_Str",new NSDate().getTimeIntervalSince(startDate)));
}
Program: 10388
Project: 10388
Buggy source:
@Override void loadSceneAssets(){
  SKTextureAtlas atlas=SKTextureAtlas.create("String_Node_Str");
  sharedProjectileSparkEmitter=APAUtils.getEmitterNodeByName("String_Node_Str");
  sharedSpawnEmitter=APAUtils.getEmitterNodeByName("String_Node_Str");
  sharedSmallTree=new APATree(new NSArray<SKSpriteNode>(SKSpriteNode.create(atlas.getTexture("String_Node_Str")),SKSpriteNode.create(atlas.getTexture("String_Node_Str")),SKSpriteNode.create(atlas.getTexture("String_Node_Str"))),25.0);
  sharedBigTree=new APATree(new NSArray<SKSpriteNode>(SKSpriteNode.create(atlas.getTexture("String_Node_Str")),SKSpriteNode.create(atlas.getTexture("String_Node_Str")),SKSpriteNode.create(atlas.getTexture("String_Node_Str"))),150.0);
  sharedBigTree.setFadesAlpha(true);
  sharedLeafEmitterA=APAUtils.getEmitterNodeByName("String_Node_Str");
  sharedLeafEmitterB=APAUtils.getEmitterNodeByName("String_Node_Str");
  loadWorldTiles();
  APAArcher.loadSharedAssets();
  APABoss.loadSharedAssets();
  APACave.loadSharedAssets();
  APAGoblin.loadSharedAssets();
  APAHeroCharacter.loadSharedAssets();
  APAWarrior.loadSharedAssets();
}

Fixed version (ground truth):
@Override void loadSceneAssets(){
  SKTextureAtlas atlas=new SKTextureAtlas("String_Node_Str");
  sharedProjectileSparkEmitter=APAUtils.getEmitterNodeByName("String_Node_Str");
  sharedSpawnEmitter=APAUtils.getEmitterNodeByName("String_Node_Str");
  sharedSmallTree=new APATree(new NSArray<SKSpriteNode>(new SKSpriteNode(atlas.getTexture("String_Node_Str")),new SKSpriteNode(atlas.getTexture("String_Node_Str")),new SKSpriteNode(atlas.getTexture("String_Node_Str"))),25.0);
  sharedBigTree=new APATree(new NSArray<SKSpriteNode>(new SKSpriteNode(atlas.getTexture("String_Node_Str")),new SKSpriteNode(atlas.getTexture("String_Node_Str")),new SKSpriteNode(atlas.getTexture("String_Node_Str"))),150.0);
  sharedBigTree.setFadesAlpha(true);
  sharedLeafEmitterA=APAUtils.getEmitterNodeByName("String_Node_Str");
  sharedLeafEmitterB=APAUtils.getEmitterNodeByName("String_Node_Str");
  loadWorldTiles();
  APAArcher.loadSharedAssets();
  APABoss.loadSharedAssets();
  APACave.loadSharedAssets();
  APAGoblin.loadSharedAssets();
  APAHeroCharacter.loadSharedAssets();
  APAWarrior.loadSharedAssets();
}
Program: 10390
Project: 10390
Buggy source:
private void assignUnknownController(GCController controller){
  for (int playerIndex=0; playerIndex < NUM_PLAYERS; playerIndex++) {
    APAPlayer player=players.get(playerIndex);
    if (player == null) {
      player=new APAPlayer();
      players.set(playerIndex,player);
      updateHUD(player,APAHUDState.Connected,"String_Node_Str");
    }
    if (player.controller != null) {
      continue;
    }
    controller.setPlayerIndex(playerIndex);
    configureController(controller,player);
    return;
  }
}

Fixed version (ground truth):
private void assignUnknownController(GCController controller){
  for (int playerIndex=0; playerIndex < NUM_PLAYERS; playerIndex++) {
    APAPlayer player=players.get(playerIndex);
    if (player == null) {
      player=new APAPlayer();
      players.set(playerIndex,player);
      updateHUD(player,APAHUDState.Connected,"String_Node_Str");
    }
    if (player.controller != null) {
      continue;
    }
    controller.setPlayerIndex(GCControllerPlayerIndex.valueOf(playerIndex));
    configureController(controller,player);
    return;
  }
}
Program: 10391
Project: 10391
Buggy source:
private void configureConnectedGameControllers(){
  for (  GCController controller : GCController.getControllers()) {
    int playerIndex=(int)controller.getPlayerIndex();
    if (playerIndex == -1) {
      continue;
    }
    assignPresetController(controller,playerIndex);
  }
  for (  GCController controller : GCController.getControllers()) {
    long playerIndex=controller.getPlayerIndex();
    if (playerIndex == -1) {
      continue;
    }
    assignUnknownController(controller);
  }
}

Fixed version (ground truth):
private void configureConnectedGameControllers(){
  for (  GCController controller : GCController.getControllers()) {
    GCControllerPlayerIndex playerIndex=controller.getPlayerIndex();
    if (playerIndex == GCControllerPlayerIndex.Unset) {
      continue;
    }
    assignPresetController(controller,playerIndex);
  }
  for (  GCController controller : GCController.getControllers()) {
    GCControllerPlayerIndex playerIndex=controller.getPlayerIndex();
    if (playerIndex == GCControllerPlayerIndex.Unset) {
      continue;
    }
    assignUnknownController(controller);
  }
}
Program: 10392
Project: 10392
Buggy source:
/** 
 * This method should be called when the level is loaded to set up currently-connected game controllers, and register for the relevant notifications to deal with new connections/disconnections.
 */
public void configureGameControllers(){
  controllerDidConnect=GCController.Notifications.observeDidConnect(new VoidBlock1<GCController>(){
    @Override public void invoke(    GCController controller){
      System.out.println("String_Node_Str" + controller);
      int playerIndex=(int)controller.getPlayerIndex();
      if (playerIndex == -1) {
        assignUnknownController(controller);
      }
 else {
        assignPresetController(controller,playerIndex);
      }
    }
  }
);
  controllerDidDisconnect=GCController.Notifications.observeDidDisconnect(new VoidBlock1<GCController>(){
    @Override public void invoke(    GCController controller){
      for (      APAPlayer player : players) {
        if (player == null) {
          continue;
        }
        if (player.controller == controller) {
          player.controller=null;
        }
      }
      System.out.println("String_Node_Str" + controller);
    }
  }
);
  configureConnectedGameControllers();
  GCController.startWirelessControllerDiscovery(new Runnable(){
    @Override public void run(){
      System.out.println("String_Node_Str");
    }
  }
);
}

Fixed version (ground truth):
/** 
 * This method should be called when the level is loaded to set up currently-connected game controllers, and register for the relevant notifications to deal with new connections/disconnections.
 */
public void configureGameControllers(){
  controllerDidConnect=GCController.Notifications.observeDidConnect(new VoidBlock1<GCController>(){
    @Override public void invoke(    GCController controller){
      System.out.println("String_Node_Str" + controller);
      GCControllerPlayerIndex playerIndex=controller.getPlayerIndex();
      if (playerIndex == GCControllerPlayerIndex.Unset) {
        assignUnknownController(controller);
      }
 else {
        assignPresetController(controller,playerIndex);
      }
    }
  }
);
  controllerDidDisconnect=GCController.Notifications.observeDidDisconnect(new VoidBlock1<GCController>(){
    @Override public void invoke(    GCController controller){
      for (      APAPlayer player : players) {
        if (player == null) {
          continue;
        }
        if (player.controller == controller) {
          player.controller=null;
        }
      }
      System.out.println("String_Node_Str" + controller);
    }
  }
);
  configureConnectedGameControllers();
  GCController.startWirelessControllerDiscovery(new Runnable(){
    @Override public void run(){
      System.out.println("String_Node_Str");
    }
  }
);
}
Program: 10393
Project: 10393
Buggy source:
private void assignPresetController(GCController controller,int playerIndex){
  APAPlayer player=players.get(playerIndex);
  if (player == null) {
    player=new APAPlayer();
    players.set(playerIndex,player);
    updateHUD(player,APAHUDState.Connected,"String_Node_Str");
  }
  if (player.controller != null && player.controller != controller) {
    assignUnknownController(controller);
    return;
  }
  configureController(controller,player);
}

Fixed version (ground truth):
private void assignPresetController(GCController controller,GCControllerPlayerIndex playerIndex){
  int pi=(int)playerIndex.value();
  APAPlayer player=players.get(pi);
  if (player == null) {
    player=new APAPlayer();
    players.set(pi,player);
    updateHUD(player,APAHUDState.Connected,"String_Node_Str");
  }
  if (player.controller != null && player.controller != controller) {
    assignUnknownController(controller);
    return;
  }
  configureController(controller,player);
}
Program: 10394
Project: 10394
Buggy source:
public static void loadSharedAssets(){
  if (sharedProjectile == null) {
    sharedProjectile=SKSpriteNode.create(UIColor.white(),new CGSize(2.0,24.0));
    sharedProjectile.setPhysicsBody(SKPhysicsBody.createCircle(PROJECTILE_COLLISION_RADIUS));
    sharedProjectile.setName("String_Node_Str");
    sharedProjectile.getPhysicsBody().setCategoryBitMask(APAColliderType.Projectile);
    sharedProjectile.getPhysicsBody().setCollisionBitMask(APAColliderType.Wall);
    sharedProjectile.getPhysicsBody().setContactTestBitMask(sharedProjectile.getPhysicsBody().getCollisionBitMask());
    sharedProjectileEmitter=APAUtils.getEmitterNodeByName("String_Node_Str");
    sharedWalkAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",DEFAULT_NUMBER_OF_IDLE_FRAMES);
    sharedWalkAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",DEFAULT_NUMBER_OF_WALK_FRAMES);
    sharedAttackAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",ATTACK_FRAMES);
    sharedGetHitAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",GET_HIT_FRAMES);
    sharedDeathAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",DEATH_FRAMES);
    sharedDamageAction=SKAction.sequence(new NSArray<SKAction>(SKAction.colorize(UIColor.white(),10.0,0.0),SKAction.wait(0.75),SKAction.colorize(0.0,0.25)));
  }
}

Fixed version (ground truth):
public static void loadSharedAssets(){
  if (sharedProjectile == null) {
    sharedProjectile=new SKSpriteNode(UIColor.white(),new CGSize(2.0,24.0));
    sharedProjectile.setPhysicsBody(SKPhysicsBody.createCircle(PROJECTILE_COLLISION_RADIUS));
    sharedProjectile.setName("String_Node_Str");
    sharedProjectile.getPhysicsBody().setCategoryBitMask(APAColliderType.Projectile);
    sharedProjectile.getPhysicsBody().setCollisionBitMask(APAColliderType.Wall);
    sharedProjectile.getPhysicsBody().setContactTestBitMask(sharedProjectile.getPhysicsBody().getCollisionBitMask());
    sharedProjectileEmitter=APAUtils.getEmitterNodeByName("String_Node_Str");
    sharedWalkAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",DEFAULT_NUMBER_OF_IDLE_FRAMES);
    sharedWalkAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",DEFAULT_NUMBER_OF_WALK_FRAMES);
    sharedAttackAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",ATTACK_FRAMES);
    sharedGetHitAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",GET_HIT_FRAMES);
    sharedDeathAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",DEATH_FRAMES);
    sharedDamageAction=SKAction.sequence(new NSArray<SKAction>(SKAction.colorize(UIColor.white(),10.0,0.0),SKAction.wait(0.75),SKAction.colorize(0.0,0.25)));
  }
}
Program: 10395
Project: 10395
Buggy source:
public APAArcher(CGPoint position,APAPlayer player){
  super(SKTextureAtlas.create("String_Node_Str").getTexture("String_Node_Str"),position,player);
}

Fixed version (ground truth):
public APAArcher(CGPoint position,APAPlayer player){
  super(new SKTextureAtlas("String_Node_Str").getTexture("String_Node_Str"),position,player);
}
Program: 10396
Project: 10396
Buggy source:
public APABoss(CGPoint position){
  super(SKTextureAtlas.create("String_Node_Str").getTexture("String_Node_Str"),position);
  movementSpeed=MOVEMENT_SPEED * 0.35f;
  animationSpeed=1.0 / 35.0;
  setZPosition(-0.25);
  setName("String_Node_Str");
  attacking=false;
  APAChaseAI intelligence=new APAChaseAI(this,null);
  intelligence.setChaseRadius(CHASE_RADIUS);
  intelligence.setMaxAlertRadius(CHASE_RADIUS * 4.0);
  this.intelligence=intelligence;
}

Fixed version (ground truth):
public APABoss(CGPoint position){
  super(new SKTextureAtlas("String_Node_Str").getTexture("String_Node_Str"),position);
  movementSpeed=MOVEMENT_SPEED * 0.35f;
  animationSpeed=1.0 / 35.0;
  setZPosition(-0.25);
  setName("String_Node_Str");
  attacking=false;
  APAChaseAI intelligence=new APAChaseAI(this,null);
  intelligence.setChaseRadius(CHASE_RADIUS);
  intelligence.setMaxAlertRadius(CHASE_RADIUS * 4.0);
  this.intelligence=intelligence;
}
Program: 10397
Project: 10397
Buggy source:
public static void loadSharedAssets(){
  if (sharedCaveBase == null) {
    SKTextureAtlas atlas=SKTextureAtlas.create("String_Node_Str");
    SKEmitterNode fire=APAUtils.getEmitterNodeByName("String_Node_Str");
    fire.setZPosition(1);
    SKEmitterNode smoke=APAUtils.getEmitterNodeByName("String_Node_Str");
    SKNode torch=new SKNode();
    torch.addChild(fire);
    torch.addChild(smoke);
    sharedCaveBase=SKSpriteNode.create(atlas.getTexture("String_Node_Str"));
    torch.setPosition(new CGPoint(83,83));
    sharedCaveBase.addChild(torch);
    SKNode torchB=(SKNode)torch.copy();
    torchB.setPosition(new CGPoint(-83,83));
    sharedCaveBase.addChild(torchB);
    sharedCaveTop=SKSpriteNode.create(atlas.getTexture("String_Node_Str"));
    sharedDeathSplort=SKSpriteNode.create(atlas.getTexture("String_Node_Str"));
    sharedDamageEmitter=APAUtils.getEmitterNodeByName("String_Node_Str");
    sharedDeathEmitter=APAUtils.getEmitterNodeByName("String_Node_Str");
    sharedDamageAction=SKAction.sequence(new NSArray<SKAction>(SKAction.colorize(UIColor.red(),1.0,0.0),SKAction.wait(0.25),SKAction.colorize(0.0,0.1)));
  }
}

Fixed version (ground truth):
public static void loadSharedAssets(){
  if (sharedCaveBase == null) {
    SKTextureAtlas atlas=new SKTextureAtlas("String_Node_Str");
    SKEmitterNode fire=APAUtils.getEmitterNodeByName("String_Node_Str");
    fire.setZPosition(1);
    SKEmitterNode smoke=APAUtils.getEmitterNodeByName("String_Node_Str");
    SKNode torch=new SKNode();
    torch.addChild(fire);
    torch.addChild(smoke);
    sharedCaveBase=new SKSpriteNode(atlas.getTexture("String_Node_Str"));
    torch.setPosition(new CGPoint(83,83));
    sharedCaveBase.addChild(torch);
    SKNode torchB=(SKNode)torch.copy();
    torchB.setPosition(new CGPoint(-83,83));
    sharedCaveBase.addChild(torchB);
    sharedCaveTop=new SKSpriteNode(atlas.getTexture("String_Node_Str"));
    sharedDeathSplort=new SKSpriteNode(atlas.getTexture("String_Node_Str"));
    sharedDamageEmitter=APAUtils.getEmitterNodeByName("String_Node_Str");
    sharedDeathEmitter=APAUtils.getEmitterNodeByName("String_Node_Str");
    sharedDamageAction=SKAction.sequence(new NSArray<SKAction>(SKAction.colorize(UIColor.red(),1.0,0.0),SKAction.wait(0.25),SKAction.colorize(0.0,0.1)));
  }
}
Program: 10398
Project: 10398
Buggy source:
private void fireAnimation(final APAAnimationState animationState,NSArray<SKTexture> frames,String key){
  SKAction animAction=getAction(key);
  if (animAction != null | frames.size() < 1) {
    return;
  }
  activeAnimationKey=key;
  runAction(SKAction.sequence(new NSArray<SKAction>(SKAction.animate(frames,animationSpeed,true,false),SKAction.run(new Runnable(){
    @Override public void run(){
      animationHasCompleted(animationState);
    }
  }
))),key);
}

Fixed version (ground truth):
private void fireAnimation(final APAAnimationState animationState,NSArray<SKTexture> frames,String key){
  SKAction animAction=getAction(key);
  if (animAction != null | frames.size() < 1) {
    return;
  }
  activeAnimationKey=key;
  runAction(SKAction.sequence(new NSArray<SKAction>(SKAction.animateFrames(frames,animationSpeed,true,false),SKAction.run(new Runnable(){
    @Override public void run(){
      animationHasCompleted(animationState);
    }
  }
))),key);
}
Program: 10399
Project: 10399
Buggy source:
private void init(CGPoint position){
  SKTextureAtlas atlas=SKTextureAtlas.create("String_Node_Str");
  shadowBlob=SKSpriteNode.create(atlas.getTexture("String_Node_Str"));
  shadowBlob.setZPosition(-1.0);
  setPosition(position);
  health=100.0;
  movementSpeed=MOVEMENT_SPEED;
  animated=true;
  animationSpeed=1 / 28.0;
  configurePhysicsBody();
}

Fixed version (ground truth):
private void init(CGPoint position){
  SKTextureAtlas atlas=new SKTextureAtlas("String_Node_Str");
  shadowBlob=new SKSpriteNode(atlas.getTexture("String_Node_Str"));
  shadowBlob.setZPosition(-1.0);
  setPosition(position);
  health=100.0;
  movementSpeed=MOVEMENT_SPEED;
  animated=true;
  animationSpeed=1 / 28.0;
  configurePhysicsBody();
}
Program: 10400
Project: 10400
Buggy source:
public static void loadSharedAssets(){
  if (sharedDamageEmitter == null) {
    SKTextureAtlas atlas=SKTextureAtlas.create("String_Node_Str");
    sharedIdleAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",DEFAULT_NUMBER_OF_IDLE_FRAMES);
    sharedWalkAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",DEFAULT_NUMBER_OF_WALK_FRAMES);
    sharedAttackAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",ATTACK_FRAMES);
    sharedGetHitAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",GET_HIT_FRAMES);
    sharedDeathAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",DEATH_FRAMES);
    sharedDamageEmitter=APAUtils.getEmitterNodeByName("String_Node_Str");
    sharedDeathSplort=SKSpriteNode.create(atlas.getTexture("String_Node_Str"));
    sharedDamageAction=SKAction.sequence(new NSArray<SKAction>(SKAction.colorize(UIColor.white(),1.0,0.0),SKAction.wait(0.75),SKAction.colorize(0.0,0.1)));
  }
}

Fixed version (ground truth):
public static void loadSharedAssets(){
  if (sharedDamageEmitter == null) {
    SKTextureAtlas atlas=new SKTextureAtlas("String_Node_Str");
    sharedIdleAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",DEFAULT_NUMBER_OF_IDLE_FRAMES);
    sharedWalkAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",DEFAULT_NUMBER_OF_WALK_FRAMES);
    sharedAttackAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",ATTACK_FRAMES);
    sharedGetHitAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",GET_HIT_FRAMES);
    sharedDeathAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",DEATH_FRAMES);
    sharedDamageEmitter=APAUtils.getEmitterNodeByName("String_Node_Str");
    sharedDeathSplort=new SKSpriteNode(atlas.getTexture("String_Node_Str"));
    sharedDamageAction=SKAction.sequence(new NSArray<SKAction>(SKAction.colorize(UIColor.white(),1.0,0.0),SKAction.wait(0.75),SKAction.colorize(0.0,0.1)));
  }
}
Program: 10401
Project: 10401
Buggy source:
public APAGoblin(CGPoint position){
  super(SKTextureAtlas.create("String_Node_Str").getTexture("String_Node_Str"),position);
  movementSpeed=MOVEMENT_SPEED * Math.random();
  setScale(MINIMUM_SIZE + (Math.random() * SIZE_VARIANCE));
  setZPosition(-0.25);
  setName("String_Node_Str");
  intelligence=new APAChaseAI(this,null);
}

Fixed version (ground truth):
public APAGoblin(CGPoint position){
  super(new SKTextureAtlas("String_Node_Str").getTexture("String_Node_Str"),position);
  movementSpeed=MOVEMENT_SPEED * Math.random();
  setScale(MINIMUM_SIZE + (Math.random() * SIZE_VARIANCE));
  setZPosition(-0.25);
  setName("String_Node_Str");
  intelligence=new APAChaseAI(this,null);
}
Program: 10402
Project: 10402
Buggy source:
public static void loadSharedAssets(){
  if (sharedProjectile == null) {
    SKTextureAtlas atlas=SKTextureAtlas.create("String_Node_Str");
    sharedProjectile=SKSpriteNode.create(atlas.getTexture("String_Node_Str"));
    sharedProjectile.setPhysicsBody(SKPhysicsBody.createCircle(PROJECTILE_COLLISION_RADIUS));
    sharedProjectile.setName("String_Node_Str");
    sharedProjectile.getPhysicsBody().setCategoryBitMask(APAColliderType.Projectile);
    sharedProjectile.getPhysicsBody().setCollisionBitMask(APAColliderType.Wall);
    sharedProjectile.getPhysicsBody().setContactTestBitMask(sharedProjectile.getPhysicsBody().getCollisionBitMask());
    sharedProjectileEmitter=APAUtils.getEmitterNodeByName("String_Node_Str");
    sharedIdleAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",IDLE_FRAMES);
    sharedWalkAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",DEFAULT_NUMBER_OF_WALK_FRAMES);
    sharedAttackAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",THROW_FRAMES);
    sharedGetHitAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",GET_HIT_FRAMES);
    sharedDeathAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",DEATH_FRAMES);
    sharedDamageAction=SKAction.sequence(new NSArray<SKAction>(SKAction.colorize(UIColor.red(),10,0),SKAction.wait(0.5),SKAction.colorize(0.0,0.25)));
  }
}

Fixed version (ground truth):
public static void loadSharedAssets(){
  if (sharedProjectile == null) {
    SKTextureAtlas atlas=new SKTextureAtlas("String_Node_Str");
    sharedProjectile=new SKSpriteNode(atlas.getTexture("String_Node_Str"));
    sharedProjectile.setPhysicsBody(SKPhysicsBody.createCircle(PROJECTILE_COLLISION_RADIUS));
    sharedProjectile.setName("String_Node_Str");
    sharedProjectile.getPhysicsBody().setCategoryBitMask(APAColliderType.Projectile);
    sharedProjectile.getPhysicsBody().setCollisionBitMask(APAColliderType.Wall);
    sharedProjectile.getPhysicsBody().setContactTestBitMask(sharedProjectile.getPhysicsBody().getCollisionBitMask());
    sharedProjectileEmitter=APAUtils.getEmitterNodeByName("String_Node_Str");
    sharedIdleAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",IDLE_FRAMES);
    sharedWalkAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",DEFAULT_NUMBER_OF_WALK_FRAMES);
    sharedAttackAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",THROW_FRAMES);
    sharedGetHitAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",GET_HIT_FRAMES);
    sharedDeathAnimationFrames=APAUtils.loadFramesFromAtlas("String_Node_Str","String_Node_Str",DEATH_FRAMES);
    sharedDamageAction=SKAction.sequence(new NSArray<SKAction>(SKAction.colorize(UIColor.red(),10,0),SKAction.wait(0.5),SKAction.colorize(0.0,0.25)));
  }
}
Program: 10403
Project: 10403
Buggy source:
public APAWarrior(CGPoint position,APAPlayer player){
  super(SKTextureAtlas.create("String_Node_Str").getTexture("String_Node_Str"),position,player);
}

Fixed version (ground truth):
public APAWarrior(CGPoint position,APAPlayer player){
  super(new SKTextureAtlas("String_Node_Str").getTexture("String_Node_Str"),position,player);
}
Program: 10404
Project: 10404
Buggy source:
public static NSArray<SKTexture> loadFramesFromAtlas(String atlasName,String baseFileName,int numberOfFrames){
  NSArray<SKTexture> frames=new NSMutableArray<>(numberOfFrames);
  SKTextureAtlas atlas=SKTextureAtlas.create(atlasName);
  for (int i=1; i <= numberOfFrames; i++) {
    String fileName=String.format("String_Node_Str",baseFileName,i);
    SKTexture texture=atlas.getTexture(fileName);
    frames.add(texture);
  }
  return frames;
}

Fixed version (ground truth):
public static NSArray<SKTexture> loadFramesFromAtlas(String atlasName,String baseFileName,int numberOfFrames){
  NSArray<SKTexture> frames=new NSMutableArray<>(numberOfFrames);
  SKTextureAtlas atlas=new SKTextureAtlas(atlasName);
  for (int i=1; i <= numberOfFrames; i++) {
    String fileName=String.format("String_Node_Str",baseFileName,i);
    SKTexture texture=atlas.getTexture(fileName);
    frames.add(texture);
  }
  return frames;
}
Program: 10405
Project: 10405
Buggy source:
private static CGImage getCGImage(String name){
  int ix=name.lastIndexOf('/');
  if (ix != -1)   name=name.substring(ix);
  UIImage uiImage=UIImage.create(name);
  return uiImage.getCGImage();
}

Fixed version (ground truth):
private static CGImage getCGImage(String name){
  int ix=name.lastIndexOf('/');
  if (ix != -1)   name=name.substring(ix);
  UIImage uiImage=UIImage.getImage(name);
  return uiImage.getCGImage();
}
Program: 10407
Project: 10407
Buggy source:
/** 
 * Locates the file representing the root page of the settings for this app, invokes loadDefaults:fromSettingsPage:inSettingsBundleAtURL: on it, and registers the loaded values as the app's defaults.
 */
private void populateRegistrationDomain(){
  NSURL settingsBundleURL=NSBundle.getMainBundle().findResourceURL("String_Node_Str","String_Node_Str");
  NSDictionary<?,?> appDefaults=loadDefaults("String_Node_Str",settingsBundleURL);
  NSUserDefaults.getStandardUserDefaults().registerDefaults(appDefaults);
  NSUserDefaults.getStandardUserDefaults().synchronize();
}

Fixed version (ground truth):
/** 
 * Locates the file representing the root page of the settings for this app, invokes loadDefaults:fromSettingsPage:inSettingsBundleAtURL: on it, and registers the loaded values as the app's defaults.
 */
private void populateRegistrationDomain(){
  NSURL settingsBundleURL=NSBundle.getMainBundle().findResourceURL("String_Node_Str","String_Node_Str");
  NSDictionary<NSString,?> appDefaults=loadDefaults("String_Node_Str",settingsBundleURL);
  NSUserDefaults.getStandardUserDefaults().registerDefaults(appDefaults);
  NSUserDefaults.getStandardUserDefaults().synchronize();
}
Program: 10408
Project: 10408
Buggy source:
@Override public void draw(CGRect rect){
  CGContext context=UIGraphics.getCurrentContext();
  context.saveGState();
  UIBezierPath bezierPath=UIBezierPath.createFromRoundedRect(rect,5);
  bezierPath.setLineWidth(5);
  UIColor.black().setStroke();
  UIColor fillColor=UIColor.fromRGBA(0.529,0.808,0.922,1);
  fillColor.setFill();
  bezierPath.stroke();
  bezierPath.fill();
  context.restoreGState();
}

Fixed version (ground truth):
@Override public void draw(CGRect rect){
  CGContext context=UIGraphics.getCurrentContext();
  context.saveGState();
  UIBezierPath bezierPath=UIBezierPath.newRoundedRect(rect,5);
  bezierPath.setLineWidth(5);
  UIColor.black().setStroke();
  UIColor fillColor=UIColor.fromRGBA(0.529,0.808,0.922,1);
  fillColor.setFill();
  bezierPath.stroke();
  bezierPath.fill();
  context.restoreGState();
}
Program: 10409
Project: 10409
Buggy source:
@Override public UICollectionViewCell getCellForItem(UICollectionView collectionView,NSIndexPath indexPath){
  Cell cell=(Cell)collectionView.dequeueReusableCell(CELL_ID,indexPath);
  cell.getLabel().setText(String.format("String_Node_Str",indexPath.getRow(),indexPath.getSection()));
  cell.getImage().setImage(UIImage.create(String.valueOf(indexPath.getRow()) + "String_Node_Str"));
  return cell;
}

Fixed version (ground truth):
@Override public UICollectionViewCell getCellForItem(UICollectionView collectionView,NSIndexPath indexPath){
  Cell cell=(Cell)collectionView.dequeueReusableCell(CELL_ID,indexPath);
  cell.getLabel().setText(String.format("String_Node_Str",indexPath.getRow(),indexPath.getSection()));
  cell.getImage().setImage(UIImage.getImage(String.valueOf(indexPath.getRow()) + "String_Node_Str"));
  return cell;
}
Program: 10410
Project: 10410
Buggy source:
@Override public void didSelectItem(UICollectionView collectionView,NSIndexPath indexPath){
  UIImage image=UIImage.create(String.format("String_Node_Str",indexPath.getRow()));
  detailViewController.setImage(image);
  getNavigationController().pushViewController(detailViewController,true);
}

Fixed version (ground truth):
@Override public void didSelectItem(UICollectionView collectionView,NSIndexPath indexPath){
  UIImage image=UIImage.getImage(String.format("String_Node_Str",indexPath.getRow()));
  detailViewController.setImage(image);
  getNavigationController().pushViewController(detailViewController,true);
}
Program: 10413
Project: 10413
Buggy source:
private void addRegion(){
  if (CLLocationManager.isRegionMonitoringAvailable()) {
    CLLocationCoordinate2D coord=new CLLocationCoordinate2D(regionsMapView.getCenterCoordinate().getLatitude(),regionsMapView.getCenterCoordinate().getLongitude());
    CLRegion newRegion=new CLRegion(coord,1000,String.format("String_Node_Str",regionsMapView.getCenterCoordinate().getLatitude(),regionsMapView.getCenterCoordinate().getLongitude()));
    RegionAnnotation regionAnnotation=new RegionAnnotation(newRegion);
    regionAnnotation.setCoordinate(newRegion.getCenter());
    regionAnnotation.setRadius(newRegion.getRadius());
    regionsMapView.addAnnotation(regionAnnotation);
    locationManager.startMonitoring(newRegion,CLLocationAccuracy.Best);
    newRegion.release();
  }
 else {
    System.out.println("String_Node_Str");
  }
}

Fixed version (ground truth):
private void addRegion(){
  if (CLLocationManager.isRegionMonitoringAvailable()) {
    CLLocationCoordinate2D coord=new CLLocationCoordinate2D(regionsMapView.getCenterCoordinate().getLatitude(),regionsMapView.getCenterCoordinate().getLongitude());
    CLRegion newRegion=new CLRegion(coord,1000,String.format("String_Node_Str",regionsMapView.getCenterCoordinate().getLatitude(),regionsMapView.getCenterCoordinate().getLongitude()));
    RegionAnnotation regionAnnotation=new RegionAnnotation(newRegion);
    regionAnnotation.setCoordinate(newRegion.getCenter());
    regionAnnotation.setRadius(newRegion.getRadius());
    regionsMapView.addAnnotation(regionAnnotation);
    locationManager.startMonitoring(newRegion);
    newRegion.release();
  }
 else {
    System.out.println("String_Node_Str");
  }
}
Program: 10415
Project: 10415
Buggy source:
@Override public void didChangeDragState(MKMapView mapView,MKAnnotationView view,MKAnnotationViewDragState newState,MKAnnotationViewDragState oldState){
  if (view instanceof RegionAnnotationView) {
    RegionAnnotationView regionView=(RegionAnnotationView)view;
    RegionAnnotation regionAnnotation=(RegionAnnotation)regionView.getAnnotation();
    if (newState == MKAnnotationViewDragState.Starting) {
      regionView.removeRadiusOverlay();
      locationManager.stopMonitoring(regionAnnotation.getRegion());
    }
    if (oldState == MKAnnotationViewDragState.Dragging && newState == MKAnnotationViewDragState.Ending) {
      regionView.updateRadiusOverlay();
      CLRegion newRegion=new CLRegion(regionAnnotation.getCoordinate(),1000,String.format("String_Node_Str",regionAnnotation.getCoordinate().getLatitude(),regionAnnotation.getCoordinate().getLongitude()));
      regionAnnotation.setRegion(newRegion);
      newRegion.release();
      locationManager.startMonitoring(regionAnnotation.getRegion(),CLLocationAccuracy.Best);
    }
  }
}

Fixed version (ground truth):
@Override public void didChangeDragState(MKMapView mapView,MKAnnotationView view,MKAnnotationViewDragState newState,MKAnnotationViewDragState oldState){
  if (view instanceof RegionAnnotationView) {
    RegionAnnotationView regionView=(RegionAnnotationView)view;
    RegionAnnotation regionAnnotation=(RegionAnnotation)regionView.getAnnotation();
    if (newState == MKAnnotationViewDragState.Starting) {
      regionView.removeRadiusOverlay();
      locationManager.stopMonitoring(regionAnnotation.getRegion());
    }
    if (oldState == MKAnnotationViewDragState.Dragging && newState == MKAnnotationViewDragState.Ending) {
      regionView.updateRadiusOverlay();
      CLRegion newRegion=new CLRegion(regionAnnotation.getCoordinate(),1000,String.format("String_Node_Str",regionAnnotation.getCoordinate().getLatitude(),regionAnnotation.getCoordinate().getLongitude()));
      regionAnnotation.setRegion(newRegion);
      newRegion.release();
      locationManager.startMonitoring(regionAnnotation.getRegion());
    }
  }
}
Program: 10418
Project: 10418
Buggy source:
@Override public void didFinish(MFMessageComposeViewController controller,MessageComposeResult result){
  dismissViewController(true,null);
}

Fixed version (ground truth):
@Override public void didFinish(MFMessageComposeViewController controller,MFMessageComposeResult result){
  dismissViewController(true,null);
}
Program: 10419
Project: 10419
Buggy source:
private void updateImage(){
  lastImageViewSize=imageView.getBounds().getSize();
  double scale=UIScreen.getMainScreen().getScale();
  CGSize targetSize=new CGSize(imageView.getBounds().getWidth() * scale,imageView.getBounds().getHeight() * scale);
  PHImageRequestOptions options=new PHImageRequestOptions();
  options.setNetworkAccessAllowed(true);
  options.setProgressHandler(new VoidBlock4<Double,NSError,BooleanPtr,NSDictionary<NSString,NSObject>>(){
    @Override public void invoke(    final Double progress,    NSError error,    BooleanPtr c,    NSDictionary<NSString,NSObject> d){
      DispatchQueue.getMainQueue().async(new Runnable(){
        @Override public void run(){
          progressView.setProgress(progress.floatValue());
          progressView.setHidden(progress <= 0 || progress >= 1);
        }
      }
);
    }
  }
);
  PHImageManager.getDefaultManager().requestImageForAsset(asset,targetSize,PHImageContentMode.AspectFill,options,new VoidBlock2<UIImage,NSDictionary<NSString,NSObject>>(){
    @Override public void invoke(    final UIImage result,    NSDictionary<NSString,NSObject> info){
      if (result != null) {
        imageView.setImage(result);
      }
    }
  }
);
}

Fixed version (ground truth):
private void updateImage(){
  lastImageViewSize=imageView.getBounds().getSize();
  double scale=UIScreen.getMainScreen().getScale();
  CGSize targetSize=new CGSize(imageView.getBounds().getWidth() * scale,imageView.getBounds().getHeight() * scale);
  PHImageRequestOptions options=new PHImageRequestOptions();
  options.setNetworkAccessAllowed(true);
  options.setProgressHandler(new VoidBlock4<Double,NSError,BooleanPtr,NSDictionary<?,?>>(){
    @Override public void invoke(    final Double progress,    NSError error,    BooleanPtr c,    NSDictionary<?,?> d){
      DispatchQueue.getMainQueue().async(new Runnable(){
        @Override public void run(){
          progressView.setProgress(progress.floatValue());
          progressView.setHidden(progress <= 0 || progress >= 1);
        }
      }
);
    }
  }
);
  PHImageManager.getDefaultManager().requestImageForAsset(asset,targetSize,PHImageContentMode.AspectFill,options,new VoidBlock2<UIImage,NSDictionary<NSString,NSObject>>(){
    @Override public void invoke(    final UIImage result,    NSDictionary<NSString,NSObject> info){
      if (result != null) {
        imageView.setImage(result);
      }
    }
  }
);
}