nus-yam/ex-repair huggingface dataset:
Program: 34226
Project: 34226
Buggy source:
protected MElementInfo<T,C> getElementInfo(EI info){
  return elementInfos.get(info);
}

Fixed version (ground truth):
protected MElementInfo<T,C> getElementInfo(EI info){
  MElementInfo<T,C> elementInfo=elementInfos.get(info);
  if (elementInfo == null) {
    elementInfo=createElementInfo(info);
    elementInfos.put(info,elementInfo);
  }
  return elementInfo;
}
Program: 34227
Project: 34227
Buggy source:
/** 
 * Update task progress info. This method is meant to be used inside of   {@link TaskExecutor}for a running task to update its execution progress(0-100).
 * @param RunId run id of the task
 * @param taskId the task
 * @param current progress to be set
 */
public void updateTaskProgress(RunId runId,TaskId taskId,int progress);

Fixed version (ground truth):
/** 
 * Update task progress info. This method is meant to be used inside of   {@link TaskExecutor}for a running task to update its execution progress(0-100).
 * @param runId run id of the task
 * @param taskId the task
 * @param progress progress to be set
 */
public void updateTaskProgress(RunId runId,TaskId taskId,int progress);
Program: 34228
Project: 34228
Buggy source:
public TaskInfo(TaskId taskId,String instanceName,LocalDateTime startDateUtc,short progress,TaskExecutionResult result){
  this.taskId=Preconditions.checkNotNull(taskId,"String_Node_Str");
  this.instanceName=Optional.ofNullable(instanceName);
  this.startDateUtc=Optional.ofNullable(startDateUtc);
  this.result=Optional.ofNullable(result);
  this.progress=Optional.ofNullable(progress);
}

Fixed version (ground truth):
public TaskInfo(TaskId taskId,String instanceName,LocalDateTime startDateUtc,short progress,TaskExecutionResult result){
  this.taskId=Preconditions.checkNotNull(taskId,"String_Node_Str");
  this.instanceName=Optional.ofNullable(instanceName);
  this.startDateUtc=Optional.ofNullable(startDateUtc);
  this.result=Optional.ofNullable(result);
  this.progress=Optional.of(progress);
}
Program: 34230
Project: 34230
Buggy source:
public int setProgress(int progress){
  this.progress=progress;
}

Fixed version (ground truth):
public short setProgress(short progress){
  this.progress=progress;
}
Program: 34231
Project: 34231
Buggy source:
/** 
 * This method checks an acknowledgment message and, if it is found to be valid,  attempts to disseminate it to the Bitmessage network. 
 * @param p - A Payload object containing the acknowledgment msg to be sent
 * @return - A boolean indicating whether or not the acknowledgment was successfullyprocessed 
 */
private boolean checkAndSendAcknowledgment(Payload p){
  byte[] fullAckMessage=p.getPayload();
  byte[] ackObjectBytes=ArrayCopier.copyOfRange(fullAckMessage,24,fullAckMessage.length);
  new ObjectProcessor().parseObject(ackObjectBytes);
  ServerCommunicator servCom=new ServerCommunicator();
  boolean disseminationSuccessful=servCom.disseminateMsg(ackObjectBytes);
  if (disseminationSuccessful == true) {
    PayloadProvider payProv=PayloadProvider.get(App.getContext());
    payProv.deletePayload(p);
    return true;
  }
 else {
    return false;
  }
}

Fixed version (ground truth):
/** 
 * This method checks an acknowledgement message and, if it is found to be valid,  attempts to disseminate it to the Bitmessage network. 
 * @param p - A Payload object containing the acknowledgement msg to be sent
 * @return - A boolean indicating whether or not the acknowledgement was successfullyprocessed 
 */
private boolean checkAndSendAcknowledgment(Payload p){
  byte[] fullAckMessage=p.getPayload();
  byte[] ackObjectBytes=ArrayCopier.copyOfRange(fullAckMessage,24,fullAckMessage.length);
  new ObjectProcessor().parseObject(ackObjectBytes);
  ServerCommunicator servCom=new ServerCommunicator();
  boolean disseminationSuccessful=servCom.disseminateMsg(ackObjectBytes);
  if (disseminationSuccessful == true) {
    PayloadProvider payProv=PayloadProvider.get(App.getContext());
    payProv.deletePayload(p);
    return true;
  }
 else {
    return false;
  }
}
Program: 34232
Project: 34232
Buggy source:
/** 
 * This method will look in the application database's "Payloads" table for any acknowledgment payloads that 'belong to me', and are thus  acknowledgments that are waiting to be sent for messages that the user of the app has received. 
 * @return - A boolean indicating whether or not all outstanding acknowledgmentswere successfully processed 
 */
public boolean sendAcknowledgments(){
  PayloadProvider payProv=PayloadProvider.get(App.getContext());
  ArrayList<Payload> allAcks=payProv.searchPayloads(PayloadsTable.COLUMN_ACK,String.valueOf(1));
  if (allAcks.size() > 0) {
    ArrayList<Payload> acksToSend=new ArrayList<Payload>();
    for (    Payload p : allAcks) {
      if (p.belongsToMe() == false) {
        acksToSend.add(p);
      }
    }
    Log.i(TAG,"String_Node_Str" + acksToSend.size());
    int numberOfAcksNotProcessedSuccessfully=0;
    for (    Payload p : acksToSend) {
      boolean ackProcessedSuccessfully=false;
      try {
        ackProcessedSuccessfully=checkAndSendAcknowledgment(p);
      }
 catch (      Exception e) {
        Log.e(TAG,"String_Node_Str" + "String_Node_Str" + e.getMessage());
      }
      if (ackProcessedSuccessfully == false) {
        numberOfAcksNotProcessedSuccessfully=numberOfAcksNotProcessedSuccessfully + 1;
      }
    }
    if (numberOfAcksNotProcessedSuccessfully > 0) {
      return false;
    }
 else {
      return true;
    }
  }
 else {
    return true;
  }
}

Fixed version (ground truth):
/** 
 * This method will look in the application database's "Payloads" table for any acknowledgement payloads that 'belong to me', and are thus  acknowledgements that are waiting to be sent for messages that the user of the app has received. 
 * @return - A boolean indicating whether or not all outstanding acknowledgementswere successfully processed 
 */
