nus-yam/ex-repair huggingface dataset:
Program: 83649
Project: 83649
Buggy source:
private void loadCommands(){
  this.commandTrie=new Trie<String,Map<Range<Integer>,OWCommand>>();
  this.registerCommand(new OWWarpCommand(this),1,1,"String_Node_Str");
  this.registerCommand(new OWWarpListCommand(this),0,0,"String_Node_Str");
  this.registerCommand(new OWWarpListCommand(this),"String_Node_Str","String_Node_Str");
  this.registerCommand(new OWWarpDetailCommand(this),"String_Node_Str","String_Node_Str");
  this.registerCommand(new OWWarpSetCommand(this),"String_Node_Str","String_Node_Str");
  this.registerCommand(new OWWarpSetCommand(this),"String_Node_Str");
  this.registerCommand(new OWQuotaShowCommand(this),"String_Node_Str","String_Node_Str","String_Node_Str");
  this.registerCommand(new OWQuotaUsageCommand(this),0,0,"String_Node_Str","String_Node_Str");
  this.registerCommand(new OWQuotaUsageCommand(this),"String_Node_Str","String_Node_Str","String_Node_Str");
  this.registerCommand(new OWTopCommand(this),"String_Node_Str");
  this.registerCommand(new OWJumpCommand(this),"String_Node_Str");
  this.registerCommand(new OWJumpCommand(this),"String_Node_Str");
  this.registerCommand(new OWBackCommand(this),"String_Node_Str");
}

Fixed version (ground truth):
private void loadCommands(){
  this.commandTrie=new Trie<String,Map<Range<Integer>,OWCommand>>();
  this.registerCommand(new OWWarpCommand(this),1,1,"String_Node_Str");
  this.registerCommand(new OWWarpListCommand(this),0,0,"String_Node_Str");
  this.registerCommand(new OWWarpListCommand(this),"String_Node_Str","String_Node_Str");
  this.registerCommand(new OWWarpDetailCommand(this),"String_Node_Str","String_Node_Str");
  this.registerCommand(new OWWarpSetCommand(this),"String_Node_Str","String_Node_Str");
  this.registerCommand(new OWWarpSetCommand(this),"String_Node_Str");
  this.registerCommand(new OWQuotaShowCommand(this),"String_Node_Str","String_Node_Str","String_Node_Str");
  this.registerCommand(new OWQuotaUsageCommand(this),0,0,"String_Node_Str","String_Node_Str");
  this.registerCommand(new OWQuotaUsageCommand(this),"String_Node_Str","String_Node_Str","String_Node_Str");
  this.registerCommand(new OWQuotaSetCommand(this),"String_Node_Str","String_Node_Str","String_Node_Str");
  this.registerCommand(new OWTopCommand(this),"String_Node_Str");
  this.registerCommand(new OWJumpCommand(this),"String_Node_Str");
  this.registerCommand(new OWJumpCommand(this),"String_Node_Str");
  this.registerCommand(new OWBackCommand(this),"String_Node_Str");
}
Program: 83650
Project: 83650
Buggy source:
/** 
 * Recursively add nodes to the command trie to insert the given OWCommand at the given key path. Overwrites any commands already in the trie at the given key path.
 * @param command The command to add to the trie
 * @param minimumArgs The smallest number of arguments the command can takewhen reached from the given key path
 * @param minimumArgs The largest number of arguments the command can takewhen reached from the given key path 
 * @param keys The key path to use for the new command
 */
private void registerCommand(OWCommand command,int minimumArgs,int maximumArgs,List<String> keys){
  if (keys.size() == 0) {
    return;
  }
  Map<Range<Integer>,OWCommand> commandMap=null;
  try {
    commandMap=this.commandTrie.get(keys);
  }
 catch (  IndexOutOfBoundsException e) {
    this.commandTrie.put(keys,new HashMap<Range<Integer>,OWCommand>());
    commandMap=this.commandTrie.get(keys);
  }
  commandMap.put(new Range<Integer>(minimumArgs,maximumArgs),command);
}

Fixed version (ground truth):
/** 
 * Recursively add nodes to the command trie to insert the given OWCommand at the given key path. Overwrites any commands already in the trie at the given key path.
 * @param command The command to add to the trie
 * @param minimumArgs The smallest number of arguments the command can takewhen reached from the given key path
 * @param minimumArgs The largest number of arguments the command can takewhen reached from the given key path 
 * @param keys The key path to use for the new command
 */
private void registerCommand(OWCommand command,int minimumArgs,int maximumArgs,List<String> keys){
  if (keys.size() == 0) {
    return;
  }
  Map<Range<Integer>,OWCommand> commandMap=null;
  try {
    commandMap=this.commandTrie.get(keys);
    if (commandMap == null) {
      this.commandTrie.put(keys,new HashMap<Range<Integer>,OWCommand>());
      commandMap=this.commandTrie.get(keys);
    }
  }
 catch (  IndexOutOfBoundsException e) {
    this.commandTrie.put(keys,new HashMap<Range<Integer>,OWCommand>());
    commandMap=this.commandTrie.get(keys);
  }
  commandMap.put(new Range<Integer>(minimumArgs,maximumArgs),command);
}
Program: 83651
Project: 83651
Buggy source:
public static List<String> trimListLeft(List<String> value,List<String> trim){
  List<String> result=new ArrayList<String>();
  boolean trimming=true;
  for (int i=0; i < value.size(); i++) {
    if (trimming && value.get(i).equals(trim.get(i))) {
      continue;
    }
 else {
      trimming=false;
      result.add(value.get(i));
    }
  }
  return result;
}

