nus-yam/ex-repair huggingface dataset:
Program: 8887
Project: 8887
Buggy source:
/** 
 * Get a random tile, that is not a starting tile
 * @param start starting coordinates
 * @param radius radius, in tiles
 * @param creature
 * @return a random tile if one is found
 */
public Point findRandomAccessibleTile(Point start,int radius,Creature creature){
  List<Point> tiles=new ArrayList<>(radius * radius - 1);
  for (int y=start.y - radius / 2; y < start.y + radius / 2; y++) {
    for (int x=start.x - radius / 2; x < start.x + radius / 2; x++) {
      if (x == start.x && y == start.y) {
        continue;
      }
      TileData tile=getMapLoader().getTile(x,y);
      if (tile != null && isAccessible(tile,creature)) {
        tiles.add(new Point(x,y));
      }
    }
  }
  if (!tiles.isEmpty()) {
    return Utils.getRandomItem(tiles);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Get a random tile, that is not a starting tile
 * @param start starting coordinates
 * @param radius radius, in tiles
 * @param creature
 * @return a random tile if one is found
 */
public Point findRandomAccessibleTile(Point start,int radius,Creature creature){
  List<Point> tiles=new ArrayList<>(radius * radius - 1);
  for (int y=start.y - radius / 2; y < start.y + radius / 2; y++) {
    for (int x=start.x - radius / 2; x < start.x + radius / 2; x++) {
      if (x == start.x && y == start.y) {
        continue;
      }
      TileData tile=getMapData().getTile(x,y);
      if (tile != null && isAccessible(tile,creature)) {
        tiles.add(new Point(x,y));
      }
    }
  }
  if (!tiles.isEmpty()) {
    return Utils.getRandomItem(tiles);
  }
  return null;
}
Program: 8888
Project: 8888
Buggy source:
@Override public void initialize(final AppStateManager stateManager,final Application app){
  this.app=(Main)app;
  this.stateManager=stateManager;
  this.assetManager=app.getAssetManager();
  BulletAppState bulletAppState=new BulletAppState();
  this.stateManager.attach(bulletAppState);
  kwdFile=this.stateManager.getState(GameState.class).getLevelData();
  this.mapLoader=new MapLoader(assetManager,kwdFile){
    @Override protected void updateProgress(    int progress,    int max){
      WorldState.this.updateProgress(progress,max);
    }
  }
;
  worldNode.attachChild(mapLoader.load(assetManager,kwdFile));
  pathFindingMap=new MapIndexedGraph(this,kwdFile);
  pathFinder=new MapPathFinder(pathFindingMap,false);
  heuristic=new MapDistance();
  thingsNode=(Node)new ThingLoader(this).load(bulletAppState,assetManager,kwdFile);
  worldNode.attachChild(thingsNode);
  this.app.getRootNode().attachChild(worldNode);
  super.initialize(stateManager,app);
}

Fixed version (ground truth):
@Override public void initialize(final AppStateManager stateManager,final Application app){
  this.app=(Main)app;
  this.stateManager=stateManager;
  this.assetManager=app.getAssetManager();
  BulletAppState bulletAppState=new BulletAppState();
  this.stateManager.attach(bulletAppState);
  kwdFile=this.stateManager.getState(GameState.class).getLevelData();
  this.mapLoader=new MapLoader(assetManager,kwdFile){
    @Override protected void updateProgress(    int progress,    int max){
      WorldState.this.updateProgress(progress,max);
    }
  }
;
  worldNode.attachChild(mapLoader.load(assetManager,kwdFile));
  pathFindingMap=new MapIndexedGraph(this);
  pathFinder=new MapPathFinder(pathFindingMap,false);
  heuristic=new MapDistance();
  thingsNode=(Node)new ThingLoader(this).load(bulletAppState,assetManager,kwdFile);
  worldNode.attachChild(thingsNode);
  this.app.getRootNode().attachChild(worldNode);
  super.initialize(stateManager,app);
}
Program: 8889
Project: 8889
Buggy source:
/** 
 * FIXME: This can NOT be. Just for quick easy testing.
 * @param start start point
 * @param end end point
 * @param creature the creature to find path for
 * @return output path
 */
public GraphPath<TileData> findPath(Point start,Point end,Creature creature){
  pathFindingMap.setCreature(creature);
  GraphPath<TileData> outPath=new DefaultGraphPath<>();
  pathFinder.searchNodePath(getMapLoader().getTile(start.x,start.y),getMapLoader().getTile(end.x,end.y),heuristic,outPath);
  return outPath;
}

Fixed version (ground truth):
/** 
 * FIXME: This can NOT be. Just for quick easy testing.
 * @param start start point
 * @param end end point
 * @param creature the creature to find path for
 * @return output path
 */
public GraphPath<TileData> findPath(Point start,Point end,Creature creature){
  pathFindingMap.setCreature(creature);
  GraphPath<TileData> outPath=new DefaultGraphPath<>();
  pathFinder.searchNodePath(getMapData().getTile(start.x,start.y),getMapData().getTile(end.x,end.y),heuristic,outPath);
  return outPath;
}
Program: 8890
Project: 8890
Buggy source:
public void wander(){
  PrioritySteering<Vector2> prioritySteering=new PrioritySteering(this,0.0001f);
  RaycastCollisionDetector<Vector2> raycastCollisionDetector=new CreatureRayCastCollisionDetector(worldHandler);
  RaycastObstacleAvoidance<Vector2> raycastObstacleAvoidanceSB=new RaycastObstacleAvoidance<>(this,new SingleRayConfiguration<Vector2>(this,1.5f),raycastCollisionDetector,0.5f);
  prioritySteering.add(raycastObstacleAvoidanceSB);
  prioritySteering.add(new Wander<>(this).setFaceEnabled(false).setAlignTolerance(0.001f).setDecelerationRadius(5).setTimeToTarget(0.1f).setWanderOffset(10).setWanderOrientation(10).setWanderRadius(10).setWanderRate(FastMath.TWO_PI * 4));
  setSteeringBehavior(prioritySteering);
}

Fixed version (ground truth):
public void wander(){
  PrioritySteering<Vector2> prioritySteering=new PrioritySteering(this,0.0001f);
  RaycastCollisionDetector<Vector2> raycastCollisionDetector=new CreatureRayCastCollisionDetector(worldState);
  RaycastObstacleAvoidance<Vector2> raycastObstacleAvoidanceSB=new RaycastObstacleAvoidance<>(this,new SingleRayConfiguration<>(this,1.5f),raycastCollisionDetector,0.5f);
  prioritySteering.add(raycastObstacleAvoidanceSB);
  prioritySteering.add(new Wander<>(this).setFaceEnabled(false).setAlignTolerance(0.001f).setDecelerationRadius(5).setTimeToTarget(0.1f).setWanderOffset(10).setWanderOrientation(10).setWanderRadius(10).setWanderRate(FastMath.TWO_PI * 4));
  setSteeringBehavior(prioritySteering);
}
Program: 8891
Project: 8891
Buggy source:
private void navigateToRandomPoint(){
  Point p=worldHandler.findRandomAccessibleTile(worldHandler.getTileCoordinates(getSpatial().getLocalTranslation()),10,creature);
  if (p != null) {
    GraphPath<TileData> outPath=worldHandler.findPath(worldHandler.getTileCoordinates(getSpatial().getWorldTranslation()),p,creature);
    if (outPath.getCount() > 1) {
      PrioritySteering<Vector2> prioritySteering=new PrioritySteering(this,0.0001f);
      FollowPath<Vector2,LinePathParam> followPath=new FollowPath(this,new LinePath<>(pathToArray(outPath),true),2);
      followPath.setDecelerationRadius(1f);
      followPath.setArrivalTolerance(0.2f);
      prioritySteering.add(followPath);
      setSteeringBehavior(prioritySteering);
    }
  }
}

Fixed version (ground truth):
private void navigateToRandomPoint(){
  Point p=worldState.findRandomAccessibleTile(worldState.getTileCoordinates(getSpatial().getLocalTranslation()),10,creature);
  if (p != null) {
    GraphPath<TileData> outPath=worldState.findPath(worldState.getTileCoordinates(getSpatial().getWorldTranslation()),p,creature);
    if (outPath.getCount() > 1) {
      PrioritySteering<Vector2> prioritySteering=new PrioritySteering(this,0.0001f);
      FollowPath<Vector2,LinePathParam> followPath=new FollowPath(this,new LinePath<>(pathToArray(outPath),true),2);
      followPath.setDecelerationRadius(1f);
      followPath.setArrivalTolerance(0.2f);
      prioritySteering.add(followPath);
      setSteeringBehavior(prioritySteering);
    }
  }
}
Program: 8892
Project: 8892
Buggy source:
public CreatureControl(Thing.Creature creatureInstance,Creature creature,WorldHandler worldHandler){
  super(creature);
  stateMachine=new DefaultStateMachine<>(this);
  this.worldHandler=worldHandler;
  ResourceBundle bundle=Main.getResourceBundle("String_Node_Str");
  tooltip=bundle.getString(Integer.toString(creature.getTooltipStringId()));
  name=Utils.generateCreatureName();
  bloodType=Utils.generateBloodType();
  gold=creatureInstance.getGoldHeld();
  health=creature.getHp();
  if (creatureInstance instanceof KeeperCreature) {
    health=((KeeperCreature)creatureInstance).getInitialHealth();
    level=((KeeperCreature)creatureInstance).getLevel();
    ownerId=((KeeperCreature)creatureInstance).getPlayerId();
  }
 else   if (creatureInstance instanceof GoodCreature) {
    health=((GoodCreature)creatureInstance).getInitialHealth();
    level=((GoodCreature)creatureInstance).getLevel();
    ownerId=Player.GOOD_PLAYER_ID;
  }
 else   if (creatureInstance instanceof NeutralCreature) {
    health=((NeutralCreature)creatureInstance).getInitialHealth();
    level=((NeutralCreature)creatureInstance).getLevel();
    ownerId=Player.NEUTRAL_PLAYER_ID;
  }
 else   if (creatureInstance instanceof DeadBody) {
    ownerId=((DeadBody)creatureInstance).getPlayerId();
  }
}

Fixed version (ground truth):
public CreatureControl(Thing.Creature creatureInstance,Creature creature,WorldState worldState){
  super(creature);
  stateMachine=new DefaultStateMachine<>(this);
  this.worldState=worldState;
  ResourceBundle bundle=Main.getResourceBundle("String_Node_Str");
  tooltip=bundle.getString(Integer.toString(creature.getTooltipStringId()));
  name=Utils.generateCreatureName();
  bloodType=Utils.generateBloodType();
  gold=creatureInstance.getGoldHeld();
  health=creature.getHp();
  if (creatureInstance instanceof KeeperCreature) {
    health=((KeeperCreature)creatureInstance).getInitialHealth();
    level=((KeeperCreature)creatureInstance).getLevel();
    ownerId=((KeeperCreature)creatureInstance).getPlayerId();
  }
 else   if (creatureInstance instanceof GoodCreature) {
    health=((GoodCreature)creatureInstance).getInitialHealth();
    level=((GoodCreature)creatureInstance).getLevel();
    ownerId=Player.GOOD_PLAYER_ID;
  }
 else   if (creatureInstance instanceof NeutralCreature) {
    health=((NeutralCreature)creatureInstance).getInitialHealth();
    level=((NeutralCreature)creatureInstance).getLevel();
    ownerId=Player.NEUTRAL_PLAYER_ID;
  }
 else   if (creatureInstance instanceof DeadBody) {
    ownerId=((DeadBody)creatureInstance).getPlayerId();
  }
}
Program: 8894
Project: 8894
Buggy source:
/** 
 * Find room wall sections, continuous sections facing the same way
 * @param tiles tiles
 * @param roomInstance room instance
 */
private void findRoomWallSections(RoomInstance roomInstance){
  if (hasRoomWalls(roomInstance.getRoom())) {
    List<WallSection> sections=new ArrayList<>();
    Map<Point,Set<WallDirection>> alreadyWalledPoints=new HashMap<>();
    for (    Point p : roomInstance.getCoordinates()) {
      traverseRoomWalls(p,roomInstance,WallDirection.NORTH,sections,alreadyWalledPoints);
      traverseRoomWalls(p,roomInstance,WallDirection.EAST,sections,alreadyWalledPoints);
      traverseRoomWalls(p,roomInstance,WallDirection.SOUTH,sections,alreadyWalledPoints);
      traverseRoomWalls(p,roomInstance,WallDirection.WEST,sections,alreadyWalledPoints);
    }
    roomInstance.setWallPoints(sections);
  }
}

Fixed version (ground truth):
/** 
 * Find room wall sections, continuous sections facing the same way
 * @param tiles tiles
 * @param roomInstance room instance
 */
private void findRoomWallSections(RoomInstance roomInstance){
  if (hasRoomWalls(roomInstance.getRoom())) {
    List<WallSection> sections=new ArrayList<>();
    Map<Point,Set<WallDirection>> alreadyWalledPoints=new HashMap<>();
    for (    Point p : roomInstance.getCoordinates()) {
      traverseRoomWalls(p,roomInstance,WallDirection.NORTH,sections,alreadyWalledPoints);
      traverseRoomWalls(p,roomInstance,WallDirection.EAST,sections,alreadyWalledPoints);
      traverseRoomWalls(p,roomInstance,WallDirection.SOUTH,sections,alreadyWalledPoints);
      traverseRoomWalls(p,roomInstance,WallDirection.WEST,sections,alreadyWalledPoints);
    }
    roomInstance.setWallSections(sections);
  }
}
Program: 8897
Project: 8897
Buggy source:
@Override protected boolean isActive(TriggerGenericData trigger){
  boolean result=super.isActive(trigger);
  if (result) {
    return result;
  }
  result=false;
  float target=0;
  TriggerGeneric.TargetType targetType=trigger.getType();
switch (targetType) {
case CREATURE_CREATED:
    return false;
case CREATURE_KILLED:
  return false;
case CREATURE_SLAPPED:
return false;
case CREATURE_ATTACKED:
return false;
case CREATURE_IMPRISONED:
return false;
case CREATURE_TORTURED:
return false;
case CREATURE_CONVERTED:
return false;
case CREATURE_CLAIMED:
return false;
case CREATURE_ANGRY:
return false;
case CREATURE_AFRAID:
return false;
case CREATURE_STEALS:
return false;
case CREATURE_LEAVES:
return false;
case CREATURE_STUNNED:
return false;
case CREATURE_DYING:
return false;
case CREATURE_HEALTH:
return false;
case CREATURE_GOLD_HELD:
return false;
case CREATURE_EXPERIENCE_LEVEL:
return false;
case CREATURE_HUNGER_SATED:
return false;
case CREATURE_PICKS_UP_PORTAL_GEM:
return false;
case CREATURE_SACKED:
return false;
case CREATURE_PICKED_UP:
return false;
}
TriggerGeneric.ComparisonType comparisonType=trigger.getComparison();
if (comparisonType != null && comparisonType != TriggerGeneric.ComparisonType.NONE) {
result=compare(target,comparisonType,(int)trigger.getUserData("String_Node_Str"));
}
return result;
}

Fixed version (ground truth):
@Override protected boolean isActive(TriggerGenericData trigger){
  boolean result=super.isActive(trigger);
  if (checked) {
    return result;
  }
  result=false;
  float target=0;
  TriggerGeneric.TargetType targetType=trigger.getType();
switch (targetType) {
case CREATURE_CREATED:
    return false;
case CREATURE_KILLED:
  return false;
case CREATURE_SLAPPED:
return false;
case CREATURE_ATTACKED:
return false;
case CREATURE_IMPRISONED:
return false;
case CREATURE_TORTURED:
return false;
case CREATURE_CONVERTED:
return false;
case CREATURE_CLAIMED:
return false;
case CREATURE_ANGRY:
return false;
case CREATURE_AFRAID:
return false;
case CREATURE_STEALS:
return false;
case CREATURE_LEAVES:
return false;
case CREATURE_STUNNED:
return false;
case CREATURE_DYING:
return false;
case CREATURE_HEALTH:
return false;
case CREATURE_GOLD_HELD:
return false;
case CREATURE_EXPERIENCE_LEVEL:
return false;
case CREATURE_HUNGER_SATED:
return false;
case CREATURE_PICKS_UP_PORTAL_GEM:
return false;
case CREATURE_SACKED:
return false;
case CREATURE_PICKED_UP:
return false;
default :
logger.warning("String_Node_Str");
return false;
}
}
Program: 8898
Project: 8898
Buggy source:
@Override public void initialize(AppStateManager stateManager,Application app){
  super.initialize(stateManager,app);
  this.stateManager=stateManager;
  this.app=(Main)app;
  actionPoints=new HashMap<>();
  for (  Thing thing : stateManager.getState(GameState.class).getLevelData().getThings()) {
    if (thing instanceof Thing.ActionPoint) {
      Thing.ActionPoint temp=(Thing.ActionPoint)thing;
      ActionPoint ap=new ActionPoint(temp);
      if (temp.getTriggerId() != 0) {
        ap.addControl(new ActionPointTriggerControl(this.app,temp.getTriggerId()));
      }
      actionPoints.put(ap.getId(),ap);
    }
  }
}

Fixed version (ground truth):
@Override public void initialize(AppStateManager stateManager,Application app){
  super.initialize(stateManager,app);
  this.stateManager=stateManager;
  this.app=(Main)app;
  actionPoints=new HashMap<>();
  for (  Thing thing : this.stateManager.getState(GameState.class).getLevelData().getThings()) {
    if (thing instanceof Thing.ActionPoint) {
      Thing.ActionPoint temp=(Thing.ActionPoint)thing;
      ActionPoint ap=new ActionPoint(temp);
      if (temp.getTriggerId() != 0) {
        ap.addControl(new ActionPointTriggerControl(this.app,temp.getTriggerId()));
      }
      actionPoints.put(ap.getId(),ap);
    }
  }
}
Program: 8900
Project: 8900
Buggy source:
private static File getFile(){
  return new File(AssetsConverter.getCurrentFolder().concat(HISCORES_FILENAME));
}

Fixed version (ground truth):
private static File getFile(){
  return new File(AssetsConverter.getAssetsFolder() + HISCORES_FILENAME);
}
Program: 8901
Project: 8901
Buggy source:
protected void setCreated(boolean created){
  this.created=created;
}

Fixed version (ground truth):
public void setCreated(boolean created){
  this.created=created;
}
Program: 8902
Project: 8902
Buggy source:
@Override protected boolean isActive(TriggerGenericData trigger){
  boolean result=super.isActive(trigger);
  if (result) {
    return result;
  }
  result=false;
  float target=0;
  int value=0;
  Party party=(Party)parent;
  TriggerGeneric.TargetType targetType=trigger.getType();
switch (targetType) {
case PARTY_CREATED:
    return party.isCreated();
case PARTY_MEMBERS_KILLED:
  short unknown=(short)trigger.getUserData("String_Node_Str");
value=(int)trigger.getUserData("String_Node_Str");
break;
case PARTY_MEMBERS_CAPTURED:
value=(int)trigger.getUserData("String_Node_Str");
break;
case PARTY_MEMBERS_INCAPACITATED:
unknown=(short)trigger.getUserData("String_Node_Str");
value=(int)trigger.getUserData("String_Node_Str");
break;
}
TriggerGeneric.ComparisonType comparisonType=trigger.getComparison();
if (comparisonType != null && comparisonType != TriggerGeneric.ComparisonType.NONE) {
result=compare(target,comparisonType,value);
}
return result;
}

Fixed version (ground truth):
@Override protected boolean isActive(TriggerGenericData trigger){
  boolean result=super.isActive(trigger);
  if (checked) {
    return result;
  }
  result=false;
  float target=0;
  int value=0;
  Party party=(Party)parent;
  TriggerGeneric.TargetType targetType=trigger.getType();
switch (targetType) {
case PARTY_CREATED:
    return party.isCreated();
case PARTY_MEMBERS_KILLED:
  short unknown=(short)trigger.getUserData("String_Node_Str");
value=(int)trigger.getUserData("String_Node_Str");
break;
case PARTY_MEMBERS_CAPTURED:
value=(int)trigger.getUserData("String_Node_Str");
break;
case PARTY_MEMBERS_INCAPACITATED:
unknown=(short)trigger.getUserData("String_Node_Str");
value=(int)trigger.getUserData("String_Node_Str");
break;
default :
logger.warning("String_Node_Str");
return false;
}
TriggerGeneric.ComparisonType comparisonType=trigger.getComparison();
if (comparisonType != null && comparisonType != TriggerGeneric.ComparisonType.NONE) {
result=compare(target,comparisonType,value);
}
return result;
}
Program: 8903
Project: 8903
Buggy source:
@Override public void updateControl(float tpf){
  if (parent == null || camera == null || !enabled) {
    return;
  }
  if (tick > 1) {
    parent.removeControl(this);
    return;
  }
  Vector3f look=FastMath.interpolateLinear(tick,from,to);
  camera.setLookAt(look);
  tick+=tpf / SPEED;
}

Fixed version (ground truth):
@Override public void updateControl(float tpf){
  if (parent == null || camera == null || !enabled) {
    return;
  }
  if (tick > 1) {
    parent.removeControl(this);
    return;
  }
  Vector3f look=FastMath.interpolateLinear(tick,from,to);
  camera.setLookAt(look);
  tick+=tpf * SPEED;
}
Program: 8904
Project: 8904
Buggy source:
/** 
 * Check if given tile is accessible by the given creature
 * @param tile the tile
 * @param creature creature
 * @return is accessible
 */
public boolean isAccessible(TileData tile,Creature creature){
  Terrain terrain=tile.getTerrain();
  if (!terrain.getFlags().contains(Terrain.TerrainFlag.SOLID)) {
    if (creature.getFlags().contains(Creature.CreatureFlag.CAN_FLY)) {
      return true;
    }
 else     if (terrain.getFlags().contains(Terrain.TerrainFlag.LAVA) && creature.getFlags().contains(Creature.CreatureFlag.CAN_WALK_ON_LAVA)) {
      return true;
    }
 else     if (terrain.getFlags().contains(Terrain.TerrainFlag.WATER) && creature.getFlags().contains(Creature.CreatureFlag.CAN_WALK_ON_WATER)) {
      return true;
    }
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Check if given tile is accessible by the given creature
 * @param tile the tile
 * @param creature creature
 * @return is accessible
 */
public boolean isAccessible(TileData tile,Creature creature){
  Terrain terrain=tile.getTerrain();
  if (!terrain.getFlags().contains(Terrain.TerrainFlag.SOLID)) {
    if (creature.getFlags().contains(Creature.CreatureFlag.CAN_FLY)) {
      return true;
    }
 else     if (terrain.getFlags().contains(Terrain.TerrainFlag.LAVA) && !creature.getFlags().contains(Creature.CreatureFlag.CAN_WALK_ON_LAVA)) {
      return false;
    }
 else     if (terrain.getFlags().contains(Terrain.TerrainFlag.WATER) && !creature.getFlags().contains(Creature.CreatureFlag.CAN_WALK_ON_WATER)) {
      return false;
    }
    return true;
  }
  return false;
}
Program: 8905
Project: 8905
Buggy source:
/** 
 * Get tile coordinates from 3D coordinates
 * @param translation position
 * @return tile coordinates
 */
public Point getTileCoordinates(Vector3f translation){
  return new Point((int)Math.floor(translation.x),(int)Math.floor(translation.z));
}

Fixed version (ground truth):
/** 
 * Get tile coordinates from 3D coordinates
 * @param location position
 * @return tile coordinates
 */
public Point getTileCoordinates(Vector3f location){
  return new Point((int)Math.floor(location.x),(int)Math.floor(location.z));
}
Program: 8906
Project: 8906
Buggy source:
/** 
 * Checks if this terrain piece is actually a room and the room type has walls
 * @param terrain the terrain piece
 * @return true if this is a room and it has its own walls
 */
private boolean hasRoomWalls(Terrain terrain){
  ArtResource ceilingResource=getCeilingResource(terrain);
  if (ceilingResource == null && terrain.getCompleteResource() == null) {
    Room room=kwdFile.getRoomByTerrain(terrain.getTerrainId());
    return room.getFlags().contains(Room.RoomFlag.HAS_WALLS) || room.getTileConstruction() == Room.TileConstruction.HERO_GATE_FRONT_END || room.getTileConstruction() == Room.TileConstruction.HERO_GATE_3_BY_1 || room.getTileConstruction() == Room.TileConstruction.HERO_GATE;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Checks if this terrain piece is actually a room and the room type has walls
 * @param terrain the terrain piece
 * @return true if this is a room and it has its own walls
 */
private boolean hasRoomWalls(Terrain terrain){
  ArtResource ceilingResource=getCeilingResource(terrain);
  if (ceilingResource == null && terrain.getCompleteResource() == null) {
    Room room=kwdFile.getRoomByTerrain(terrain.getTerrainId());
    return room.getFlags().contains(Room.RoomFlag.HAS_WALLS) || room.getTileConstruction() == Room.TileConstruction.HERO_GATE_FRONT_END || room.getTileConstruction() == Room.TileConstruction.HERO_GATE_3_BY_1;
  }
  return false;
}
Program: 8908
Project: 8908
Buggy source:
@Override protected void contructFloor(Node n){
  Point start=roomInstance.getCoordinates().get(0);
  for (  Point p : roomInstance.getCoordinates()) {
    int piece=2;
    float yAngle=0;
    boolean N=roomInstance.hasCoordinate(new Point(p.x,p.y - 1));
    boolean E=roomInstance.hasCoordinate(new Point(p.x + 1,p.y));
    boolean S=roomInstance.hasCoordinate(new Point(p.x,p.y + 1));
    boolean W=roomInstance.hasCoordinate(new Point(p.x - 1,p.y));
    if (!N && E && W) {
      piece=1;
    }
 else     if (!S && !E && !W) {
      piece=9;
    }
 else     if (!W) {
      piece=3;
    }
 else     if (!E) {
      piece=3;
      yAngle=-2 * FastMath.HALF_PI;
    }
    Node tile=(Node)assetManager.loadModel(AssetsConverter.MODELS_FOLDER + "String_Node_Str" + roomInstance.getRoom().getCompleteResource().getName()+ piece+ "String_Node_Str");
    resetAndMoveSpatial(tile,start,p);
    if (yAngle != 0) {
      tile.rotate(0,yAngle,0);
    }
    n.attachChild(tile);
  }
  n.move(start.x * MapLoader.TILE_WIDTH - MapLoader.TILE_WIDTH / 2,0,start.y * MapLoader.TILE_WIDTH - MapLoader.TILE_WIDTH / 2);
  n.scale(MapLoader.TILE_WIDTH);
}

Fixed version (ground truth):
@Override protected void contructFloor(Node n){
  Point start=roomInstance.getCoordinates().get(0);
  String modelName=roomInstance.getRoom().getCompleteResource().getName();
  for (  Point p : roomInstance.getCoordinates()) {
    Spatial tile;
    int piece=2;
    float yAngle=0;
    boolean N=roomInstance.hasCoordinate(new Point(p.x,p.y - 1));
    boolean E=roomInstance.hasCoordinate(new Point(p.x + 1,p.y));
    boolean S=roomInstance.hasCoordinate(new Point(p.x,p.y + 1));
    boolean W=roomInstance.hasCoordinate(new Point(p.x - 1,p.y));
    if (!N && E && W) {
      piece=1;
    }
 else     if (!S && !E && !W) {
      tile=assetManager.loadModel(AssetsConverter.MODELS_FOLDER + "String_Node_Str" + roomInstance.getRoom().getCapResource().getName()+ "String_Node_Str");
      resetAndMoveSpatial(tile,start,p);
      n.attachChild(tile);
      piece=9;
    }
 else     if (!W) {
      piece=3;
    }
 else     if (!E) {
      piece=3;
      yAngle=-2 * FastMath.HALF_PI;
    }
    tile=assetManager.loadModel(AssetsConverter.MODELS_FOLDER + "String_Node_Str" + modelName+ piece+ "String_Node_Str");
    resetAndMoveSpatial(tile,start,p);
    if (yAngle != 0) {
      tile.rotate(0,yAngle,0);
    }
    n.attachChild(tile);
  }
  n.move(start.x * MapLoader.TILE_WIDTH - MapLoader.TILE_WIDTH / 2,0,start.y * MapLoader.TILE_WIDTH - MapLoader.TILE_WIDTH / 2);
  n.scale(MapLoader.TILE_WIDTH);
}
Program: 8909
Project: 8909
Buggy source:
/** 
 * Loads up an instance of the engine textures catalog
 * @param dungeonKeeperFolder DK II folder
 * @return EngineTextures catalog
 */
public static EngineTexturesFile getEngineTexturesFile(String dungeonKeeperFolder){
  String dataDirectory=dungeonKeeperFolder.concat("String_Node_Str").concat(File.separator);
  EngineTexturesFile etFile=new EngineTexturesFile(new File(dataDirectory.concat("String_Node_Str")));
  return etFile;
}

Fixed version (ground truth):
/** 
 * Loads up an instance of the engine textures catalog
 * @param dungeonKeeperFolder DK II folder
 * @return EngineTextures catalog
 */
public static EngineTexturesFile getEngineTexturesFile(String dungeonKeeperFolder){
  try {
    EngineTexturesFile etFile=new EngineTexturesFile(new File(Utils.getRealFileName(dungeonKeeperFolder,"String_Node_Str".concat(File.separator).concat("String_Node_Str"))));
    return etFile;
  }
 catch (  IOException e) {
    throw new RuntimeException("String_Node_Str",e);
  }
}
Program: 8913
Project: 8913
Buggy source:
@Override public void request(long n){
  final DebugNotification<T> dn=DebugNotification.createRequest(o,from,to,n);
  C context=listener.start(dn);
  try {
    producer.request(n);
    listener.complete(context);
  }
 catch (  Throwable e) {
    listener.error(context,e);
  }
}

Fixed version (ground truth):
@Override public void request(long n){
  final DebugNotification<T> dn=DebugNotification.createRequest(o,from,to,n);
  C context=listener.start(dn);
  try {
    producer.request(n);
    listener.complete(context);
  }
 catch (  Throwable e) {
    listener.error(context,e);
    throw Exceptions.propagate(e);
  }
}
Program: 8914
Project: 8914
Buggy source:
@Override public void onStart(){
  final DebugNotification<T> n=DebugNotification.createStart(o,from,to);
  C context=listener.start(n);
  try {
    o.onStart();
    listener.complete(context);
  }
 catch (  Throwable e) {
    listener.error(context,e);
  }
}

Fixed version (ground truth):
@Override public void onStart(){
  final DebugNotification<T> n=DebugNotification.createStart(o,from,to);
  C context=listener.start(n);
  try {
    o.onStart();
    listener.complete(context);
  }
 catch (  Throwable e) {
    listener.error(context,e);
    throw Exceptions.propagate(e);
  }
}
Program: 8915
Project: 8915
Buggy source:
@Override public void onError(Throwable e){
  final DebugNotification<T> n=DebugNotification.createOnError(o,from,e,to);
  C context=listener.start(n);
  try {
    o.onError(e);
    listener.complete(context);
  }
 catch (  Throwable e2) {
    listener.error(context,e2);
  }
}

Fixed version (ground truth):
@Override public void onError(Throwable e){
  final DebugNotification<T> n=DebugNotification.createOnError(o,from,e,to);
  C context=listener.start(n);
  try {
    o.onError(e);
    listener.complete(context);
  }
 catch (  Throwable e2) {
    listener.error(context,e2);
    throw Exceptions.propagate(e);
  }
}
Program: 8916
Project: 8916
Buggy source:
@Override public void onCompleted(){
  final DebugNotification<T> n=DebugNotification.createOnCompleted(o,from,to);
  C context=listener.start(n);
  try {
    o.onCompleted();
    listener.complete(context);
  }
 catch (  Throwable e) {
    listener.error(context,e);
  }
}

Fixed version (ground truth):
@Override public void onCompleted(){
  final DebugNotification<T> n=DebugNotification.createOnCompleted(o,from,to);
  C context=listener.start(n);
  try {
    o.onCompleted();
    listener.complete(context);
  }
 catch (  Throwable e) {
    listener.error(context,e);
    throw Exceptions.propagate(e);
  }
}
Program: 8917
Project: 8917
Buggy source:
@Override public void setProducer(final Producer producer){
  o.setProducer(new Producer(){
    @Override public void request(    long n){
      final DebugNotification<T> dn=DebugNotification.createRequest(o,from,to,n);
      C context=listener.start(dn);
      try {
        producer.request(n);
        listener.complete(context);
      }
 catch (      Throwable e) {
        listener.error(context,e);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override public void setProducer(final Producer producer){
  o.setProducer(new Producer(){
    @Override public void request(    long n){
      final DebugNotification<T> dn=DebugNotification.createRequest(o,from,to,n);
      C context=listener.start(dn);
      try {
        producer.request(n);
        listener.complete(context);
      }
 catch (      Throwable e) {
        listener.error(context,e);
        throw Exceptions.propagate(e);
      }
    }
  }
);
}
Program: 8918
Project: 8918
Buggy source:
@Override public void onNext(T t){
  final DebugNotification<T> n=DebugNotification.createOnNext(o,from,t,to);
  t=(T)listener.onNext(n);
  C context=listener.start(n);
  try {
    o.onNext(t);
    listener.complete(context);
  }
 catch (  Throwable e) {
    listener.error(context,e);
  }
}

Fixed version (ground truth):
@Override public void onNext(T t){
  final DebugNotification<T> n=DebugNotification.createOnNext(o,from,t,to);
  t=(T)listener.onNext(n);
  C context=listener.start(n);
  try {
    o.onNext(t);
    listener.complete(context);
  }
 catch (  Throwable e) {
    listener.error(context,e);
    throw Exceptions.propagate(e);
  }
}
Program: 8919
Project: 8919
Buggy source:
@Override public void unsubscribe(){
  final DebugNotification<T> n=DebugNotification.<T>createUnsubscribe(debugObserver.getActual(),debugObserver.getFrom(),debugObserver.getTo());
  C context=listener.start(n);
  try {
    debugObserver.unsubscribe();
    listener.complete(context);
  }
 catch (  Throwable e) {
    listener.error(context,e);
  }
}

Fixed version (ground truth):
@Override public void unsubscribe(){
  final DebugNotification<T> n=DebugNotification.<T>createUnsubscribe(debugObserver.getActual(),debugObserver.getFrom(),debugObserver.getTo());
  C context=listener.start(n);
  try {
    debugObserver.unsubscribe();
    listener.complete(context);
  }
 catch (  Throwable e) {
    listener.error(context,e);
    throw Exceptions.propagate(e);
  }
}
Program: 8920
Project: 8920
Buggy source:
@Override public <T>OnSubscribe<T> onSubscribeStart(final Observable<? extends T> observableInstance,final OnSubscribe<T> f){
  return new OnSubscribe<T>(){
    @Override public void call(    Subscriber<? super T> o){
      final DebugNotification<T> n=DebugNotification.createSubscribe(o,observableInstance,f);
      o=wrapOutbound(null,o);
      C context=listener.start(n);
      try {
        f.call(o);
        listener.complete(context);
      }
 catch (      Throwable e) {
        listener.error(context,e);
      }
    }
  }
;
}

Fixed version (ground truth):
@Override public <T>OnSubscribe<T> onSubscribeStart(final Observable<? extends T> observableInstance,final OnSubscribe<T> f){
  return new OnSubscribe<T>(){
    @Override public void call(    Subscriber<? super T> o){
      final DebugNotification<T> n=DebugNotification.createSubscribe(o,observableInstance,f);
      o=wrapOutbound(null,o);
      C context=listener.start(n);
      try {
        f.call(o);
        listener.complete(context);
      }
 catch (      Throwable e) {
        listener.error(context,e);
        throw Exceptions.propagate(e);
      }
    }
  }
;
}
Program: 8921
Project: 8921
Buggy source:
@Test public void testOneOp(){
  Action1<DebugNotification> events=mock(Action1.class);
  final DebugHook hook=new DebugHook(null,events);
  RxJavaPlugins.getInstance().registerObservableExecutionHook(hook);
  Observable.from(Arrays.asList(1,3)).flatMap(new Func1<Integer,Observable<Integer>>(){
    @Override public Observable<Integer> call(    Integer it){
      return Observable.from(Arrays.asList(it,it + 1));
    }
  }
).take(3).subscribe(new Observer<Integer>(){
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onNext(    Integer t){
    }
  }
);
  verify(events,times(6)).call(subscribe());
  verify(events,times(4)).call(onNext(1));
  verify(events,times(3)).call(onNext(2));
  verify(events,times(4)).call(onNext(3));
  verify(events,never()).call(onNext(4));
}

Fixed version (ground truth):
@Test public void testOneOp(){
  Action1<DebugNotification> events=mock(Action1.class);
  final DebugHook hook=new DebugHook(null,events);
  RxJavaPlugins.getInstance().registerObservableExecutionHook(hook);
  Observable.from(Arrays.asList(1,3)).flatMap(new Func1<Integer,Observable<Integer>>(){
    @Override public Observable<Integer> call(    Integer it){
      return Observable.from(Arrays.asList(it,it + 1));
    }
  }
).take(3).subscribe(new Observer<Integer>(){
    @Override public void onCompleted(){
    }
    @Override public void onError(    Throwable e){
    }
    @Override public void onNext(    Integer t){
    }
  }
);
  verify(events,atLeast(3)).call(subscribe());
  verify(events,times(4)).call(onNext(1));
  verify(events,times(3)).call(onNext(2));
  verify(events,times(4)).call(onNext(3));
  verify(events,never()).call(onNext(4));
}
Program: 8923
Project: 8923
Buggy source:
/** 
 * Removes   {@link #mHolder#rootView view} from window.
 * @see #attachToWindow()
 */
private void detachFromWindow(){
  mHolder.wm.removeView(mHolder.rootView);
}

Fixed version (ground truth):
/** 
 * Removes   {@link #mHolder#rootView view} from window.
 * @see #attachToWindow()
 */
private void detachFromWindow(){
  mHolder.wm.removeView(mHolder.rootView);
  mAttached=false;
}
Program: 8924
Project: 8924
Buggy source:
/** 
 * Adds   {@link #mHolder#rootView view} to window.
 * @see #detachFromWindow()
 */
private void attachToWindow(){
  WindowManager.LayoutParams lp=new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.WRAP_CONTENT,WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,PixelFormat.TRANSLUCENT);
  lp.gravity=Gravity.TOP | Gravity.CENTER_HORIZONTAL;
  mHolder.wm.addView(mHolder.rootView,lp);
}

Fixed version (ground truth):
/** 
 * Adds   {@link #mHolder#rootView view} to window.
 * @see #detachFromWindow()
 */
private void attachToWindow(){
  if (mAttached) {
    mHolder.rootView.clearAnimation();
    detachFromWindow();
  }
  mAttached=true;
  WindowManager.LayoutParams lp=new WindowManager.LayoutParams(WindowManager.LayoutParams.MATCH_PARENT,WindowManager.LayoutParams.WRAP_CONTENT,WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH| WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN,PixelFormat.TRANSLUCENT);
  lp.gravity=Gravity.TOP | Gravity.CENTER_HORIZONTAL;
  mHolder.wm.addView(mHolder.rootView,lp);
}
Program: 8925
Project: 8925
Buggy source:
void onStop(){
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  NotificationPresenter.getInstance().unregisterListener(this);
  getConfig().unregisterListener(this);
  mHolder.context.unregisterReceiver(mReceiver);
  mHandler.removeCallbacksAndMessages(null);
  mHolder=null;
}

Fixed version (ground truth):
void onStop(){
  if (DEBUG)   Log.d(TAG,"String_Node_Str");
  if (mAttached) {
    Log.w(TAG,"String_Node_Str");
    detachFromWindow();
  }
  NotificationPresenter.getInstance().unregisterListener(this);
  getConfig().unregisterListener(this);
  mHolder.context.unregisterReceiver(mReceiver);
  mHandler.removeCallbacksAndMessages(null);
  mHolder=null;
}
Program: 8926
Project: 8926
Buggy source:
@Override public int onNotificationChanged(@NonNull OpenNotification n,@NonNull OpenNotification old){
  NotificationData dataOld=old.getNotificationData();
  NotificationData dataNew=n.getNotificationData();
  if (dataNew.number == dataOld.number && TextUtils.equals(dataNew.titleText,dataOld.titleText) && TextUtils.equals(dataNew.messageText,dataOld.messageText) && TextUtils.equals(dataNew.infoText,dataOld.infoText)) {
    n.getNotificationData().markAsRead(old.getNotificationData().isRead);
    if (!n.isMine()) {
      notifyListeners(n,EVENT_CHANGED_SPAM);
      return RESULT_SPAM;
    }
  }
  notifyListeners(n,EVENT_CHANGED);
  return RESULT_SUCCESS;
}

Fixed version (ground truth):
@Override public int onNotificationChanged(@NonNull OpenNotification n,@NonNull OpenNotification old){
  NotificationData dataOld=old.getNotificationData();
  NotificationData dataNew=n.getNotificationData();
  if (dataNew.number == dataOld.number && TextUtils.equals(dataNew.titleText,dataOld.titleText) && TextUtils.equals(dataNew.titleBigText,dataOld.titleBigText) && TextUtils.equals(dataNew.messageText,dataOld.messageText) && TextUtils.equals(dataNew.infoText,dataOld.infoText)) {
    n.getNotificationData().markAsRead(old.getNotificationData().isRead);
    if (!n.isMine()) {
      notifyListeners(n,EVENT_CHANGED_SPAM);
      return RESULT_SPAM;
    }
  }
  notifyListeners(n,EVENT_CHANGED);
  return RESULT_SUCCESS;
}
Program: 8927
Project: 8927
Buggy source:
/** 
 * Returns   {@code false} if the notification doesn't fitthe requirements (such as not ongoing and clearable).
 */
private boolean isValidForLocal(@NonNull OpenNotification o){
  AppConfig config=mBlacklist.getAppConfig(o.getPackageName());
  if (config.isHidden()) {
    return false;
  }
  if (!o.isClearable() && !config.isNonClearableEnabled()) {
    return false;
  }
  if (o.getNotification().priority <= Notification.PRIORITY_LOW && !mConfig.isLowPriorityNotificationsAllowed()) {
    return false;
  }
  NotificationData data=o.getNotificationData();
  return !(TextUtils.isEmpty(data.titleText) && TextUtils.isEmpty(data.getMergedMessage()) && TextUtils.isEmpty(data.infoText));
}

Fixed version (ground truth):
/** 
 * Returns   {@code false} if the notification doesn't fitthe requirements (such as not ongoing and clearable).
 */
private boolean isValidForLocal(@NonNull OpenNotification o){
  AppConfig config=mBlacklist.getAppConfig(o.getPackageName());
  if (config.isHidden()) {
    return false;
  }
  if (!o.isClearable() && !config.isNonClearableEnabled()) {
    return false;
  }
  if (o.getNotification().priority <= Notification.PRIORITY_LOW && !mConfig.isLowPriorityNotificationsAllowed()) {
    return false;
  }
  NotificationData data=o.getNotificationData();
  return !(TextUtils.isEmpty(data.titleText) && TextUtils.isEmpty(data.titleBigText) && TextUtils.isEmpty(data.messageText)&& TextUtils.isEmpty(data.infoText)&& data.messageTextLines == null);
}
Program: 8928
Project: 8928
Buggy source:
@SuppressLint("String_Node_Str") public NotificationData loadTexts(Context context,OpenNotification openNotification,NotificationData data){
  while (true) {
    final Notification n=openNotification.getNotification();
    final Bundle extras=getExtras(n);
    if (extras != null) {
      data.titleText=extras.getCharSequence(Notification.EXTRA_TITLE_BIG);
      if (data.titleText == null) {
        data.titleText=extras.getCharSequence(Notification.EXTRA_TITLE);
      }
      data.infoText=extras.getCharSequence(Notification.EXTRA_INFO_TEXT);
      data.subText=extras.getCharSequence(Notification.EXTRA_SUB_TEXT);
      data.summaryText=extras.getCharSequence(Notification.EXTRA_SUMMARY_TEXT);
      data.messageText=Utils.removeSpaces(extras.getCharSequence(Notification.EXTRA_TEXT));
      CharSequence[] messageTextLines=extras.getCharSequenceArray(Notification.EXTRA_TEXT_LINES);
      if (messageTextLines != null) {
        ArrayList<CharSequence> messageTextList=new ArrayList<>();
        for (        CharSequence msg : messageTextLines) {
          msg=Utils.removeSpaces(msg);
          if (!TextUtils.isEmpty(msg)) {
            messageTextList.add(msg);
          }
        }
        messageTextLines=messageTextList.toArray(new CharSequence[messageTextList.size()]);
        data.messageTextLines=messageTextLines;
      }
    }
    final Context contextNotify=NotificationUtils.createContext(context,openNotification);
    final RemoteViews rvs=n.bigContentView == null ? n.contentView : n.bigContentView;
    if (rvs == null) {
      break;
    }
    LayoutInflater inflater=(LayoutInflater)contextNotify.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    ViewGroup view=(ViewGroup)inflater.inflate(rvs.getLayoutId(),null);
    if (view == null) {
      break;
    }
    try {
      rvs.reapply(contextNotify,view);
    }
 catch (    Exception e) {
      break;
    }
    ArrayList<TextView> textViews=new RecursiveFinder<>(TextView.class).expand(view);
    removeClickableViews(textViews);
    removeSubtextViews(context,textViews);
    removeActionViews(data.actions,textViews);
    if (textViews.size() == 0)     break;
    TextView title=findTitleTextView(textViews);
    textViews.remove(title);
    data.titleText=title.getText();
    if (textViews.size() == 0)     break;
    int length=textViews.size();
    CharSequence[] messages=new CharSequence[length];
    for (int i=0; i < length; i++) {
      messages[i]=textViews.get(i).getText();
    }
    data.messageText=Utils.mergeLargeMessage(messages);
    break;
  }
  return data;
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") public NotificationData loadTexts(Context context,OpenNotification openNotification,NotificationData data){
  final Notification n=openNotification.getNotification();
  final Bundle extras=getExtras(n);
  if (extras != null)   loadFromExtras(data,extras);
  if (TextUtils.isEmpty(data.titleText) && TextUtils.isEmpty(data.titleBigText) && TextUtils.isEmpty(data.messageText)&& data.messageTextLines == null) {
    loadFromView(data,context,openNotification);
  }
  return data;
}
Program: 8929
Project: 8929
Buggy source:
@SuppressLint("String_Node_Str") private Bundle getExtras(Notification notification){
  if (Device.hasKitKatApi()) {
    return notification.extras;
  }
  try {
    Field field=Notification.class.getDeclaredField("String_Node_Str");
    field.setAccessible(true);
    return (Bundle)field.get(notification);
  }
 catch (  Exception e) {
    Log.w(TAG,"String_Node_Str");
    return null;
  }
}

Fixed version (ground truth):
/** 
 * Gets a bundle with additional data from notification.
 */
@Nullable @SuppressLint("String_Node_Str") private Bundle getExtras(Notification notification){
  if (Device.hasKitKatApi()) {
    return notification.extras;
  }
  try {
    Field field=notification.getClass().getDeclaredField("String_Node_Str");
    field.setAccessible(true);
    return (Bundle)field.get(notification);
  }
 catch (  Exception e) {
    Log.w(TAG,"String_Node_Str");
    return null;
  }
}
Program: 8930
Project: 8930
Buggy source:
/** 
 * {@inheritDoc}
 */
@Override public void setNotification(OpenNotification osbn){
  mNotification=osbn;
  if (osbn == null) {
    return;
  }
  Notification n=osbn.getNotification();
  NotificationData data=osbn.getNotificationData();
  Bitmap bitmap=data.getCircleIcon();
  if (bitmap == null)   bitmap=n.largeIcon;
  if (bitmap != null) {
    if (bitmap == n.largeIcon && BitmapUtils.hasTransparentCorners(bitmap) && Color.red(data.dominantColor) > 127 && Color.blue(data.dominantColor) > 127 && Color.green(data.dominantColor) > 127 && hasDarkTextColor(mTitleTextView)) {
      mIcon.setColorFilter(mColorFilterDark);
    }
 else {
      mIcon.setColorFilter(null);
    }
    mIcon.setNotification(null);
    mIcon.setImageBitmap(bitmap);
    setSmallIcon(osbn);
  }
 else {
    mIcon.setNotification(osbn);
    mIcon.setColorFilter(hasDarkTextColor(mTitleTextView) ? mColorFilterDark : null);
    setSmallIcon(null);
  }
  mTitleTextView.setText(data.titleText);
  mSubtextTextView.setText(data.infoText == null ? data.subText : data.infoText);
  mWhenTextView.setText(DateUtils.formatDateTime(getContext(),n.when,DateUtils.FORMAT_SHOW_TIME));
  setActions(osbn);
  setMessageLines(data.messageTextLines == null ? data.messageText == null ? null : new CharSequence[]{data.messageText} : data.messageTextLines);
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@Override public void setNotification(OpenNotification osbn){
  mNotification=osbn;
  if (osbn == null) {
    return;
  }
  Notification n=osbn.getNotification();
  NotificationData data=osbn.getNotificationData();
  Bitmap bitmap=data.getCircleIcon();
  if (bitmap == null)   bitmap=n.largeIcon;
  if (bitmap != null) {
    if (bitmap == n.largeIcon && BitmapUtils.hasTransparentCorners(bitmap) && Color.red(data.dominantColor) > 127 && Color.blue(data.dominantColor) > 127 && Color.green(data.dominantColor) > 127 && hasDarkTextColor(mTitleTextView)) {
      mIcon.setColorFilter(mColorFilterDark);
    }
 else {
      mIcon.setColorFilter(null);
    }
    mIcon.setNotification(null);
    mIcon.setImageBitmap(bitmap);
    setSmallIcon(osbn);
  }
 else {
    mIcon.setNotification(osbn);
    mIcon.setColorFilter(hasDarkTextColor(mTitleTextView) ? mColorFilterDark : null);
    setSmallIcon(null);
  }
  mTitleTextView.setText(data.titleBigText == null ? data.titleText : data.titleBigText);
  mSubtextTextView.setText(data.infoText == null ? data.subText : data.infoText);
  mWhenTextView.setText(DateUtils.formatDateTime(getContext(),n.when,DateUtils.FORMAT_SHOW_TIME));
  setActions(osbn);
  setMessageLines(data.messageTextLines == null ? data.messageText == null ? null : new CharSequence[]{data.messageText} : data.messageTextLines);
}