public boolean sendAcknowledgments(){
  PayloadProvider payProv=PayloadProvider.get(App.getContext());
  ArrayList<Payload> allAcks=payProv.searchPayloads(PayloadsTable.COLUMN_ACK,String.valueOf(1));
  if (allAcks.size() > 0) {
    ArrayList<Payload> acksToSend=new ArrayList<Payload>();
    for (    Payload p : allAcks) {
      if (p.belongsToMe() == false) {
        acksToSend.add(p);
      }
    }
    Log.i(TAG,"String_Node_Str" + acksToSend.size());
    int numberOfAcksNotProcessedSuccessfully=0;
    for (    Payload p : acksToSend) {
      boolean ackProcessedSuccessfully=false;
      try {
        ackProcessedSuccessfully=checkAndSendAcknowledgment(p);
      }
 catch (      Exception e) {
        Log.e(TAG,"String_Node_Str" + "String_Node_Str" + e.getMessage());
      }
      if (ackProcessedSuccessfully == false) {
        numberOfAcksNotProcessedSuccessfully=numberOfAcksNotProcessedSuccessfully + 1;
      }
    }
    if (numberOfAcksNotProcessedSuccessfully > 0) {
      return false;
    }
 else {
      return true;
    }
  }
 else {
    return true;
  }
}
Program: 34234
Project: 34234
Buggy source:
/** 
 * Attempts to send any acknowledgments that are scheduled to be sent by me for messages that I have received
 * @return - A boolean indicating whether or not all outstanding acknowledgmentswere successfully processed 
 */
public boolean sendAcknowledgments(){
  return new AckProcessor().sendAcknowledgments();
}

Fixed version (ground truth):
/** 
 * Attempts to send any acknowledgements that are scheduled to be sent by me for messages that I have received
 * @return - A boolean indicating whether or not all outstanding acknowledgementswere successfully processed 
 */
public boolean sendAcknowledgments(){
  return new AckProcessor().sendAcknowledgments();
}
Program: 34236
Project: 34236
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_view_errors);
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
  if (prefs.getBoolean(KEY_DATABASE_PASSPHRASE_SAVED,false)) {
    mCacheWordHandler=new CacheWordHandler(this);
    mCacheWordHandler.connectToService();
  }
  mProcessID=android.os.Process.myPid();
  mErrorListView=(ListView)findViewById(android.R.id.list);
  updateListView();
  new Timer().schedule(new TimerTask(){
    @Override public void run(){
      runOnUiThread(new Runnable(){
        public void run(){
          if (checkForNewLines()) {
            updateListView();
          }
        }
      }
);
    }
  }
,0,UPDATE_FREQUENCY_MILLISECONDS);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_view_errors);
  try {
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    if (prefs.getBoolean(KEY_DATABASE_PASSPHRASE_SAVED,false)) {
      mCacheWordHandler=new CacheWordHandler(this);
      mCacheWordHandler.connectToService();
    }
    mProcessID=android.os.Process.myPid();
    mErrorListView=(ListView)findViewById(android.R.id.list);
    updateListView();
  }
 catch (  Exception e) {
    Log.e(TAG,"String_Node_Str" + e.getMessage());
  }
}
Program: 34238
Project: 34238
Buggy source:
/** 
 * Updates the error log ListView
 */
private void updateListView(){
  mErrors=getErrors();
  Parcelable state=mErrorListView.onSaveInstanceState();
  mErrorListView=new ListView(this);
  mErrorListView=(ListView)findViewById(android.R.id.list);
  mErrorAdapter=new LogAdapter(mErrors);
  mErrorListView.setAdapter(mErrorAdapter);
  mErrorListView.onRestoreInstanceState(state);
  if (mErrorListView.getLastVisiblePosition() == mErrorListView.getAdapter().getCount() - 1 && mErrorListView.getChildAt(mErrorListView.getChildCount() - 1).getBottom() <= mErrorListView.getHeight()) {
    scrollMyListViewToBottom();
  }
}

Fixed version (ground truth):
/** 
 * Updates the error log ListView
 */
private void updateListView(){
  mErrors=getErrors();
  Parcelable state=mErrorListView.onSaveInstanceState();
  mErrorListView=new ListView(this);
  mErrorListView=(ListView)findViewById(android.R.id.list);
  mErrorAdapter=new LogAdapter(mErrors);
  mErrorListView.setAdapter(mErrorAdapter);
  mErrorListView.onRestoreInstanceState(state);
  try {
    if (mErrorListView.getLastVisiblePosition() == mErrorListView.getAdapter().getCount() - 1 && mErrorListView.getChildAt(mErrorListView.getChildCount() - 1).getBottom() <= mErrorListView.getHeight()) {
      scrollMyListViewToBottom();
      ;
    }
  }
 catch (  Exception e) {
    Log.e(TAG,"String_Node_Str" + e.getMessage());
  }
}
Program: 34239
Project: 34239
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_view_log);
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
  if (prefs.getBoolean(KEY_DATABASE_PASSPHRASE_SAVED,false)) {
    mCacheWordHandler=new CacheWordHandler(this);
    mCacheWordHandler.connectToService();
  }
  mProcessID=android.os.Process.myPid();
  mLogListView=(ListView)findViewById(android.R.id.list);
  updateListView();
  new Timer().schedule(new TimerTask(){
    @Override public void run(){
      runOnUiThread(new Runnable(){
        public void run(){
          if (checkForNewLines()) {
            updateListView();
          }
        }
      }
);
    }
  }
,0,UPDATE_FREQUENCY_MILLISECONDS);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_view_log);
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
  if (prefs.getBoolean(KEY_DATABASE_PASSPHRASE_SAVED,false)) {
    mCacheWordHandler=new CacheWordHandler(this);
    mCacheWordHandler.connectToService();
  }
  mProcessID=android.os.Process.myPid();
  mLogListView=(ListView)findViewById(android.R.id.list);
  updateListView();
}
Program: 34241
Project: 34241
Buggy source:
/** 
 * Updates the log ListView
 */