Fixed version (ground truth):
public static List<String> trimListLeft(List<String> value,List<String> trim){
  List<String> result=new ArrayList<String>();
  boolean trimming=true;
  for (int i=0; i < value.size(); i++) {
    if (i == trim.size()) {
      trimming=false;
    }
    if (trimming && value.get(i).equals(trim.get(i))) {
      continue;
    }
 else {
      trimming=false;
      result.add(value.get(i));
    }
  }
  return result;
}
Program: 83652
Project: 83652
Buggy source:
private void updateParticipantListing(){
  Participant[] sortedParticipants=participants.values().toArray(new Participant[participants.size()]);
  Arrays.sort(sortedParticipants);
  participantListing=new HTMLNode("String_Node_Str","String_Node_Str","String_Node_Str");
  participantListing.addChild("String_Node_Str",username + "String_Node_Str");
  for (  String name : sentInvites.values()) {
    participantListing.addChild("String_Node_Str",name + "String_Node_Str");
  }
  for (  Participant participant : sortedParticipants) {
    String routing;
    if (participant.directlyConnected) {
      routing=l10n("String_Node_Str",new String[]{"String_Node_Str","String_Node_Str"},new String[]{participant.peerNode.getName(),participant.peerNode.getIdentityString()});
    }
 else {
      routing=l10n("String_Node_Str",new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"},new String[]{participants.get(participant.peerNode.getPubKeyHash()).name,participant.peerNode.getName(),participant.peerNode.getIdentityString()});
    }
    Color nameColor=participant.nameColor;
    String color="String_Node_Str" + nameColor.getRed() + ','+ nameColor.getGreen()+ ','+ nameColor.getBlue()+ ')';
    participantListing.addChild("String_Node_Str","String_Node_Str",routing).addChild("String_Node_Str","String_Node_Str",color);
  }
}

Fixed version (ground truth):
private void updateParticipantListing(){
  Participant[] sortedParticipants=participants.values().toArray(new Participant[participants.size()]);
  Arrays.sort(sortedParticipants);
  participantListing=new HTMLNode("String_Node_Str","String_Node_Str","String_Node_Str");
  participantListing.addChild("String_Node_Str",username + "String_Node_Str");
  for (  String name : sentInvites.values()) {
    participantListing.addChild("String_Node_Str",name + "String_Node_Str");
  }
  for (  Participant participant : sortedParticipants) {
    String routing;
    if (participant.directlyConnected) {
      routing=l10n("String_Node_Str",new String[]{"String_Node_Str","String_Node_Str"},new String[]{participant.peerNode.getName(),participant.peerNode.getIdentityString()});
    }
 else {
      routing=l10n("String_Node_Str",new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"},new String[]{participants.get(participant.peerNode.getPubKeyHash()).name,participant.peerNode.getName(),participant.peerNode.getIdentityString()});
    }
    Color nameColor=participant.nameColor;
    String color="String_Node_Str" + nameColor.getRed() + ','+ nameColor.getGreen()+ ','+ nameColor.getBlue()+ ')';
    participantListing.addChild("String_Node_Str","String_Node_Str",routing).addChild("String_Node_Str","String_Node_Str",color,participant.name);
  }
  participantListing.addChild("String_Node_Str",sortedParticipants.length + "String_Node_Str");
}
Program: 83653
Project: 83653
Buggy source:
private boolean receiveInvite(DarknetPeerNode darkPeer,boolean inviteParticipant){
  if (!sentInvites.containsKey(darkPeer.getPubKeyHash())) {
    return false;
  }
  if (inviteParticipant) {
    inviteParticipant(darkPeer,sentInvites.get(darkPeer.getPubKeyHash()));
  }
  sentInvites.remove(darkPeer.getPubKeyHash());
  return true;
}

Fixed version (ground truth):
private boolean receiveInvite(DarknetPeerNode darkPeer,boolean inviteParticipant){
  if (!sentInvites.containsKey(darkPeer.getPubKeyHash())) {
    return false;
  }
  if (inviteParticipant) {
    inviteParticipant(darkPeer,sentInvites.get(darkPeer.getPubKeyHash()));
  }
  sentInvites.remove(darkPeer.getPubKeyHash());
  updateParticipantListing();
  return true;
}
Program: 83654
Project: 83654
Buggy source:
/** 
 * Adds a directly connected participant that was invited locally. This node will route messages to and from them.
 * @param darknetParticipant The peer that was invited.
 * @param username The name of this user as referred to within this chat.
 * @return True if the participant was added, false if not.
 */
public boolean inviteParticipant(DarknetPeerNode darknetParticipant,String username){
  if (addParticipant(darknetParticipant.getPubKeyHash(),darknetParticipant.getName(),darknetParticipant,true)) {
    for (    byte[] pubKeyHash : participants.keySet()) {
      if (pubKeyHash != darknetParticipant.getPubKeyHashHash() && participants.get(pubKeyHash).directlyConnected) {
        sendJoin(participants.get(pubKeyHash).peerNode,darknetParticipant.getPubKeyHash(),username);
        sendJoin(darknetParticipant,pubKeyHash,participants.get(pubKeyHash).name);
      }
    }
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Adds a directly connected participant that was invited locally. This node will route messages to and from them.
 * @param darknetParticipant The peer that was invited.
 * @param username The name of this user as referred to within this chat.
 * @return True if the participant was added, false if not.
 */
public boolean inviteParticipant(DarknetPeerNode darknetParticipant,String username){
  if (addParticipant(darknetParticipant.getPubKeyHash(),darknetParticipant.getName(),darknetParticipant,true)) {
    for (    byte[] pubKeyHash : participants.keySet()) {
      if (!Arrays.equals(pubKeyHash,darknetParticipant.getPubKeyHash()) && participants.get(pubKeyHash).directlyConnected) {
        sendJoin(participants.get(pubKeyHash).peerNode,darknetParticipant.getPubKeyHash(),username);
        sendJoin(darknetParticipant,pubKeyHash,participants.get(pubKeyHash).name);
      }
    }
    return true;
  }
  return false;
}
Program: 83656
Project: 83656
Buggy source:
private boolean checkItemPlacement(ItemInfo occupied[][][],ItemInfo item){
  for (int x=item.cellX; x < (item.cellX + item.spanX); x++) {
    for (int y=item.cellY; y < (item.cellY + item.spanY); y++) {
      if (occupied[item.screen][x][y] != null) {
        Log.e(TAG,"String_Node_Str" + item + "String_Node_Str"+ item.screen+ "String_Node_Str"+ x+ "String_Node_Str"+ y+ "String_Node_Str"+ occupied[item.screen][x][y]);
        return false;
      }
    }
  }
  for (int x=item.cellX; x < (item.cellX + item.spanX); x++) {
    for (int y=item.cellY; y < (item.cellY + item.spanY); y++) {
      occupied[item.screen][x][y]=item;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean checkItemPlacement(ItemInfo occupied[][][],ItemInfo item){
  if (item.container != LauncherSettings.Favorites.CONTAINER_DESKTOP) {
    return true;
  }
  for (int x=item.cellX; x < (item.cellX + item.spanX); x++) {
    for (int y=item.cellY; y < (item.cellY + item.spanY); y++) {
      if (occupied[item.screen][x][y] != null) {
        Log.e(TAG,"String_Node_Str" + item + "String_Node_Str"+ item.screen+ "String_Node_Str"+ x+ "String_Node_Str"+ y+ "String_Node_Str"+ occupied[item.screen][x][y]);
        return false;
      }
    }
  }
  for (int x=item.cellX; x < (item.cellX + item.spanX); x++) {
    for (int y=item.cellY; y < (item.cellY + item.spanY); y++) {
      occupied[item.screen][x][y]=item;
    }
  }
  return true;
}
Program: 83657
Project: 83657
Buggy source:
@Override protected void setChildrenDrawingCacheEnabled(boolean enabled){
  final int count=getChildCount();
  for (int i=0; i < count; i++) {
    final View view=getChildAt(i);
    view.setDrawingCacheEnabled(enabled);
    view.buildDrawingCache(false);
  }
}

Fixed version (ground truth):
@Override protected void setChildrenDrawingCacheEnabled(boolean enabled){
  final int count=getChildCount();
  for (int i=0; i < count; i++) {
    final View view=getChildAt(i);
    view.setDrawingCacheEnabled(enabled);
    view.buildDrawingCache(true);
  }
}
Program: 83660
Project: 83660
Buggy source:
/** 
 * Initializes various states for this workspace.
 */
private void initWorkspace(){
  Context context=getContext();
  mScroller=new Scroller(context,new OvershootInterpolator());
  mCurrentScreen=mDefaultScreen;
  Launcher.setScreen(mCurrentScreen);
  LauncherApplication app=(LauncherApplication)context.getApplicationContext();
  mIconCache=app.getIconCache();
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mPagingTouchSlop=configuration.getScaledPagingTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
}

Fixed version (ground truth):
/** 
 * Initializes various states for this workspace.
 */
private void initWorkspace(){
  Context context=getContext();
  mScrollInterpolator=new WorkspaceOvershootInterpolator();
  mScroller=new Scroller(context,mScrollInterpolator);
  mCurrentScreen=mDefaultScreen;
  Launcher.setScreen(mCurrentScreen);
  LauncherApplication app=(LauncherApplication)context.getApplicationContext();
  mIconCache=app.getIconCache();
  final ViewConfiguration configuration=ViewConfiguration.get(getContext());
  mTouchSlop=configuration.getScaledTouchSlop();
  mPagingTouchSlop=configuration.getScaledPagingTouchSlop();
  mMaximumVelocity=configuration.getScaledMaximumFlingVelocity();
}
Program: 83661
Project: 83661
Buggy source:
void snapToScreen(int whichScreen){
  whichScreen=Math.max(0,Math.min(whichScreen,getChildCount() - 1));
  clearVacantCache();
  enableChildrenCache(mCurrentScreen,whichScreen);
  final int screenDelta=Math.abs(whichScreen - mCurrentScreen);
  mNextScreen=whichScreen;
  mPreviousIndicator.setLevel(mNextScreen);
  mNextIndicator.setLevel(mNextScreen);
  View focusedChild=getFocusedChild();
  if (focusedChild != null && screenDelta != 0 && focusedChild == getChildAt(mCurrentScreen)) {
    focusedChild.clearFocus();
  }
  final int newX=whichScreen * getWidth();
  final int delta=newX - mScrollX;
  final int duration=screenDelta != 0 ? screenDelta * 300 : 300;
  awakenScrollBars(duration);
  if (!mScroller.isFinished())   mScroller.abortAnimation();
  mScroller.startScroll(mScrollX,0,delta,0,duration);
  invalidate();
}

Fixed version (ground truth):
void snapToScreen(int whichScreen){
  whichScreen=Math.max(0,Math.min(whichScreen,getChildCount() - 1));
  clearVacantCache();
  enableChildrenCache(mCurrentScreen,whichScreen);
  final int screenDelta=Math.abs(whichScreen - mCurrentScreen);
  mNextScreen=whichScreen;
  mPreviousIndicator.setLevel(mNextScreen);
  mNextIndicator.setLevel(mNextScreen);
  View focusedChild=getFocusedChild();
  if (focusedChild != null && screenDelta != 0 && focusedChild == getChildAt(mCurrentScreen)) {
    focusedChild.clearFocus();
  }
  final int newX=whichScreen * getWidth();
  final int delta=newX - mScrollX;
  final int duration=screenDelta != 0 ? 200 + screenDelta * 100 : 300;
  awakenScrollBars(duration);
  if (!mScroller.isFinished())   mScroller.abortAnimation();
  mScrollInterpolator.setDistance(screenDelta);
  mScroller.startScroll(mScrollX,0,delta,0,duration);
  invalidate();
}
Program: 83662
Project: 83662
Buggy source:
public void run(){
  mPosX=((float)mData[0]) / (1 << 16);
  mVelocity=((float)mData[1]) / (1 << 16);
  mZoom=((float)mData[2]) / (1 << 16);
  mZoomDirty=false;
}

Fixed version (ground truth):
public void run(){
  mRollo.mScrollPos=((float)mData[0]) / (1 << 16);
  mVelocity=((float)mData[1]) / (1 << 16);
  mZoom=((float)mData[2]) / (1 << 16);
  mZoomDirty=false;
}
Program: 83663
Project: 83663
Buggy source:
private boolean checkClickOK(){
  return (Math.abs(mAllApps.mVelocity) < 0.4f) && (Math.abs(mAllApps.mPosX - Math.round(mAllApps.mPosX)) < 0.4f);
}

Fixed version (ground truth):
private boolean checkClickOK(){
  return (Math.abs(mAllApps.mVelocity) < 0.4f) && (Math.abs(mScrollPos - Math.round(mScrollPos)) < 0.4f);
}
Program: 83664
Project: 83664
Buggy source:
private void gainFocus(){
  if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
    mArrowNavigation=true;
    mRollo.selectIcon(Math.round(mPosX) * mColumnsPerPage,SELECTED_FOCUSED);
    mRollo.mState.save();
  }
}

Fixed version (ground truth):
private void gainFocus(){
  if (!mArrowNavigation && mRollo.mState.iconCount > 0) {
    mArrowNavigation=true;
    mRollo.selectIcon(Math.round(mRollo.mScrollPos) * mColumnsPerPage,SELECTED_FOCUSED);
    mRollo.mState.save();
  }
}
Program: 83667
Project: 83667
Buggy source:
int chooseTappedIcon(int x,int y,float pos){
  y+=(pos - ((int)pos)) * (mTouchYBorders[1] - mTouchYBorders[0]);
  int col=-1;
  int row=-1;
  final int columnsCount=mAllApps.mColumnsPerPage;
  for (int i=0; i < columnsCount; i++) {
    if (x >= mTouchXBorders[i] && x < mTouchXBorders[i + 1]) {
      col=i;
      break;
    }
  }
  final int rowsCount=mAllApps.mRowsPerPage;
  for (int i=0; i < rowsCount; i++) {
    if (y >= mTouchYBorders[i] && y < mTouchYBorders[i + 1]) {
      row=i;
      break;
    }
  }
  if (row < 0 || col < 0) {
    return -1;
  }
  int index=(((int)pos) * columnsCount) + (row * columnsCount) + col;
  if (index >= mState.iconCount) {
    return -1;
  }
 else {
    return index;
  }
}

Fixed version (ground truth):
int chooseTappedIcon(int x,int y){
  float pos=mScrollPos;
  y+=(pos - ((int)pos)) * (mTouchYBorders[1] - mTouchYBorders[0]);
  int col=-1;
  int row=-1;
  final int columnsCount=mAllApps.mColumnsPerPage;
  for (int i=0; i < columnsCount; i++) {
    if (x >= mTouchXBorders[i] && x < mTouchXBorders[i + 1]) {
      col=i;
      break;
    }
  }
  final int rowsCount=mAllApps.mRowsPerPage;
  for (int i=0; i < rowsCount; i++) {
    if (y >= mTouchYBorders[i] && y < mTouchYBorders[i + 1]) {
      row=i;
      break;
    }
  }
  if (row < 0 || col < 0) {
    return -1;
  }
  int index=(((int)pos) * columnsCount) + (row * columnsCount) + col;
  if (index >= mState.iconCount) {
    return -1;
  }
 else {
    return index;
  }
}
Program: 83668
Project: 83668
Buggy source:
@Override public void onWindowFocusChanged(boolean hasWindowFocus){
  super.onWindowFocusChanged(hasWindowFocus);
  if (mSurrendered)   return;
  if (mArrowNavigation) {
    if (!hasWindowFocus) {
      mLastSelectedIcon=mRollo.mState.selectedIconIndex;
      mRollo.setHomeSelected(SELECTED_NONE);
      mRollo.clearSelectedIcon();
      mRollo.mState.save();
    }
 else {
      if (mRollo.mState.iconCount > 0) {
        if (mLastSelection == SELECTION_ICONS) {
          int selection=mLastSelectedIcon;
          final int firstIcon=Math.round(mPosX) * mColumnsPerPage;
          if (selection < 0 || selection < firstIcon || selection >= mRollo.mState.iconCount || selection >= firstIcon + (mColumnsPerPage * mRowsPerPage)) {
            selection=firstIcon;
          }
          mRollo.selectIcon(selection,SELECTED_FOCUSED);
          mRollo.mState.save();
        }
 else         if (mLastSelection == SELECTION_HOME) {
          mRollo.setHomeSelected(SELECTED_FOCUSED);
          mRollo.mState.save();
        }
      }
    }
  }
}

Fixed version (ground truth):
@Override public void onWindowFocusChanged(boolean hasWindowFocus){
  super.onWindowFocusChanged(hasWindowFocus);
  if (mSurrendered)   return;
  if (mArrowNavigation) {
    if (!hasWindowFocus) {
      mLastSelectedIcon=mRollo.mState.selectedIconIndex;
      mRollo.setHomeSelected(SELECTED_NONE);
      mRollo.clearSelectedIcon();
      mRollo.mState.save();
    }
 else {
      if (mRollo.mState.iconCount > 0) {
        if (mLastSelection == SELECTION_ICONS) {
          int selection=mLastSelectedIcon;
          final int firstIcon=Math.round(mRollo.mScrollPos) * mColumnsPerPage;
          if (selection < 0 || selection < firstIcon || selection >= mRollo.mState.iconCount || selection >= firstIcon + (mColumnsPerPage * mRowsPerPage)) {
            selection=firstIcon;
          }
          mRollo.selectIcon(selection,SELECTED_FOCUSED);
          mRollo.mState.save();
        }
 else         if (mLastSelection == SELECTION_HOME) {
          mRollo.setHomeSelected(SELECTED_FOCUSED);
          mRollo.mState.save();
        }
      }
    }
  }
}
Program: 83669
Project: 83669
Buggy source:
public void dumpState(){
  Log.d(TAG,"String_Node_Str" + mRS);
  Log.d(TAG,"String_Node_Str" + mRollo);
  ApplicationInfo.dumpApplicationInfoList(TAG,"String_Node_Str",mAllAppsList);
  Log.d(TAG,"String_Node_Str" + mArrowNavigation);
  Log.d(TAG,"String_Node_Str" + mStartedScrolling);
  Log.d(TAG,"String_Node_Str" + mLastSelection);
  Log.d(TAG,"String_Node_Str" + mLastSelectedIcon);
  Log.d(TAG,"String_Node_Str" + mVelocityTracker);
  Log.d(TAG,"String_Node_Str" + mTouchTracking);
  Log.d(TAG,"String_Node_Str" + mShouldGainFocus);
  Log.d(TAG,"String_Node_Str" + mZoomDirty);
  Log.d(TAG,"String_Node_Str" + mAnimateNextZoom);
  Log.d(TAG,"String_Node_Str" + mZoom);
  Log.d(TAG,"String_Node_Str" + mPosX);
  Log.d(TAG,"String_Node_Str" + mVelocity);
  Log.d(TAG,"String_Node_Str" + mMessageProc);
  if (mRollo != null) {
    mRollo.dumpState();
  }
  if (mRS != null) {
    mRS.contextDump(0);
  }
}

Fixed version (ground truth):
public void dumpState(){
  Log.d(TAG,"String_Node_Str" + mRS);
  Log.d(TAG,"String_Node_Str" + mRollo);
  ApplicationInfo.dumpApplicationInfoList(TAG,"String_Node_Str",mAllAppsList);
  Log.d(TAG,"String_Node_Str" + mArrowNavigation);
  Log.d(TAG,"String_Node_Str" + mStartedScrolling);
  Log.d(TAG,"String_Node_Str" + mLastSelection);
  Log.d(TAG,"String_Node_Str" + mLastSelectedIcon);
  Log.d(TAG,"String_Node_Str" + mVelocityTracker);
  Log.d(TAG,"String_Node_Str" + mTouchTracking);
  Log.d(TAG,"String_Node_Str" + mShouldGainFocus);
  Log.d(TAG,"String_Node_Str" + mZoomDirty);
  Log.d(TAG,"String_Node_Str" + mAnimateNextZoom);
  Log.d(TAG,"String_Node_Str" + mZoom);
  Log.d(TAG,"String_Node_Str" + mRollo.mScrollPos);
  Log.d(TAG,"String_Node_Str" + mVelocity);
  Log.d(TAG,"String_Node_Str" + mMessageProc);
  if (mRollo != null) {
    mRollo.dumpState();
  }
  if (mRS != null) {
    mRS.contextDump(0);
  }
}
Program: 83670
Project: 83670
Buggy source:
@Override public void surfaceDestroyed(SurfaceHolder holder){
  super.surfaceDestroyed(holder);
  mRS.mMessageCallback=null;
}

Fixed version (ground truth):
@Override public void surfaceDestroyed(SurfaceHolder holder){
  super.surfaceDestroyed(holder);
  mRS.mMessageCallback=null;
  mZoomDirty=true;
  mHaveSurface=false;
}
Program: 83671
Project: 83671
Buggy source:
void dirtyCheck(){
  if (mZoomDirty) {
    setZoom(mZoom,mAnimateNextZoom);
  }
}

Fixed version (ground truth):
void dirtyCheck(){
  if (mZoomDirty) {
    setZoom(mNextZoom,mAnimateNextZoom);
  }
}
Program: 83672
Project: 83672
Buggy source:
@Override public void surfaceChanged(SurfaceHolder holder,int format,int w,int h){
  super.surfaceChanged(holder,format,w,h);
  if (mRollo == null) {
    mRollo=new RolloRS();
    mRollo.init(getResources(),w,h);
    if (mAllAppsList != null) {
      mRollo.setApps(mAllAppsList);
    }
    if (mShouldGainFocus) {
      gainFocus();
      mShouldGainFocus=false;
    }
  }
  mRollo.dirtyCheck();
  mRollo.resize(w,h);
  mRS.mMessageCallback=mMessageProc=new AAMessage();
  Resources res=getContext().getResources();
  int barHeight=(int)res.getDimension(R.dimen.button_bar_height);
}

Fixed version (ground truth):
@Override public void surfaceChanged(SurfaceHolder holder,int format,int w,int h){
  super.surfaceChanged(holder,format,w,h);
  mHaveSurface=true;
  if (mRollo == null) {
    mRollo=new RolloRS();
    mRollo.init(getResources(),w,h);
    if (mAllAppsList != null) {
      mRollo.setApps(mAllAppsList);
    }
    if (mShouldGainFocus) {
      gainFocus();
      mShouldGainFocus=false;
    }
  }
  mRollo.dirtyCheck();
  mRollo.resize(w,h);
  mRS.mMessageCallback=mMessageProc=new AAMessage();
  Resources res=getContext().getResources();
  int barHeight=(int)res.getDimension(R.dimen.button_bar_height);
}
Program: 83673
Project: 83673
Buggy source:
/** 
 * Zoom to the specifed level.
 * @param zoom [0..1] 0 is hidden, 1 is open
 */
public void zoom(float zoom,boolean animate){
  cancelLongPress();
  if (mRollo == null) {
    mZoomDirty=true;
    mZoom=zoom;
    mAnimateNextZoom=animate;
    return;
  }
 else {
    mRollo.setZoom(zoom,animate);
  }
}

Fixed version (ground truth):
/** 
 * Zoom to the specifed level.
 * @param zoom [0..1] 0 is hidden, 1 is open
 */
public void zoom(float zoom,boolean animate){
  cancelLongPress();
  mNextZoom=zoom;
  mAnimateNextZoom=animate;
  if (mRollo == null || !mHaveSurface) {
    mZoomDirty=true;
    mZoom=zoom;
    return;
  }
 else {
    mRollo.setZoom(zoom,animate);
  }
}
Program: 83674
Project: 83674
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  closeSystemDialogs();
  String reason=intent.getStringExtra("String_Node_Str");
  if (!"String_Node_Str".equals(reason)) {
    boolean animate=true;
    closeAllApps(animate);
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  closeSystemDialogs();
  String reason=intent.getStringExtra("String_Node_Str");
  if (!"String_Node_Str".equals(reason)) {
    boolean animate=true;
    if (mPaused || "String_Node_Str".equals(reason)) {
      animate=false;
    }
    closeAllApps(animate);
  }
}
Program: 83675
Project: 83675
Buggy source:
@Override protected void onPause(){
  super.onPause();
  dismissPreview(mPreviousView);
  dismissPreview(mNextView);
  mDragController.cancelDrag();
  unregisterReceiver(mCloseSystemDialogsReceiver);
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  dismissPreview(mPreviousView);
  dismissPreview(mNextView);
  mDragController.cancelDrag();
}
Program: 83676
Project: 83676
Buggy source:
@Override public void onDestroy(){
  super.onDestroy();
  try {
    mAppWidgetHost.stopListening();
  }
 catch (  NullPointerException ex) {
    Log.w(TAG,"String_Node_Str",ex);
  }
  TextKeyListener.getInstance().release();
  mModel.stopLoader();
  unbindDesktopItems();
  AppInfoCache.unbindDrawables();
  getContentResolver().unregisterContentObserver(mWidgetObserver);
  dismissPreview(mPreviousView);
  dismissPreview(mNextView);
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  try {
    mAppWidgetHost.stopListening();
  }
 catch (  NullPointerException ex) {
    Log.w(TAG,"String_Node_Str",ex);
  }
  TextKeyListener.getInstance().release();
  mModel.stopLoader();
  unbindDesktopItems();
  AppInfoCache.unbindDrawables();
  getContentResolver().unregisterContentObserver(mWidgetObserver);
  dismissPreview(mPreviousView);
  dismissPreview(mNextView);
  unregisterReceiver(mCloseSystemDialogsReceiver);
}
Program: 83677
Project: 83677
Buggy source:
@Override protected void onResume(){
  super.onResume();
  IntentFilter filter=new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
  registerReceiver(mCloseSystemDialogsReceiver,filter);
  if (mRestoring) {
    mWorkspaceLoading=true;
    mModel.startLoader(this,true);
    mRestoring=false;
  }
  if (mIsNewIntent) {
    mWorkspace.post(new Runnable(){
      public void run(){
        stopSearch();
      }
    }
);
  }
  mIsNewIntent=false;
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  mPaused=false;
  if (mRestoring) {
    mWorkspaceLoading=true;
    mModel.startLoader(this,true);
    mRestoring=false;
  }
  if (mIsNewIntent) {
    mWorkspace.post(new Runnable(){
      public void run(){
        stopSearch();
      }
    }
);
  }
  mIsNewIntent=false;
}
Program: 83678
Project: 83678
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mModel=((LauncherApplication)getApplication()).setLauncher(this);
  mDragController=new DragController(this);
  mInflater=getLayoutInflater();
  mAppWidgetManager=AppWidgetManager.getInstance(this);
  mAppWidgetHost=new LauncherAppWidgetHost(this,APPWIDGET_HOST_ID);
  mAppWidgetHost.startListening();
  if (PROFILE_STARTUP) {
    android.os.Debug.startMethodTracing("String_Node_Str");
  }
  checkForLocaleChange();
  setWallpaperDimension();
  setContentView(R.layout.launcher);
  setupViews();
  registerContentObservers();
  lockAllApps();
  mSavedState=savedInstanceState;
  restoreState(mSavedState);
  if (PROFILE_STARTUP) {
    android.os.Debug.stopMethodTracing();
  }
  mModel.setAllAppsDirty();
  mModel.setWorkspaceDirty();
  if (!mRestoring) {
    mModel.startLoader(this,true);
  }
  mDefaultKeySsb=new SpannableStringBuilder();
  Selection.setSelection(mDefaultKeySsb,0);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mModel=((LauncherApplication)getApplication()).setLauncher(this);
  mDragController=new DragController(this);
  mInflater=getLayoutInflater();
  mAppWidgetManager=AppWidgetManager.getInstance(this);
  mAppWidgetHost=new LauncherAppWidgetHost(this,APPWIDGET_HOST_ID);
  mAppWidgetHost.startListening();
  if (PROFILE_STARTUP) {
    android.os.Debug.startMethodTracing("String_Node_Str");
  }
  checkForLocaleChange();
  setWallpaperDimension();
  setContentView(R.layout.launcher);
  setupViews();
  registerContentObservers();
  lockAllApps();
  mSavedState=savedInstanceState;
  restoreState(mSavedState);
  if (PROFILE_STARTUP) {
    android.os.Debug.stopMethodTracing();
  }
  mModel.setAllAppsDirty();
  mModel.setWorkspaceDirty();
  if (!mRestoring) {
    mModel.startLoader(this,true);
  }
  mDefaultKeySsb=new SpannableStringBuilder();
  Selection.setSelection(mDefaultKeySsb,0);
  IntentFilter filter=new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
  registerReceiver(mCloseSystemDialogsReceiver,filter);
}
Program: 83679
Project: 83679
Buggy source:
/** 
 * Things to test when changing this code. - Home from workspace - from center screen - from other screens - Home from all apps - Back from all apps - Launch app from workspace and quit - with back - with home - Launch app from all apps and quit - with back - with home - Go to a screen that's not the default, then all apps, and launch and app, and go back - with back -with home - On workspace, long press power and go back - with back - with home - On all apps, long press power and go back - with back - with home - On workspace, power off - On all apps, power off - Launch an app and turn off the screen while in that app - Go back with home key - Go back with back key - From all apps - From workspace
 */
void closeAllApps(boolean animated){
  if (mAllAppsGrid.isVisible()) {
    mAllAppsGrid.zoom(0.0f,animated);
    mAllAppsGrid.setFocusable(false);
    mWorkspace.getChildAt(mWorkspace.getCurrentScreen()).requestFocus();
    mWorkspace.startFading(true);
  }
}

Fixed version (ground truth):
/** 
 * Things to test when changing this code. - Home from workspace - from center screen - from other screens - Home from all apps - from center screen - from other screens - Back from all apps - from center screen - from other screens - Launch app from workspace and quit - with back - with home - Launch app from all apps and quit - with back - with home - Go to a screen that's not the default, then all apps, and launch and app, and go back - with back -with home - On workspace, long press power and go back - with back - with home - On all apps, long press power and go back - with back - with home - On workspace, power off - On all apps, power off - Launch an app and turn off the screen while in that app - Go back with home key - Go back with back key  TODO: make this not go to workspace - From all apps - From workspace
 */
void closeAllApps(boolean animated){
  if (mAllAppsGrid.isVisible()) {
    mAllAppsGrid.zoom(0.0f,animated);
    mAllAppsGrid.setFocusable(false);
    mWorkspace.getChildAt(mWorkspace.getCurrentScreen()).requestFocus();
    mWorkspace.startFading(true);
  }
}
Program: 83680
Project: 83680
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  closeSystemDialogs();
  String reason=intent.getStringExtra("String_Node_Str");
  if (!"String_Node_Str".equals(reason)) {
    boolean animate=true;
    closeAllApps(animate);
  }
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  closeSystemDialogs();
  String reason=intent.getStringExtra("String_Node_Str");
  if (!"String_Node_Str".equals(reason)) {
    boolean animate=true;
    if (mPaused || "String_Node_Str".equals(reason)) {
      animate=false;
    }
    closeAllApps(animate);
  }
}
Program: 83681
Project: 83681
Buggy source:
@Override protected void onPause(){
  super.onPause();
  dismissPreview(mPreviousView);
  dismissPreview(mNextView);
  mDragController.cancelDrag();
  unregisterReceiver(mCloseSystemDialogsReceiver);
}

Fixed version (ground truth):
@Override protected void onPause(){
  super.onPause();
  dismissPreview(mPreviousView);
  dismissPreview(mNextView);
  mDragController.cancelDrag();
}
Program: 83682
Project: 83682
Buggy source:
@Override public void onDestroy(){
  super.onDestroy();
  try {
    mAppWidgetHost.stopListening();
  }
 catch (  NullPointerException ex) {
    Log.w(TAG,"String_Node_Str",ex);
  }
  TextKeyListener.getInstance().release();
  mModel.stopLoader();
  unbindDesktopItems();
  AppInfoCache.unbindDrawables();
  getContentResolver().unregisterContentObserver(mWidgetObserver);
  dismissPreview(mPreviousView);
  dismissPreview(mNextView);
}

Fixed version (ground truth):
@Override public void onDestroy(){
  super.onDestroy();
  try {
    mAppWidgetHost.stopListening();
  }
 catch (  NullPointerException ex) {
    Log.w(TAG,"String_Node_Str",ex);
  }
  TextKeyListener.getInstance().release();
  mModel.stopLoader();
  unbindDesktopItems();
  AppInfoCache.unbindDrawables();
  getContentResolver().unregisterContentObserver(mWidgetObserver);
  dismissPreview(mPreviousView);
  dismissPreview(mNextView);
  unregisterReceiver(mCloseSystemDialogsReceiver);
}
Program: 83683
Project: 83683
Buggy source:
@Override protected void onResume(){
  super.onResume();
  IntentFilter filter=new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
  registerReceiver(mCloseSystemDialogsReceiver,filter);
  if (mRestoring) {
    mWorkspaceLoading=true;
    mModel.startLoader(this,true);
    mRestoring=false;
  }
}

Fixed version (ground truth):
@Override protected void onResume(){
  super.onResume();
  mPaused=false;
  if (mRestoring) {
    mWorkspaceLoading=true;
    mModel.startLoader(this,true);
    mRestoring=false;
  }
}
Program: 83684
Project: 83684
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mModel=((LauncherApplication)getApplication()).setLauncher(this);
  mDragController=new DragController(this);
  mInflater=getLayoutInflater();
  mAppWidgetManager=AppWidgetManager.getInstance(this);
  mAppWidgetHost=new LauncherAppWidgetHost(this,APPWIDGET_HOST_ID);
  mAppWidgetHost.startListening();
  if (PROFILE_STARTUP) {
    android.os.Debug.startMethodTracing("String_Node_Str");
  }
  checkForLocaleChange();
  setWallpaperDimension();
  setContentView(R.layout.launcher);
  setupViews();
  registerContentObservers();
  lockAllApps();
  mSavedState=savedInstanceState;
  restoreState(mSavedState);
  if (PROFILE_STARTUP) {
    android.os.Debug.stopMethodTracing();
  }
  mModel.setAllAppsDirty();
  mModel.setWorkspaceDirty();
  if (!mRestoring) {
    mModel.startLoader(this,true);
  }
  mDefaultKeySsb=new SpannableStringBuilder();
  Selection.setSelection(mDefaultKeySsb,0);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mModel=((LauncherApplication)getApplication()).setLauncher(this);
  mDragController=new DragController(this);
  mInflater=getLayoutInflater();
  mAppWidgetManager=AppWidgetManager.getInstance(this);
  mAppWidgetHost=new LauncherAppWidgetHost(this,APPWIDGET_HOST_ID);
  mAppWidgetHost.startListening();
  if (PROFILE_STARTUP) {
    android.os.Debug.startMethodTracing("String_Node_Str");
  }
  checkForLocaleChange();
  setWallpaperDimension();
  setContentView(R.layout.launcher);
  setupViews();
  registerContentObservers();
  lockAllApps();
  mSavedState=savedInstanceState;
  restoreState(mSavedState);
  if (PROFILE_STARTUP) {
    android.os.Debug.stopMethodTracing();
  }
  mModel.setAllAppsDirty();
  mModel.setWorkspaceDirty();
  if (!mRestoring) {
    mModel.startLoader(this,true);
  }
  mDefaultKeySsb=new SpannableStringBuilder();
  Selection.setSelection(mDefaultKeySsb,0);
  IntentFilter filter=new IntentFilter(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
  registerReceiver(mCloseSystemDialogsReceiver,filter);
}
Program: 83685
Project: 83685
Buggy source:
/** 
 * Things to test when changing this code. - Home from workspace - from center screen - from other screens - Home from all apps - Back from all apps - Launch app from workspace and quit - with back - with home - Launch app from all apps and quit - with back - with home - Go to a screen that's not the default, then all apps, and launch and app, and go back - with back -with home - On workspace, long press power and go back - with back - with home - On all apps, long press power and go back - with back - with home - On workspace, power off - On all apps, power off - Launch an app and turn off the screen while in that app - Go back with home key - Go back with back key - From all apps - From workspace
 */
void closeAllApps(boolean animated){
  if (mAllAppsGrid.isVisible()) {
    mAllAppsGrid.zoom(0.0f,animated);
    mAllAppsGrid.setFocusable(false);
    mWorkspace.getChildAt(mWorkspace.getCurrentScreen()).requestFocus();
  }
}

Fixed version (ground truth):
/** 
 * Things to test when changing this code. - Home from workspace - from center screen - from other screens - Home from all apps - from center screen - from other screens - Back from all apps - from center screen - from other screens - Launch app from workspace and quit - with back - with home - Launch app from all apps and quit - with back - with home - Go to a screen that's not the default, then all apps, and launch and app, and go back - with back -with home - On workspace, long press power and go back - with back - with home - On all apps, long press power and go back - with back - with home - On workspace, power off - On all apps, power off - Launch an app and turn off the screen while in that app - Go back with home key - Go back with back key  TODO: make this not go to workspace - From all apps - From workspace
 */
void closeAllApps(boolean animated){
  if (mAllAppsGrid.isVisible()) {
    mAllAppsGrid.zoom(0.0f,animated);
    mAllAppsGrid.setFocusable(false);
    mWorkspace.getChildAt(mWorkspace.getCurrentScreen()).requestFocus();
  }
}
Program: 83686
Project: 83686
Buggy source:
/** 
 * Handle the allocations for the removed app.  Make sure you call saveAppsList when done.
 */
private void removeApp(int index){
  final int count=mState.iconCount - index - 1;
  final int src=index + 1;
  System.arraycopy(mIcons,src,mIcons,index,count);
  System.arraycopy(mIconIds,src,mIconIds,index,count);
  System.arraycopy(mLabels,src,mLabels,index,count);
  System.arraycopy(mLabelIds,src,mLabelIds,index,count);
  mRollo.mState.iconCount--;
  final int last=mState.iconCount - 1;
  mIcons[last]=null;
  mIconIds[last]=0;
  mLabels[last]=null;
  mLabelIds[last]=0;
}

Fixed version (ground truth):
/** 
 * Handle the allocations for the removed app.  Make sure you call saveAppsList when done.
 */
private void removeApp(int index){
  final int count=mState.iconCount - index - 1;
  final int src=index + 1;
  System.arraycopy(mIcons,src,mIcons,index,count);
  System.arraycopy(mIconIds,src,mIconIds,index,count);
  System.arraycopy(mLabels,src,mLabels,index,count);
  System.arraycopy(mLabelIds,src,mLabelIds,index,count);
  mRollo.mState.iconCount--;
  final int last=mState.iconCount;
  mIcons[last]=null;
  mIconIds[last]=0;
  mLabels[last]=null;
  mLabelIds[last]=0;
}
Program: 83687
Project: 83687
Buggy source:
public void addApps(ArrayList<ApplicationInfo> list){
  if (mAllAppsList == null) {
    return;
  }
  final int N=list.size();
  if (mRollo != null && mRollo.mHasSurface) {
    mRollo.reallocAppsList(mRollo.mState.iconCount + N);
  }
  for (int i=0; i < N; i++) {
    final ApplicationInfo item=list.get(i);
    int index=Collections.binarySearch(mAllAppsList,item,LauncherModel.APP_NAME_COMPARATOR);
    if (index < 0) {
      index=-(index + 1);
    }
    mAllAppsList.add(index,item);
    if (mRollo != null && mRollo.mHasSurface) {
      mRollo.addApp(index,item);
      mRollo.mState.iconCount++;
    }
  }
  if (mRollo != null && mRollo.mHasSurface) {
    mRollo.saveAppsList();
  }
}

Fixed version (ground truth):
public void addApps(ArrayList<ApplicationInfo> list){
  if (mAllAppsList == null) {
    return;
  }
  final int N=list.size();
  if (mRollo != null) {
    mRollo.reallocAppsList(mRollo.mState.iconCount + N);
  }
  for (int i=0; i < N; i++) {
    final ApplicationInfo item=list.get(i);
    int index=Collections.binarySearch(mAllAppsList,item,LauncherModel.APP_NAME_COMPARATOR);
    if (index < 0) {
      index=-(index + 1);
    }
    mAllAppsList.add(index,item);
    if (mRollo != null) {
      mRollo.addApp(index,item);
    }
  }
  if (mRollo != null) {
    mRollo.saveAppsList();
  }
}
Program: 83688
Project: 83688
Buggy source:
private void setApps(ArrayList<ApplicationInfo> list){
  final int count=list != null ? list.size() : 0;
  int allocCount=count;
  if (allocCount < 1) {
    allocCount=1;
  }
  mIcons=new Allocation[count];
  mIconIds=new int[allocCount];
  mAllocIconIds=Allocation.createSized(mRS,Element.USER_I32(mRS),allocCount);
  mLabels=new Allocation[count];
  mLabelIds=new int[allocCount];
  mAllocLabelIds=Allocation.createSized(mRS,Element.USER_I32(mRS),allocCount);
  Element ie8888=Element.RGBA_8888(mRS);
  Utilities.BubbleText bubble=new Utilities.BubbleText(getContext());
  mState.iconCount=count;
  uploadApps(list);
  saveAppsList();
}

Fixed version (ground truth):
private void setApps(ArrayList<ApplicationInfo> list){
  final int count=list != null ? list.size() : 0;
  int allocCount=count;
  if (allocCount < 1) {
    allocCount=1;
  }
  mIcons=new Allocation[count];
  mIconIds=new int[allocCount];
  mAllocIconIds=Allocation.createSized(mRS,Element.USER_I32(mRS),allocCount);
  mLabels=new Allocation[count];
  mLabelIds=new int[allocCount];
  mAllocLabelIds=Allocation.createSized(mRS,Element.USER_I32(mRS),allocCount);
  Element ie8888=Element.RGBA_8888(mRS);
  mState.iconCount=count;
  for (int i=0; i < mState.iconCount; i++) {
    createAppIconAllocations(i,list.get(i));
    uploadAppIcon(i,list.get(i));
  }
  saveAppsList();
}
Program: 83689
Project: 83689
Buggy source:
private void uploadAppIcon(int index,ApplicationInfo item){
  mIcons[index]=Allocation.createFromBitmap(mRS,item.iconBitmap,Element.RGBA_8888(mRS),true);
  frameBitmapAllocMips(mIcons[index],item.iconBitmap.getWidth(),item.iconBitmap.getHeight());
  mLabels[index]=Allocation.createFromBitmap(mRS,item.titleBitmap,Element.RGBA_8888(mRS),true);
  frameBitmapAllocMips(mLabels[index],item.titleBitmap.getWidth(),item.titleBitmap.getHeight());
  mIcons[index].uploadToTexture(0);
  mLabels[index].uploadToTexture(0);
  mIconIds[index]=mIcons[index].getID();
  mLabelIds[index]=mLabels[index].getID();
}

Fixed version (ground truth):
private void uploadAppIcon(int index,ApplicationInfo item){
  if (mIconIds[index] != mIcons[index].getID()) {
    throw new IllegalStateException("String_Node_Str" + index + "String_Node_Str"+ mIcons[index].getID()+ "String_Node_Str"+ mIconIds[index]+ "String_Node_Str"+ item);
  }
  mIcons[index].uploadToTexture(0);
  mLabels[index].uploadToTexture(0);
}
Program: 83690
Project: 83690
Buggy source:
void dirtyCheck(){
  if (mHasSurface) {
    if (mAppsDirty) {
      uploadApps(mAllAppsList);
      saveAppsList();
      mAppsDirty=false;
    }
    if (mZoomDirty) {
      setZoom(mZoom,mAnimateNextZoom);
    }
  }
}

Fixed version (ground truth):
void dirtyCheck(){
  if (mHasSurface) {
    if (mAppsDirty) {
      for (int i=0; i < mState.iconCount; i++) {
        uploadAppIcon(i,mAllAppsList.get(i));
      }
      saveAppsList();
      mAppsDirty=false;
    }
    if (mZoomDirty) {
      setZoom(mZoom,mAnimateNextZoom);
    }
  }
}
Program: 83691
Project: 83691
Buggy source:
public void removeApps(ArrayList<ApplicationInfo> list){
  if (mAllAppsList == null) {
    return;
  }
  final int N=list.size();
  for (int i=0; i < N; i++) {
    final ApplicationInfo item=list.get(i);
    int index=findAppByComponent(mAllAppsList,item);
    if (index >= 0) {
      int ic=mRollo != null ? mRollo.mState.iconCount : 666;
      mAllAppsList.remove(index);
      if (mRollo != null && mRollo.mHasSurface) {
        mRollo.removeApp(index);
      }
    }
 else {
      Log.w(TAG,"String_Node_Str" + item + "String_Node_Str");
    }
  }
  if (mRollo != null && mRollo.mHasSurface) {
    mRollo.saveAppsList();
  }
}

Fixed version (ground truth):
public void removeApps(ArrayList<ApplicationInfo> list){
  if (mAllAppsList == null) {
    return;
  }
  final int N=list.size();
  for (int i=0; i < N; i++) {
    final ApplicationInfo item=list.get(i);
    int index=findAppByComponent(mAllAppsList,item);
    if (index >= 0) {
      int ic=mRollo != null ? mRollo.mState.iconCount : 666;
      mAllAppsList.remove(index);
      if (mRollo != null) {
        mRollo.removeApp(index);
      }
    }
 else {
      Log.w(TAG,"String_Node_Str" + item + "String_Node_Str");
    }
  }
  if (mRollo != null) {
    mRollo.saveAppsList();
  }
}
Program: 83692
Project: 83692
Buggy source:
/** 
 * Handle the allocations for the new app.  Make sure you call saveAppsList when done.
 */
private void addApp(int index,ApplicationInfo item){
  final int count=mState.iconCount - index;
  final int dest=index + 1;
  System.arraycopy(mIcons,index,mIcons,dest,count);
  System.arraycopy(mIconIds,index,mIconIds,dest,count);
  System.arraycopy(mLabels,index,mLabels,dest,count);
  System.arraycopy(mLabelIds,index,mLabelIds,dest,count);
  if (mHasSurface) {
    uploadAppIcon(index,item);
  }
 else {
    mAppsDirty=true;
  }
}

Fixed version (ground truth):
/** 
 * Handle the allocations for the new app.  Make sure you call saveAppsList when done.
 */
private void addApp(int index,ApplicationInfo item){
  final int count=mState.iconCount - index;
  final int dest=index + 1;
  System.arraycopy(mIcons,index,mIcons,dest,count);
  System.arraycopy(mIconIds,index,mIconIds,dest,count);
  System.arraycopy(mLabels,index,mLabels,dest,count);
  System.arraycopy(mLabelIds,index,mLabelIds,dest,count);
  createAppIconAllocations(index,item);
  if (mHasSurface) {
    uploadAppIcon(index,item);
  }
 else {
    mAppsDirty=true;
  }
  mRollo.mState.iconCount++;
}