private void updateListView(){
  mLogItems=getLogLines();
  Parcelable state=mLogListView.onSaveInstanceState();
  mLogListView=new ListView(this);
  mLogListView=(ListView)findViewById(android.R.id.list);
  mLogAdapter=new LogAdapter(mLogItems);
  mLogListView.setAdapter(mLogAdapter);
  mLogListView.onRestoreInstanceState(state);
  if (mLogListView.getLastVisiblePosition() == mLogListView.getAdapter().getCount() - 1 && mLogListView.getChildAt(mLogListView.getChildCount() - 1).getBottom() <= mLogListView.getHeight()) {
    scrollMyListViewToBottom();
  }
}

Fixed version (ground truth):
/** 
 * Updates the log ListView
 */
private void updateListView(){
  mLogItems=getLogLines();
  Parcelable state=mLogListView.onSaveInstanceState();
  mLogListView=new ListView(this);
  mLogListView=(ListView)findViewById(android.R.id.list);
  mLogAdapter=new LogAdapter(mLogItems);
  mLogListView.setAdapter(mLogAdapter);
  mLogListView.onRestoreInstanceState(state);
  try {
    if (mLogListView.getLastVisiblePosition() == mLogListView.getAdapter().getCount() - 1 && mLogListView.getChildAt(mLogListView.getChildCount() - 1).getBottom() <= mLogListView.getHeight()) {
      scrollMyListViewToBottom();
    }
  }
 catch (  Exception e) {
    Log.e(TAG,"String_Node_Str" + e.getMessage());
  }
}
Program: 34242
Project: 34242
Buggy source:
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_lock_screen);
  mCacheWordHandler=new CacheWordHandler(this);
  mCacheWordHandler.connectToService();
  enterPassphraseEditText=(EditText)findViewById(R.id.lock_screen_enter_passphrase_edittext);
  unlockIcon=(ImageView)findViewById(R.id.lock_screen_unlock_icon_imageview);
  unlockIcon.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      Log.i(TAG,"String_Node_Str");
      unlockIcon.setClickable(false);
      String enteredPassphrase=enterPassphraseEditText.getText().toString();
      if (validatePassphrase(enteredPassphrase)) {
        Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
        new AttemptUnlockTask().execute(new String[]{enteredPassphrase});
      }
 else {
        Toast.makeText(getBaseContext(),"String_Node_Str" + MINIMUM_PASSPHRASE_LENGTH + "String_Node_Str",Toast.LENGTH_SHORT).show();
        unlockIcon.setClickable(true);
      }
    }
  }
);
}

Fixed version (ground truth):
@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_lock_screen);
  mPassphraseEnteredByUser=false;
  mActivityContext=this;
  mCacheWordHandler=new CacheWordHandler(this);
  mCacheWordHandler.connectToService();
  enterPassphraseEditText=(EditText)findViewById(R.id.lock_screen_enter_passphrase_edittext);
  unlockIcon=(ImageView)findViewById(R.id.lock_screen_unlock_icon_imageview);
  unlockIcon.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      Log.i(TAG,"String_Node_Str");
      unlockIcon.setClickable(false);
      String enteredPassphrase=enterPassphraseEditText.getText().toString();
      if (validatePassphrase(enteredPassphrase)) {
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
          Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
        }
        mPassphraseEnteredByUser=true;
        new AttemptUnlockTask().execute(new String[]{enteredPassphrase});
      }
 else {
        Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
        unlockIcon.setClickable(true);
      }
    }
  }
);
}
Program: 34243
Project: 34243
Buggy source:
@Override public void onClick(View v){
  Log.i(TAG,"String_Node_Str");
  unlockIcon.setClickable(false);
  String enteredPassphrase=enterPassphraseEditText.getText().toString();
  if (validatePassphrase(enteredPassphrase)) {
    Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    new AttemptUnlockTask().execute(new String[]{enteredPassphrase});
  }
 else {
    Toast.makeText(getBaseContext(),"String_Node_Str" + MINIMUM_PASSPHRASE_LENGTH + "String_Node_Str",Toast.LENGTH_SHORT).show();
    unlockIcon.setClickable(true);
  }
}

Fixed version (ground truth):
@Override public void onClick(View v){
  Log.i(TAG,"String_Node_Str");
  unlockIcon.setClickable(false);
  String enteredPassphrase=enterPassphraseEditText.getText().toString();
  if (validatePassphrase(enteredPassphrase)) {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
      Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    }
    mPassphraseEnteredByUser=true;
    new AttemptUnlockTask().execute(new String[]{enteredPassphrase});
  }
 else {
    Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_SHORT).show();
    unlockIcon.setClickable(true);
  }
}
Program: 34244
Project: 34244
Buggy source:
@Override protected Boolean doInBackground(String... enteredPassphrase){
  try {
    mCacheWordHandler.setPassphrase(enteredPassphrase[0].toCharArray());
  }
 catch (  GeneralSecurityException e) {
    Log.e(TAG,"String_Node_Str" + e.getMessage());
    return false;
  }
  return true;
}

Fixed version (ground truth):
@Override protected Boolean doInBackground(String... enteredPassphrase){
  Log.i(TAG,"String_Node_Str");
  mLastUnlockAttemptSuccessful=false;
  mUnlockAttemptTimerTask=new TimerTask(){
    @Override public void run(){
      if (mLastUnlockAttemptSuccessful == false)       Log.e(TAG,"String_Node_Str");
      unlockIcon.setClickable(true);
      mCacheWordHandler=new CacheWordHandler(mActivityContext);
      mCacheWordHandler.connectToService();
    }
  }
;
  new Timer().schedule(mUnlockAttemptTimerTask,4000);
  try {
    mCacheWordHandler.setPassphrase(enteredPassphrase[0].toCharArray());
  }
 catch (  GeneralSecurityException e) {
    Log.i(TAG,"String_Node_Str");
    mLastUnlockAttemptSuccessful=true;
    return false;
  }
catch (  Exception e) {
    Log.e(TAG,"String_Node_Str" + e.getMessage());
    mLastUnlockAttemptSuccessful=true;
    return false;
  }
  mLastUnlockAttemptSuccessful=true;
  return true;
}
Program: 34245
Project: 34245
Buggy source:
/** 
 * Validates a passphrase entered by the user
 * @param passphrase - The passphrase
 * @return A boolean indicating whether or not the passphrase is valid
 */
private boolean validatePassphrase(String passphrase){
  if (passphrase.length() < MINIMUM_PASSPHRASE_LENGTH) {
    Log.e(TAG,"String_Node_Str" + passphrase.length() + "String_Node_Str"+ "String_Node_Str"+ MINIMUM_PASSPHRASE_LENGTH+ "String_Node_Str");
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Validates a passphrase entered by the user
 * @param passphrase - The passphrase
 * @return A boolean indicating whether or not the passphrase is valid
 */
private boolean validatePassphrase(String passphrase){
  if (passphrase.length() < MINIMUM_PASSPHRASE_LENGTH) {
    Log.i(TAG,"String_Node_Str" + passphrase.length() + "String_Node_Str"+ "String_Node_Str"+ MINIMUM_PASSPHRASE_LENGTH+ "String_Node_Str");
    return false;
  }
  return true;
}
Program: 34246
Project: 34246
Buggy source:
@Override public void onCacheWordOpened(){
  Log.i(TAG,"String_Node_Str");
  NotificationManager notificationManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
  notificationManager.cancel(NotificationsService.getUnlockNotificationId());
  Intent intent=new Intent(getBaseContext(),InboxActivity.class);
  intent.putExtra(EXTRA_DATABASE_UNLOCKED,true);
  startActivityForResult(intent,0);
}

Fixed version (ground truth):
@Override public void onCacheWordOpened(){
  Log.i(TAG,"String_Node_Str");
  if (mPassphraseEnteredByUser) {
    mPassphraseEnteredByUser=false;
    mUnlockAttemptTimerTask.cancel();
    NotificationManager notificationManager=(NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE);
    notificationManager.cancel(NotificationsService.getUnlockNotificationId());
    Intent intent=new Intent(getBaseContext(),InboxActivity.class);
    intent.putExtra(EXTRA_DATABASE_UNLOCKED,true);
    startActivityForResult(intent,0);
  }
 else {
    Log.e(TAG,"String_Node_Str");
  }
}
Program: 34247
Project: 34247
Buggy source:
@Override public void onCacheWordUninitialized(){
}

Fixed version (ground truth):
@Override public void onCacheWordUninitialized(){
  Log.i(TAG,"String_Node_Str");
}
Program: 34249
Project: 34249
Buggy source:
@SuppressLint("String_Node_Str") @Override public void onCacheWordLocked(){
  Intent intent=new Intent(getBaseContext(),LockScreenActivity.class);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
  }
 else {
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  }
  startActivity(intent);
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") @Override public void onCacheWordLocked(){
  Log.i(TAG,"String_Node_Str");
  Intent intent=new Intent(getBaseContext(),LockScreenActivity.class);
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
  }
 else {
    intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  }
  startActivity(intent);
}
Program: 34252
Project: 34252
Buggy source:
@Override public boolean onPrepareOptionsMenu(Menu menu){
  Log.i(TAG,"String_Node_Str");
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
  if (prefs.getBoolean(KEY_DATABASE_PASSPHRASE_SAVED,false) == false) {
    Log.i(TAG,"String_Node_Str");
    menu.removeItem(R.id.menu_item_lock);
  }
  return super.onPrepareOptionsMenu(menu);
}

Fixed version (ground truth):
@Override public boolean onPrepareOptionsMenu(Menu menu){
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
  if (prefs.getBoolean(KEY_DATABASE_PASSPHRASE_SAVED,false) == false) {
    menu.removeItem(R.id.menu_item_lock);
  }
  return super.onPrepareOptionsMenu(menu);
}
Program: 34253
Project: 34253
Buggy source:
/** 
 * A routine to be run after we have attempted to set or change the database encryption passphrase
 * @param success - Whether the attempt to modify the passphrase was successful
 */
private void onPassphraseModificationResult(boolean success){
  if (success) {
    Log.d(TAG,"String_Node_Str");
    closeKeyboardIfOpen();
    savePassphraseButton.setVisibility(View.GONE);
    cancelPassphraseButton.setVisibility(View.GONE);
  }
 else {
    Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
}

Fixed version (ground truth):
/** 
 * A routine to be run after we have attempted to set or change the database encryption passphrase
 * @param success - Whether the attempt to modify the passphrase was successful
 */
private void onPassphraseModificationResult(boolean success){
  if (success) {
    closeKeyboardIfOpen();
    savePassphraseButton.setVisibility(View.GONE);
    cancelPassphraseButton.setVisibility(View.GONE);
    cancelPassphraseButton=(Button)findViewById(R.id.security_cancel_passphrase_button);
    cancelPassphraseButton.setVisibility(View.GONE);
  }
 else {
    Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
}
Program: 34254
Project: 34254
Buggy source:
/** 
 * If the soft keyboard is open, this method will close it. Currently only works for API 16 and above. 
 */
private void closeKeyboardIfOpen(){
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    final View activityRootView=getWindow().getDecorView().getRootView();
    final OnGlobalLayoutListener globalListener=new OnGlobalLayoutListener(){
      @Override @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void onGlobalLayout(){
        Rect rect=new Rect();
        activityRootView.getWindowVisibleDisplayFrame(rect);
        Log.d(TAG,"String_Node_Str");
        int heightDiff=activityRootView.getRootView().getHeight() - (rect.bottom - rect.top);
        if (heightDiff > 100) {
          Log.d(TAG,"String_Node_Str");
          InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
          imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
        }
        activityRootView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
      }
    }
;
    activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(globalListener);
  }
}

Fixed version (ground truth):
/** 
 * If the soft keyboard is open, this method will close it. Currently only works for API 16 and above. 
 */
private void closeKeyboardIfOpen(){
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
    final View activityRootView=getWindow().getDecorView().getRootView();
    final OnGlobalLayoutListener globalListener=new OnGlobalLayoutListener(){
      @Override @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void onGlobalLayout(){
        Rect rect=new Rect();
        activityRootView.getWindowVisibleDisplayFrame(rect);
        int heightDiff=activityRootView.getRootView().getHeight() - (rect.bottom - rect.top);
        if (heightDiff > 100) {
          InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
          imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
        }
        activityRootView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
      }
    }
;
    activityRootView.getViewTreeObserver().addOnGlobalLayoutListener(globalListener);
  }
}
Program: 34255
Project: 34255
Buggy source:
/** 
 * Takes a pair Strings and validates them, determining whether or not they contain a valid database passphrase. 
 * @param enteredPassphrase - The entered passphrase
 * @param confirmedPassphrase - The confirmed passphrase
 * @return A boolean indicating whether the given Strings are a valid passphrase
 */
private boolean validateDatabasePassphrase(String enteredPassphrase,String confirmedPassphrase){
  if (enteredPassphrase.equals(confirmedPassphrase) == false) {
    Toast.makeText(this,"String_Node_Str",Toast.LENGTH_LONG).show();
    Log.e(TAG,"String_Node_Str");
    return false;
  }
  if (enteredPassphrase.length() < MINIMUM_PASSPHRASE_LENGTH) {
    Toast.makeText(this,"String_Node_Str" + MINIMUM_PASSPHRASE_LENGTH + "String_Node_Str",Toast.LENGTH_LONG).show();
    Log.e(TAG,"String_Node_Str" + enteredPassphrase.length() + "String_Node_Str"+ "String_Node_Str"+ MINIMUM_PASSPHRASE_LENGTH+ "String_Node_Str");
    return false;
  }
  return true;
}

Fixed version (ground truth):
/** 
 * Takes a pair Strings and validates them, determining whether or not they contain a valid database passphrase. 
 * @param enteredPassphrase - The entered passphrase
 * @param confirmedPassphrase - The confirmed passphrase
 * @return A boolean indicating whether the given Strings are a valid passphrase
 */
private boolean validateDatabasePassphrase(String enteredPassphrase,String confirmedPassphrase){
  if (enteredPassphrase.equals(confirmedPassphrase) == false) {
    Toast.makeText(this,"String_Node_Str",Toast.LENGTH_LONG).show();
    Log.e(TAG,"String_Node_Str");
    return false;
  }
  if (enteredPassphrase.length() < MINIMUM_PASSPHRASE_LENGTH) {
    Toast.makeText(this,"String_Node_Str" + MINIMUM_PASSPHRASE_LENGTH + "String_Node_Str",Toast.LENGTH_LONG).show();
    Log.e(TAG,"String_Node_Str" + enteredPassphrase.length() + "String_Node_Str"+ "String_Node_Str"+ MINIMUM_PASSPHRASE_LENGTH+ "String_Node_Str");
    return false;
  }
  if (enteredPassphrase.equals(PLACEHOLDER_PASSPHRASE)) {
    Toast.makeText(this,"String_Node_Str",Toast.LENGTH_LONG).show();
    Log.e(TAG,"String_Node_Str");
    return false;
  }
  return true;
}
Program: 34256
Project: 34256
Buggy source:
@Override @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void onGlobalLayout(){
  Rect rect=new Rect();
  activityRootView.getWindowVisibleDisplayFrame(rect);
  Log.d(TAG,"String_Node_Str");
  int heightDiff=activityRootView.getRootView().getHeight() - (rect.bottom - rect.top);
  if (heightDiff > 100) {
    Log.d(TAG,"String_Node_Str");
    InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
  }
  activityRootView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}

Fixed version (ground truth):
@Override @TargetApi(Build.VERSION_CODES.JELLY_BEAN) public void onGlobalLayout(){
  Rect rect=new Rect();
  activityRootView.getWindowVisibleDisplayFrame(rect);
  int heightDiff=activityRootView.getRootView().getHeight() - (rect.bottom - rect.top);
  if (heightDiff > 100) {
    InputMethodManager imm=(InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    imm.toggleSoftInput(InputMethodManager.SHOW_FORCED,0);
  }
  activityRootView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
}
Program: 34257
Project: 34257
Buggy source:
@Override protected void onPostExecute(Boolean success){
  if (success) {
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    SharedPreferences.Editor editor=prefs.edit();
    editor.putBoolean(KEY_DATABASE_ENCRYPTION_SELECTED,false);
    editor.putBoolean(KEY_DATABASE_PASSPHRASE_SAVED,false);
    editor.commit();
    hideDatabaseEncryptionUI();
    closeKeyboardIfOpen();
    clearPassphraseEditTexts();
    changePassphraseButton.setVisibility(View.GONE);
    savePassphraseButton.setVisibility(View.GONE);
    cancelPassphraseButton.setVisibility(View.GONE);
    databaseEncryptionCheckbox.setText("String_Node_Str");
    databaseEncryptionCheckbox.setChecked(false);
    Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
  onPassphraseModificationResult(success);
}

Fixed version (ground truth):
@Override protected void onPostExecute(Boolean success){
  if (success) {
    SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    SharedPreferences.Editor editor=prefs.edit();
    editor.putBoolean(KEY_DATABASE_ENCRYPTION_SELECTED,false);
    editor.putBoolean(KEY_DATABASE_PASSPHRASE_SAVED,false);
    editor.commit();
    hideDatabaseEncryptionUI();
    clearPassphraseEditTexts();
    changePassphraseButton.setVisibility(View.GONE);
    savePassphraseButton.setVisibility(View.GONE);
    cancelPassphraseButton.setVisibility(View.GONE);
    databaseEncryptionCheckbox.setText("String_Node_Str");
    databaseEncryptionCheckbox.setChecked(false);
    Toast.makeText(getBaseContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
  onPassphraseModificationResult(success);
}
Program: 34258
Project: 34258
Buggy source:
/** 
 * Checks whether CacheWord is locked. If yes, this routine closes the database.
 */
private void closeDatabaseIfLocked(){
  if (mCacheWordHandler.isLocked()) {
    DatabaseContentProvider.closeDatabase();
  }
}

Fixed version (ground truth):
/** 
 * Checks whether CacheWord is locked. If yes, this routine closes the database.
 */
private void closeDatabaseIfLocked(){
  if (mCacheWordHandler != null && mCacheWordHandler.isLocked()) {
    DatabaseContentProvider.closeDatabase();
  }
}
Program: 34260
Project: 34260
Buggy source:
/** 
 * Processes one or more msg payloads that have been sent to me
 * @return An int representing the number of new messages successfully received (i.e. successfully decrypted and authenticated). 
 */
public int processIncomingMessages(){
  int newMessagesReceived=0;
  PayloadProvider payProv=PayloadProvider.get(App.getContext());
  String[] columnNames=new String[]{PayloadsTable.COLUMN_TYPE,PayloadsTable.COLUMN_BELONGS_TO_ME,PayloadsTable.COLUMN_PROCESSING_COMPLETE};
  String[] searchTerms=new String[]{Payload.OBJECT_TYPE_MSG,"String_Node_Str","String_Node_Str"};
  ArrayList<Payload> msgsToProcess=payProv.searchPayloads(columnNames,searchTerms);
  ArrayList<Payload> processedMsgs=new ArrayList<Payload>();
  for (  Payload p : msgsToProcess) {
    Message decryptedMessage=new IncomingMessageProcessor().processReceivedMsg(p);
    if (decryptedMessage != null) {
      newMessagesReceived++;
      MessageProvider.get(App.getContext()).addMessage(decryptedMessage);
      App.getContext().sendBroadcast(new Intent(UI_NOTIFICATION));
    }
    processedMsgs.add(p);
  }
  for (  Payload p : processedMsgs) {
    p.setProcessingComplete(true);
    payProv.updatePayload(p);
  }
  return newMessagesReceived;
}

Fixed version (ground truth):
/** 
 * Processes one or more msg payloads that have been sent to me
 * @return An int representing the number of new messages successfully processed
 */
public int processIncomingMessages(){
  int newMessagesReceived=0;
  PayloadProvider payProv=PayloadProvider.get(App.getContext());
  String[] columnNames=new String[]{PayloadsTable.COLUMN_TYPE,PayloadsTable.COLUMN_BELONGS_TO_ME,PayloadsTable.COLUMN_PROCESSING_COMPLETE};
  String[] searchTerms=new String[]{Payload.OBJECT_TYPE_MSG,"String_Node_Str","String_Node_Str"};
  ArrayList<Payload> msgsToProcess=payProv.searchPayloads(columnNames,searchTerms);
  ArrayList<Payload> processedMsgs=new ArrayList<Payload>();
  for (  Payload p : msgsToProcess) {
    Message decryptedMessage=new IncomingMessageProcessor().processReceivedMsg(p);
    if (decryptedMessage != null) {
      newMessagesReceived++;
      MessageProvider.get(App.getContext()).addMessage(decryptedMessage);
      App.getContext().sendBroadcast(new Intent(UI_NOTIFICATION));
    }
    processedMsgs.add(p);
  }
  for (  Payload p : processedMsgs) {
    p.setProcessingComplete(true);
    payProv.updatePayload(p);
  }
  if (newMessagesReceived > 0) {
    Context appContext=App.getContext();
    Intent intent=new Intent(appContext,NotificationsService.class);
    intent.putExtra(NotificationsService.EXTRA_DISPLAY_NEW_MESSAGES_NOTIFICATION,newMessagesReceived);
    appContext.startService(intent);
  }
  return processedMsgs.size();
}
Program: 34261
Project: 34261
Buggy source:
@Override public void run(){
  try {
    Log.i(TAG,"String_Node_Str");
    CheckForMessagesController controller=new CheckForMessagesController();
    int totalNewMessages=0;
    int newMessagesReceived=controller.processIncomingMessages();
    while (newMessagesReceived > 0) {
      totalNewMessages=totalNewMessages + newMessagesReceived;
      newMessagesReceived=controller.processIncomingMessages();
    }
    if (totalNewMessages > 0) {
      controller.sendAcknowledgments();
      Context appContext=App.getContext();
      Intent intent=new Intent(appContext,NotificationsService.class);
      intent.putExtra(NotificationsService.EXTRA_DISPLAY_NEW_MESSAGES_NOTIFICATION,totalNewMessages);
      appContext.startService(intent);
    }
    Log.i(TAG,"String_Node_Str");
  }
 catch (  Exception e) {
    Log.e(TAG,"String_Node_Str" + "String_Node_Str" + e.getMessage());
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    Log.i(TAG,"String_Node_Str");
    CheckForMessagesController controller=new CheckForMessagesController();
    int newMessagesProcessed=controller.processIncomingMessages();
    while (newMessagesProcessed > 0) {
      newMessagesProcessed=controller.processIncomingMessages();
    }
    controller.sendAcknowledgments();
    Log.i(TAG,"String_Node_Str");
  }
 catch (  Exception e) {
    Log.e(TAG,"String_Node_Str" + "String_Node_Str" + e.getMessage());
  }
}
Program: 34262
Project: 34262
Buggy source:
private MessageProcessingThread(){
  processingThread=new Thread(new Runnable(){
    @Override public void run(){
      try {
        Log.i(TAG,"String_Node_Str");
        CheckForMessagesController controller=new CheckForMessagesController();
        int totalNewMessages=0;
        int newMessagesReceived=controller.processIncomingMessages();
        while (newMessagesReceived > 0) {
          totalNewMessages=totalNewMessages + newMessagesReceived;
          newMessagesReceived=controller.processIncomingMessages();
        }
        if (totalNewMessages > 0) {
          controller.sendAcknowledgments();
          Context appContext=App.getContext();
          Intent intent=new Intent(appContext,NotificationsService.class);
          intent.putExtra(NotificationsService.EXTRA_DISPLAY_NEW_MESSAGES_NOTIFICATION,totalNewMessages);
          appContext.startService(intent);
        }
        Log.i(TAG,"String_Node_Str");
      }
 catch (      Exception e) {
        Log.e(TAG,"String_Node_Str" + "String_Node_Str" + e.getMessage());
      }
    }
  }
);
}

Fixed version (ground truth):
private MessageProcessingThread(){
  processingThread=new Thread(new Runnable(){
    @Override public void run(){
      try {
        Log.i(TAG,"String_Node_Str");
        CheckForMessagesController controller=new CheckForMessagesController();
        int newMessagesProcessed=controller.processIncomingMessages();
        while (newMessagesProcessed > 0) {
          newMessagesProcessed=controller.processIncomingMessages();
        }
        controller.sendAcknowledgments();
        Log.i(TAG,"String_Node_Str");
      }
 catch (      Exception e) {
        Log.e(TAG,"String_Node_Str" + "String_Node_Str" + e.getMessage());
      }
    }
  }
);
}
Program: 34265
Project: 34265
Buggy source:
/** 
 * Partially expand the sliding panel up to a specific offset
 * @param mSlideOffset Value between 0 and 1, where 0 is completely expanded.
 * @return true if the pane was slideable and is now expanded/in the process of expanding
 */
public boolean expandPanel(float mSlideOffset){
  return expandPanel(mSlideableView,0,mSlideOffset);
}

Fixed version (ground truth):
/** 
 * Partially expand the sliding panel up to a specific offset
 * @param mSlideOffset Value between 0 and 1, where 0 is completely expanded.
 * @return true if the pane was slideable and is now expanded/in the process of expanding
 */
public boolean expandPanel(float mSlideOffset){
  if (mSlideState == SlideState.EXPANDED)   return false;
  mSlideableView.setVisibility(View.VISIBLE);
  return expandPanel(mSlideableView,0,mSlideOffset);
}
Program: 34266
Project: 34266
Buggy source:
public boolean isSlidingEnabled(){
  return mIsSlidingEnabled && mSlideableView != null && mSlideableView.getVisibility() == View.VISIBLE;
}

Fixed version (ground truth):
public boolean isSlidingEnabled(){
  return mIsSlidingEnabled && mSlideableView != null;
}
Program: 34267
Project: 34267
Buggy source:
public void showPanel(){
  if (!isSlidingEnabled())   return;
  smoothSlideTo(0,0);
}

Fixed version (ground truth):
public void showPanel(){
  if (!isPanelHidden())   return;
  smoothSlideTo(0,0);
}
Program: 34268
Project: 34268
Buggy source:
public void hidePanel(){
  if (!isSlidingEnabled())   return;
  mIsPanelBeingHidden=true;
  int newTop=computePanelTopPosition(0.0f) + (mIsSlidingUp ? +mPanelHeight : -mPanelHeight);
  smoothSlideTo(computeSlideOffset(newTop),0);
}

Fixed version (ground truth):
public void hidePanel(){
  mIsPanelBeingHidden=true;
  int newTop=computePanelTopPosition(0.0f) + (mIsSlidingUp ? +mPanelHeight : -mPanelHeight);
  smoothSlideTo(computeSlideOffset(newTop),0);
}
Program: 34269
Project: 34269
Buggy source:
/** 
 * Smoothly animate mDraggingPane to the target X position within its range.
 * @param slideOffset position to animate to
 * @param velocity initial velocity in case of fling, or 0.
 */
boolean smoothSlideTo(float slideOffset,int velocity){
  if (!isSlidingEnabled()) {
    return false;
  }
  int panelTop=computePanelTopPosition(slideOffset);
  if (mDragHelper.smoothSlideViewTo(mSlideableView,mSlideableView.getLeft(),panelTop)) {
    ViewCompat.postInvalidateOnAnimation(this);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Smoothly animate mDraggingPane to the target X position within its range.
 * @param slideOffset position to animate to
 * @param velocity initial velocity in case of fling, or 0.
 */
boolean smoothSlideTo(float slideOffset,int velocity){
  if (!isSlidingEnabled()) {
    return false;
  }
  int panelTop=computePanelTopPosition(slideOffset);
  if (mDragHelper.smoothSlideViewTo(mSlideableView,mSlideableView.getLeft(),panelTop)) {
    setAllChildrenVisible();
    ViewCompat.postInvalidateOnAnimation(this);
    return true;
  }
  return false;
}
Program: 34270
Project: 34270
Buggy source:
@Override public void onViewCaptured(View capturedChild,int activePointerId){
}

Fixed version (ground truth):
@Override public void onViewCaptured(View capturedChild,int activePointerId){
  setAllChildrenVisible();
}
Program: 34272
Project: 34272
Buggy source:
@SuppressLint("String_Node_Str") private void onPanelDragged(int newTop){
  mSlideOffset=computeSlideOffset(newTop);
  if (mParallaxOffset > 0 && mSlideOffset >= 0) {
    int mainViewOffset=getCurrentParalaxOffset();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      mMainView.setTranslationY(mainViewOffset);
    }
 else {
      AnimatorProxy.wrap(mMainView).setTranslationY(mainViewOffset);
    }
  }
  dispatchOnPanelSlide(mSlideableView);
  if (mSlideOffset <= 0 && !mOverlayContent) {
    LayoutParams lp=(LayoutParams)mMainView.getLayoutParams();
    lp.height=mIsSlidingUp ? (newTop - getPaddingBottom()) : (getHeight() - getPaddingBottom() - mSlideableView.getMeasuredHeight()- newTop);
    mMainView.requestLayout();
  }
}

Fixed version (ground truth):
@SuppressLint("String_Node_Str") private void onPanelDragged(int newTop){
  mSlideState=SlideState.DRAGGING;
  mSlideOffset=computeSlideOffset(newTop);
  if (mParallaxOffset > 0 && mSlideOffset >= 0) {
    int mainViewOffset=getCurrentParalaxOffset();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
      mMainView.setTranslationY(mainViewOffset);
    }
 else {
      AnimatorProxy.wrap(mMainView).setTranslationY(mainViewOffset);
    }
  }
  dispatchOnPanelSlide(mSlideableView);
  if (mSlideOffset <= 0 && !mOverlayContent) {
    LayoutParams lp=(LayoutParams)mMainView.getLayoutParams();
    lp.height=mIsSlidingUp ? (newTop - getPaddingBottom()) : (getHeight() - getPaddingBottom() - mSlideableView.getMeasuredHeight()- newTop);
    mMainView.requestLayout();
  }
}
Program: 34273
Project: 34273
Buggy source:
/** 
 * Smoothly animate mDraggingPane to the target X position within its range.
 * @param slideOffset position to animate to
 * @param velocity initial velocity in case of fling, or 0.
 */
boolean smoothSlideTo(float slideOffset,int velocity){
  if (!isSlidingEnabled()) {
    return false;
  }
  int panelTop=computePanelTopPosition(slideOffset);
  if (mDragHelper.smoothSlideViewTo(mSlideableView,mSlideableView.getLeft(),panelTop)) {
    setAllChildrenVisible();
    ViewCompat.postInvalidateOnAnimation(this);
    return true;
  }
  return false;
}

Fixed version (ground truth):
/** 
 * Smoothly animate mDraggingPane to the target X position within its range.
 * @param slideOffset position to animate to
 * @param velocity initial velocity in case of fling, or 0.
 */
boolean smoothSlideTo(float slideOffset,int velocity){
  if (!isSlidingEnabled()) {
    return false;
  }
  int panelTop=computePanelTopPosition(slideOffset);
  if (mDragHelper.smoothSlideViewTo(mSlideableView,mSlideableView.getLeft(),panelTop)) {
    ViewCompat.postInvalidateOnAnimation(this);
    return true;
  }
  return false;
}
Program: 34274
Project: 34274
Buggy source:
/** 
 * Collapse the sliding pane if it is currently slideable. If first layout has already completed this will animate.
 * @return true if the pane was slideable and is now collapsed/in the process of collapsing
 */
public boolean collapsePanel(){
  if (isPanelHidden())   return false;
  return collapsePanel(mSlideableView,0);
}

Fixed version (ground truth):
/** 
 * Collapse the sliding pane if it is currently slideable. If first layout has already completed this will animate.
 * @return true if the pane was slideable and is now collapsed/in the process of collapsing
 */
public boolean collapsePanel(){
  if (mSlideState == SlideState.HIDDEN || mSlideState == SlideState.COLLAPSED)   return false;
  return collapsePanel(mSlideableView,0);
}
Program: 34275
Project: 34275
Buggy source:
@Override public void onViewDragStateChanged(int state){
  if (mDragHelper.getViewDragState() == ViewDragHelper.STATE_IDLE) {
    mSlideOffset=computeSlideOffset(mSlideableView.getTop());
    if (mSlideOffset == 1) {
      if (mSlideState != SlideState.EXPANDED) {
        updateObscuredViewVisibility();
        mSlideState=SlideState.EXPANDED;
        dispatchOnPanelExpanded(mSlideableView);
      }
    }
 else     if (mSlideOffset == 0) {
      if (mSlideState != SlideState.COLLAPSED) {
        mSlideState=SlideState.COLLAPSED;
        dispatchOnPanelCollapsed(mSlideableView);
      }
    }
 else     if (mSlideOffset < 0) {
      mSlideState=SlideState.HIDDEN;
      mIsPanelBeingHidden=false;
    }
 else     if (mSlideState != SlideState.ANCHORED) {
      updateObscuredViewVisibility();
      mSlideState=SlideState.ANCHORED;
      dispatchOnPanelAnchored(mSlideableView);
    }
  }
}

Fixed version (ground truth):
@Override public void onViewDragStateChanged(int state){
  if (mDragHelper.getViewDragState() == ViewDragHelper.STATE_IDLE) {
    mSlideOffset=computeSlideOffset(mSlideableView.getTop());
    if (mSlideOffset == 1) {
      if (mSlideState != SlideState.EXPANDED) {
        updateObscuredViewVisibility();
        mSlideState=SlideState.EXPANDED;
        dispatchOnPanelExpanded(mSlideableView);
      }
    }
 else     if (mSlideOffset == 0) {
      if (mSlideState != SlideState.COLLAPSED) {
        mSlideState=SlideState.COLLAPSED;
        dispatchOnPanelCollapsed(mSlideableView);
      }
    }
 else     if (mSlideOffset < 0) {
      mSlideState=SlideState.HIDDEN;
      mSlideableView.setVisibility(View.GONE);
      dispatchOnPanelHidden(mSlideableView);
    }
 else     if (mSlideState != SlideState.ANCHORED) {
      updateObscuredViewVisibility();
      mSlideState=SlideState.ANCHORED;
      dispatchOnPanelAnchored(mSlideableView);
    }
  }
}
Program: 34276
Project: 34276
Buggy source:
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  final int paddingLeft=getPaddingLeft();
  final int paddingTop=getPaddingTop();
  final int childCount=getChildCount();
  if (mFirstLayout) {
switch (mSlideState) {
case EXPANDED:
      mSlideOffset=1.0f;
    break;
case ANCHORED:
  mSlideOffset=mAnchorPoint;
break;
case HIDDEN:
int newTop=computePanelTopPosition(0.0f) + (mIsSlidingUp ? +mPanelHeight : -mPanelHeight);
mSlideOffset=computeSlideOffset(newTop);
break;
default :
mSlideOffset=0.f;
break;
}
}
for (int i=0; i < childCount; i++) {
final View child=getChildAt(i);
if (child.getVisibility() == GONE) {
continue;
}
final int childHeight=child.getMeasuredHeight();
int childTop=paddingTop;
if (child == mSlideableView) {
childTop=computePanelTopPosition(mSlideOffset);
}
if (!mIsSlidingUp) {
if (child == mMainView && !mOverlayContent) {
childTop=computePanelTopPosition(mSlideOffset) + mSlideableView.getMeasuredHeight();
}
}
final int childBottom=childTop + childHeight;
final int childLeft=paddingLeft;
final int childRight=childLeft + child.getMeasuredWidth();
child.layout(childLeft,childTop,childRight,childBottom);
}
if (mFirstLayout) {
updateObscuredViewVisibility();
}
mFirstLayout=false;
}

Fixed version (ground truth):
@Override protected void onLayout(boolean changed,int l,int t,int r,int b){
  final int paddingLeft=getPaddingLeft();
  final int paddingTop=getPaddingTop();
  final int childCount=getChildCount();
  if (mFirstLayout) {
switch (mSlideState) {
case EXPANDED:
      mSlideOffset=1.0f;
    break;
case ANCHORED:
  mSlideOffset=mAnchorPoint;
break;
case HIDDEN:
int newTop=computePanelTopPosition(0.0f) + (mIsSlidingUp ? +mPanelHeight : -mPanelHeight);
mSlideOffset=computeSlideOffset(newTop);
break;
default :
mSlideOffset=0.f;
break;
}
}
for (int i=0; i < childCount; i++) {
final View child=getChildAt(i);
if (child.getVisibility() == GONE && (i == 0 || mFirstLayout)) {
continue;
}
final int childHeight=child.getMeasuredHeight();
int childTop=paddingTop;
if (child == mSlideableView) {
childTop=computePanelTopPosition(mSlideOffset);
}
if (!mIsSlidingUp) {
if (child == mMainView && !mOverlayContent) {
childTop=computePanelTopPosition(mSlideOffset) + mSlideableView.getMeasuredHeight();
}
}
final int childBottom=childTop + childHeight;
final int childLeft=paddingLeft;
final int childRight=childLeft + child.getMeasuredWidth();
child.layout(childLeft,childTop,childRight,childBottom);
}
if (mFirstLayout) {
updateObscuredViewVisibility();
}
mFirstLayout=false;
}