nus-yam/ex-repair huggingface dataset:
Program: 86936
Project: 86936
Buggy source:
private void setMySize(int w,int h){
  minPhysX=marLeft;
  minPhysY=marTop;
  maxPhysX=w - marRight;
  maxPhysY=h - marBottom;
  U.pf("String_Node_Str",minPhysX,maxPhysX,minPhysY,maxPhysY);
}

Fixed version (ground truth):
private void setMySize(int w,int h){
  minPhysX=marLeft;
  minPhysY=marTop;
  maxPhysX=w - marRight;
  maxPhysY=h - marBottom;
}
Program: 86938
Project: 86938
Buggy source:
public TermTable(Main.TermTableModel ttm){
  model=ttm;
  table=new JTable(model);
  scrollpane=new JScrollPane(table);
}

Fixed version (ground truth):
public TermTable(Main.TermTableModel ttm){
  model=ttm;
  table=new JTable(model){
{
      setFillsViewportHeight(true);
    }
    @Override public Dimension getPreferredSize(){
      return super.getPreferredSize();
    }
    @Override public boolean getScrollableTracksViewportWidth(){
      return true;
    }
  }
;
  scrollpane=new JScrollPane(table){
    @Override public Dimension getSize(){
      return super.getSize();
    }
    @Override public Dimension getPreferredSize(){
      return super.getPreferredSize();
    }
  }
;
  scrollpane.setPreferredSize(new Dimension(250,200));
}
Program: 86939
Project: 86939
Buggy source:
void setupTermTable(){
  table.setSelectionBackground(GUtil.Dark2[0]);
  table.setFillsViewportHeight(true);
  TermCellRenderer centerRenderer=new TermCellRenderer();
  centerRenderer.setHorizontalAlignment(JLabel.CENTER);
  TermCellRenderer rightRenderer=new TermCellRenderer();
  rightRenderer.setHorizontalAlignment(JLabel.RIGHT);
  TableColumn cc;
  cc=table.getColumnModel().getColumn(0);
  cc.setMinWidth(100);
  cc=table.getColumnModel().getColumn(1);
  cc.setMinWidth(20);
  cc.setWidth(20);
  cc.setCellRenderer(centerRenderer);
  cc=table.getColumnModel().getColumn(2);
  cc.setMinWidth(8);
  cc.setMaxWidth(8);
  cc=table.getColumnModel().getColumn(3);
  cc.setMinWidth(20);
  cc.setWidth(20);
  cc.setCellRenderer(centerRenderer);
  cc=table.getColumnModel().getColumn(4);
  cc.setCellRenderer(centerRenderer);
  cc.setMinWidth(50);
  table.setAutoCreateRowSorter(true);
  table.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      JTable table=(JTable)e.getSource();
      int row=table.rowAtPoint(e.getPoint());
      if (row < 0) {
        return;
      }
      if (e.getClickCount() == 1) {
      }
 else       if (e.getClickCount() == 2) {
        String term=getTermAt(row);
        doubleClickListener.accept(term);
      }
    }
  }
);
}

Fixed version (ground truth):
void setupTermTable(){
  table.setSelectionBackground(GUtil.Dark2[0]);
  TermCellRenderer centerNumberRenderer=new TermCellRenderer();
  centerNumberRenderer.setHorizontalAlignment(JLabel.CENTER);
  TableColumn cc;
  cc=table.getColumnModel().getColumn(0);
  cc.setMinWidth(100);
  cc.setPreferredWidth(100);
  cc=table.getColumnModel().getColumn(1);
  cc.setCellRenderer(centerNumberRenderer);
  cc.setPreferredWidth(50);
  cc=table.getColumnModel().getColumn(2);
  cc.setMinWidth(8);
  cc.setMaxWidth(8);
  cc.setPreferredWidth(8);
  cc=table.getColumnModel().getColumn(3);
  cc.setCellRenderer(centerNumberRenderer);
  cc.setPreferredWidth(50);
  cc=table.getColumnModel().getColumn(4);
  cc.setCellRenderer(centerNumberRenderer);
  cc.setPreferredWidth(50);
  table.setAutoCreateRowSorter(true);
  table.addMouseListener(new MouseAdapter(){
    @Override public void mouseClicked(    MouseEvent e){
      JTable table=(JTable)e.getSource();
      int row=table.rowAtPoint(e.getPoint());
      if (row < 0) {
        return;
      }
      if (e.getClickCount() == 1) {
      }
 else       if (e.getClickCount() == 2) {
        String term=getTermAt(row);
        doubleClickListener.accept(term);
      }
    }
  }
);
}
Program: 86940
Project: 86940
Buggy source:
public void setDefaultXYLim(Corpus corpus){
  double xmin=corpus.covariateSummaries.get(xattr).min(), xmax=corpus.covariateSummaries.get(xattr).max(), ymin=corpus.covariateSummaries.get(yattr).min(), ymax=corpus.covariateSummaries.get(yattr).max();
  double scale;
  scale=ymax - ymin;
  minUserY=ymin - scale * scaleMult;
  maxUserY=ymax + scale * scaleMult;
  scale=xmax - xmin;
  minUserX=xmin - scale * scaleMult;
  maxUserX=xmax + scale * scaleMult;
}

Fixed version (ground truth):
public void setDefaultXYLim(Corpus corpus){
  double xmin=corpus.covariateSummaries.get(xattr).min(), xmax=corpus.covariateSummaries.get(xattr).max(), ymin=corpus.covariateSummaries.get(yattr).min(), ymax=corpus.covariateSummaries.get(yattr).max();
  double scale;
  scale=ymax - ymin;
  scale=scale == 0 ? 1 : scale;
  minUserY=ymin - scale * scaleMult;
  maxUserY=ymax + scale * scaleMult;
  scale=xmax - xmin;
  scale=scale == 0 ? 1 : scale;
  minUserX=xmin - scale * scaleMult;
  maxUserX=xmax + scale * scaleMult;
}
Program: 86941
Project: 86941
Buggy source:
void setupTermTable(final TermTable tt){
  tt.setupTermTable();
  tt.table.getSelectionModel().addListSelectionListener(e -> {
    if (e.getValueIsAdjusting()) {
      runTermQuery();
    }
  }
);
}

Fixed version (ground truth):
void setupTermTable(final TermTable tt){
  tt.setupTermTable();
  tt.table.getSelectionModel().addListSelectionListener(e -> {
    if (!e.getValueIsAdjusting()) {
      runTermQuery();
    }
  }
);
}
Program: 86942
Project: 86942
Buggy source:
/** 
 * {@inheritDoc}
 */
@NotNull @Override public ProgramCommandLine makeProgramCommandLine() throws RunBuildException {
  Path lib=clientDirectory.resolve("String_Node_Str");
  Path conf=clientDirectory.resolve("String_Node_Str");
  JavaCommandLineBuilder cliBuilder=new JavaCommandLineBuilder();
  String javaHome=getRunnerParameters().get(JavaRunnerConstants.TARGET_JDK_HOME);
  cliBuilder.setJavaHome(javaHome);
  cliBuilder.setBaseDir(workingDirectory);
  cliBuilder.setWorkingDir(workingDirectory);
  cliBuilder.setJvmArgs(JavaRunnerUtil.extractJvmArgs(getRunnerParameters()));
  cliBuilder.setMainClass(MAIN_CLASS);
  cliBuilder.setClassPath(format("String_Node_Str",lib,conf));
  cliBuilder.addSystemProperty("String_Node_Str",clientDirectory.toString());
  cliBuilder.addSystemProperty("String_Node_Str",propertiesFile.toString());
  cliBuilder.addProgramArg("String_Node_Str");
  cliBuilder.addProgramArg("String_Node_Str");
  cliBuilder.addProgramArg(resultsDirectory.toString());
  cliBuilder.addProgramArg("String_Node_Str");
  cliBuilder.addProgramArg(reportDirectory.toString());
  return cliBuilder.build();
}

Fixed version (ground truth):
/** 
 * {@inheritDoc}
 */
@NotNull @Override public ProgramCommandLine makeProgramCommandLine() throws RunBuildException {
  String lib=format("String_Node_Str",clientDirectory.resolve("String_Node_Str"));
  String conf=clientDirectory.resolve("String_Node_Str").toString();
  JavaCommandLineBuilder cliBuilder=new JavaCommandLineBuilder();
  String javaHome=getRunnerParameters().get(JavaRunnerConstants.TARGET_JDK_HOME);
  cliBuilder.setJavaHome(javaHome);
  cliBuilder.setBaseDir(workingDirectory);
  cliBuilder.setWorkingDir(workingDirectory);
  cliBuilder.setJvmArgs(JavaRunnerUtil.extractJvmArgs(getRunnerParameters()));
  cliBuilder.setMainClass(MAIN_CLASS);
  cliBuilder.setClassPath(formatClassPath(lib,conf));
  cliBuilder.addSystemProperty("String_Node_Str",clientDirectory.toString());
  cliBuilder.addSystemProperty("String_Node_Str",propertiesFile.toString());
  cliBuilder.addProgramArg("String_Node_Str");
  cliBuilder.addProgramArg("String_Node_Str");
  cliBuilder.addProgramArg(resultsDirectory.toString());
  cliBuilder.addProgramArg("String_Node_Str");
  cliBuilder.addProgramArg(reportDirectory.toString());
  return cliBuilder.build();
}
Program: 86943
Project: 86943
Buggy source:
private static void initPreferences(Context context){
  if (preferences == null) {
    preferences=PreferenceManager.getDefaultSharedPreferences(context);
  }
  if (KEY_ENABLE_NOTIFICATION == null || KEY_ENABLE_NOTIFICATION.isEmpty()) {
    KEY_ENABLE_NOTIFICATION=context.getResources().getString(R.string.pref_key_enable_notification);
  }
}

Fixed version (ground truth):
private static void initPreferences(Context context){
  if (preferences == null) {
    preferences=PreferenceManager.getDefaultSharedPreferences(context);
  }
  if (KEY_ENABLE_NOTIFICATION == null || KEY_ENABLE_NOTIFICATION.isEmpty()) {
    KEY_ENABLE_NOTIFICATION=context.getResources().getString(R.string.pref_key_enable_notification);
  }
  if (KEY_HIDE_LOW_PRIORITY_NOTIFICATIONS == null || KEY_HIDE_LOW_PRIORITY_NOTIFICATIONS.isEmpty()) {
    KEY_HIDE_LOW_PRIORITY_NOTIFICATIONS=context.getResources().getString(R.string.pref_key_hide_low_priority_notifications);
  }
  if (KEY_HIDE_PERSISTENT_NOTIFICATIONS == null || KEY_HIDE_PERSISTENT_NOTIFICATIONS.isEmpty()) {
    KEY_HIDE_PERSISTENT_NOTIFICATIONS=context.getResources().getString(R.string.pref_key_hide_persistent_notifications);
  }
}
Program: 86944
Project: 86944
Buggy source:
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == MASTER_PASSWORD_REQUEST) {
    if (!(resultCode == RESULT_OK && AdminActions.isAdminEnabled())) {
      finish();
    }
  }
  super.onActivityResult(requestCode,resultCode,data);
}

Fixed version (ground truth):
@Override protected void onActivityResult(int requestCode,int resultCode,Intent data){
  if (requestCode == MASTER_PASSWORD_REQUEST) {
    if (!(resultCode == RESULT_OK && AdminActions.isAdminEnabled())) {
      finish();
    }
 else {
      refreshUserList();
    }
  }
  super.onActivityResult(requestCode,resultCode,data);
}
Program: 86945
Project: 86945
Buggy source:
private void showUserList(){
  usersList.clearAnimation();
  usersList.setVisibility(View.VISIBLE);
  usersList.animate().alpha(1f).translationY(0f).setInterpolator(new DecelerateInterpolator()).setListener(null).start();
  navDrawerListView.animate().translationY(usersList.getHeight()).alpha(0).setListener(new Animator.AnimatorListener(){
    @Override public void onAnimationStart(    Animator animation){
    }
    @Override public void onAnimationEnd(    Animator animation){
      navDrawerListView.setVisibility(View.GONE);
      usersList.setBackgroundColor(Color.TRANSPARENT);
    }
    @Override public void onAnimationCancel(    Animator animation){
      navDrawerListView.setVisibility(View.GONE);
      usersList.setBackgroundColor(Color.TRANSPARENT);
    }
    @Override public void onAnimationRepeat(    Animator animation){
    }
  }
).setInterpolator(new DecelerateInterpolator()).start();
  userListDropDown.animate().rotation(180).setInterpolator(new AccelerateDecelerateInterpolator()).start();
}

Fixed version (ground truth):
private void showUserList(){
  usersList.clearAnimation();
  usersList.setVisibility(View.VISIBLE);
  usersList.animate().alpha(1f).translationY(0f).setInterpolator(new AccelerateDecelerateInterpolator()).setListener(null).start();
  navDrawerListView.animate().translationY(usersList.getHeight()).alpha(0).setListener(new Animator.AnimatorListener(){
    @Override public void onAnimationStart(    Animator animation){
    }
    @Override public void onAnimationEnd(    Animator animation){
      navDrawerListView.setVisibility(View.GONE);
      usersList.setBackgroundColor(Color.TRANSPARENT);
    }
    @Override public void onAnimationCancel(    Animator animation){
      navDrawerListView.setVisibility(View.GONE);
      usersList.setBackgroundColor(Color.TRANSPARENT);
    }
    @Override public void onAnimationRepeat(    Animator animation){
    }
  }
).setInterpolator(new AccelerateDecelerateInterpolator()).start();
  userListDropDown.animate().rotation(180).setInterpolator(new AccelerateDecelerateInterpolator()).start();
}
Program: 86947
Project: 86947
Buggy source:
/** 
 * Constructor which takes in the required data to create list items
 * @param context Activity context
 * @param mainItems The names of main items. They are intended to replace the fragment of the settings activity
 * @param mainItemImageRIds Resource ids of icons for main list items. Should be in the same order as that of the names list.
 * @param secondaryItems Secondary item names.
 * @param secondaryItemImageRIds Resource ids of icons for secondary list items. Should be in the same order as that of the names list.
 */
public NavigationDrawerListAdapter(Context context,List<String> mainItems,List<Integer> mainItemImageRIds,List<String> secondaryItems,List<Integer> secondaryItemImageRIds){
  mContext=context;
  mMainItems=mainItems;
  mMainItemImageRIds=mainItemImageRIds;
  mSecondaryItems=secondaryItems;
  mSecondaryItemImageRIds=secondaryItemImageRIds;
  selectedItemTypeface=Typeface.DEFAULT_BOLD;
  unSelectedItemTypeface=Typeface.create("String_Node_Str",Typeface.NORMAL);
}

Fixed version (ground truth):
/** 
 * Constructor which takes in the required data to create list items
 * @param context Activity context
 * @param mainItems The names of main items. They are intended to replace the fragment of the settings activity
 * @param mainItemImageRIds Resource ids of icons for main list items. Should be in the same order as that of the names list.
 * @param secondaryItems Secondary item names.
 * @param secondaryItemImageRIds Resource ids of icons for secondary list items. Should be in the same order as that of the names list.
 */
public NavigationDrawerListAdapter(Context context,List<String> mainItems,List<Integer> mainItemImageRIds,List<String> secondaryItems,List<Integer> secondaryItemImageRIds){
  mContext=context;
  mMainItems=mainItems;
  mMainItemImageRIds=mainItemImageRIds;
  mSecondaryItems=secondaryItems;
  mSecondaryItemImageRIds=secondaryItemImageRIds;
  itemTypeface=Typeface.DEFAULT_BOLD;
  selectedItemBackgroundColor=context.getResources().getColor(R.color.text_view_touched);
}
Program: 86948
Project: 86948
Buggy source:
@Override public int getItemViewType(int position){
  if (position < mMainItems.size()) {
    return ITEM_TYPE_MAIN;
  }
 else   if (position == mMainItems.size()) {
    return ITEM_TYPE_SEPARATOR;
  }
 else   if (position < mMainItems.size() + mSecondaryItems.size() + 1) {
    return ITEM_TYPE_SECONDARY;
  }
  return -1;
}

Fixed version (ground truth):
@Override public int getItemViewType(int position){
  if (position < mMainItems.size()) {
    return ITEM_TYPE_MAIN;
  }
 else   if (position == mMainItems.size()) {
    return ITEM_TYPE_SEPARATOR;
  }
 else   if (position < mMainItems.size() + mSecondaryItems.size() + 1) {
    return ITEM_TYPE_SECONDARY;
  }
 else   if (position == mMainItems.size() + mSecondaryItems.size() + 1) {
    return ITEM_TYPE_SEPARATOR;
  }
  return -1;
}
Program: 86950
Project: 86950
Buggy source:
@Override public int getCount(){
  return mMainItems.size() + mSecondaryItems.size() + 1;
}

Fixed version (ground truth):
@Override public int getCount(){
  return mMainItems.size() + mSecondaryItems.size() + 2;
}
Program: 86954
Project: 86954
Buggy source:
@Override public void onNotificationPosted(StatusBarNotification sbn){
  LockScreenNotification lsn=new LockScreenNotification(sbn);
  for (int i=0; i < currentNotifications.size(); i++) {
    if (currentNotifications.get(i).getPackageName().equals(sbn.getPackageName()) && currentNotifications.get(i).getId() == sbn.getId()) {
      currentNotifications.remove(i);
      currentSBN.remove(i);
      break;
    }
  }
  currentNotifications.add(lsn);
  currentSBN.add(sbn);
  Intent intent=new Intent(this,BaseService.class);
  intent.setAction(BaseService.ACTION_NOTIFICATION_POSTED);
  startService(intent);
}

Fixed version (ground truth):
@Override public void onNotificationPosted(StatusBarNotification sbn){
  LockScreenNotification lsn=new LockScreenNotification(sbn);
  CardView currentCardView=null;
  for (int i=0; i < currentNotifications.size(); i++) {
    if (currentNotifications.get(i).getPackageName().equals(sbn.getPackageName()) && currentNotifications.get(i).getId() == sbn.getId()) {
      currentCardView=currentNotifications.get(i).getCardView();
      currentNotifications.remove(i);
      currentSBN.remove(i);
      break;
    }
  }
  if (currentCardView != null) {
    lsn.setCardView(currentCardView);
  }
  currentNotifications.add(lsn);
  currentSBN.add(sbn);
  Intent intent=new Intent(this,BaseService.class);
  intent.setAction(BaseService.ACTION_NOTIFICATION_POSTED);
  startService(intent);
}
Program: 86955
Project: 86955
Buggy source:
public void notificationPosted(){
  if (noOfNotificationShown() < MAX_NOTIFICATION_SHOWN) {
    Log.d(LOG_TAG,"String_Node_Str" + noOfNotificationShown());
    for (int i=0; i < NotificationService.currentNotifications.size(); i++) {
      if (NotificationService.currentNotifications.get(i).isShown()) {
        continue;
      }
 else {
        Log.d(LOG_TAG,"String_Node_Str");
        setNotificationCard(NotificationService.currentNotifications.get(i));
        break;
      }
    }
  }
 else {
    setMoreCard();
  }
}

Fixed version (ground truth):
public void notificationPosted(){
  if (noOfNotificationShown() < MAX_NOTIFICATION_SHOWN) {
    Log.d(LOG_TAG,"String_Node_Str" + noOfNotificationShown());
    for (int i=0; i < NotificationService.currentNotifications.size(); i++) {
      if (NotificationService.currentNotifications.get(i).isShown()) {
        continue;
      }
 else {
        Log.d(LOG_TAG,"String_Node_Str");
        setNotificationCard(NotificationService.currentNotifications.get(i));
        break;
      }
    }
  }
  setMoreCard();
}
Program: 86956
Project: 86956
Buggy source:
@Override public void onWindowFocusChanged(boolean hasFocus){
  super.onWindowFocusChanged(hasFocus);
  startService(BaseService.getServiceIntent(this,null,BaseService.ACTION_DETECT_ENVIRONMENT));
  finish();
  overridePendingTransition(0,0);
}

Fixed version (ground truth):
@Override public void onWindowFocusChanged(boolean hasFocus){
  super.onWindowFocusChanged(hasFocus);
  EnvironmentDetector.manageEnvironmentDetectionCriticalSection.release();
  startService(BaseService.getServiceIntent(this,null,BaseService.ACTION_DETECT_ENVIRONMENT));
  finish();
  overridePendingTransition(0,0);
}
Program: 86957
Project: 86957
Buggy source:
/** 
 * Adds the view specified by getLayout() to the windowManager passed during initialization
 */
public void execute(){
  layout=getLayout();
  layout.setLayerType(View.LAYER_TYPE_HARDWARE,null);
  if (params == null) {
    params=getLayoutParams();
  }
  try {
    windowManager.addView(layout,params);
    layout.invalidate();
  }
 catch (  IllegalStateException e) {
  }
}

Fixed version (ground truth):
/** 
 * Adds the view specified by getLayout() to the windowManager passed during initialization
 */
public void execute(){
  layout=getLayout();
  if (isAdded)   return;
  layout.setLayerType(View.LAYER_TYPE_HARDWARE,null);
  if (params == null) {
    params=getLayoutParams();
  }
  try {
    windowManager.addView(layout,params);
    isAdded=true;
    layout.invalidate();
  }
 catch (  IllegalStateException e) {
    isAdded=false;
  }
}
Program: 86958
Project: 86958
Buggy source:
/** 
 * Removes the view specified by getLayout() from the windowManager passed during initialization
 */
public void remove(){
  if (layout == null) {
    layout=getLayout();
  }
  try {
    windowManager.removeView(layout);
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
/** 
 * Removes the view specified by getLayout() from the windowManager passed during initialization
 */
public void remove(){
  if (!isAdded)   return;
  try {
    windowManager.removeView(layout);
    isAdded=false;
  }
 catch (  Exception e) {
  }
}
Program: 86959
Project: 86959
Buggy source:
@Override public int onStartCommand(Intent intent,int flags,int startId){
  if (intent != null) {
    String action=intent.getAction();
    if (action != null && !action.isEmpty()) {
      if (action.equals(ACTION_CLEAR_PREVIOUS_PACKAGE)) {
        previousPackageName="String_Node_Str";
      }
 else       if (action.equals(ACTION_START_SERVICE)) {
        startThread();
      }
 else       if (action.equals(ACTION_STOP_SERVICE)) {
        stopThread();
      }
 else       if (action.equals(ACTION_START_APP_LOCK_OVERLAY)) {
        mAppLockScreenOverlay.execute();
      }
 else       if (action.equals(ACTION_CLEAR_APP_LOCK_OVERLAY)) {
        mAppLockScreenOverlay.remove();
      }
    }
  }
  super.onStartCommand(intent,flags,startId);
  return START_STICKY;
}

Fixed version (ground truth):
@Override public int onStartCommand(Intent intent,int flags,int startId){
  if (intent != null) {
    String action=intent.getAction();
    if (action != null && !action.isEmpty()) {
      if (action.equals(ACTION_CLEAR_PREVIOUS_PACKAGE)) {
        previousPackageName="String_Node_Str";
        mAppLockScreenOverlay.remove();
      }
 else       if (action.equals(ACTION_START_SERVICE)) {
        startThread();
      }
 else       if (action.equals(ACTION_STOP_SERVICE)) {
        stopThread();
      }
 else       if (action.equals(ACTION_START_APP_LOCK_OVERLAY)) {
        mAppLockScreenOverlay.execute();
      }
 else       if (action.equals(ACTION_CLEAR_APP_LOCK_OVERLAY)) {
        mAppLockScreenOverlay.remove();
      }
    }
  }
  super.onStartCommand(intent,flags,startId);
  return START_STICKY;
}
Program: 86961
Project: 86961
Buggy source:
@Override public void onReceive(Context context,Intent intent){
  String mAction=intent.getAction();
  BluetoothDevice device;
  if (mAction.equals(BluetoothDevice.ACTION_ACL_CONNECTED)) {
    device=intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
    addBluetoothDeviceToConnectedDevices(BluetoothEnvironmentVariable.getBluetoothEnvironmentVariableFromDatabase(context,device.getName(),device.getAddress()));
  }
 else   if (mAction.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED)) {
    device=intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
    removeBluetoothDeviceFromConnectedDevices(BluetoothEnvironmentVariable.getBluetoothEnvironmentVariableFromDatabase(context,device.getName(),device.getAddress()));
  }
 else   return;
  Toast.makeText(context,device.getName() + "String_Node_Str",Toast.LENGTH_SHORT).show();
  context.startService(BaseService.getServiceIntent(context,null,BaseService.ACTION_DETECT_ENVIRONMENT));
}

Fixed version (ground truth):
@Override public void onReceive(Context context,Intent intent){
  String mAction=intent.getAction();
  BluetoothDevice device;
  if (mAction.equals(BluetoothDevice.ACTION_ACL_CONNECTED)) {
    device=intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
    addBluetoothDeviceToConnectedDevices(new BluetoothEnvironmentVariable(device.getName(),device.getAddress()));
  }
 else   if (mAction.equals(BluetoothDevice.ACTION_ACL_DISCONNECTED)) {
    device=intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE);
    removeBluetoothDeviceFromConnectedDevices(new BluetoothEnvironmentVariable(device.getName(),device.getAddress()));
  }
 else   return;
  Toast.makeText(context,device.getName() + "String_Node_Str",Toast.LENGTH_SHORT).show();
  context.startService(BaseService.getServiceIntent(context,null,BaseService.ACTION_DETECT_ENVIRONMENT));
}
Program: 86963
Project: 86963
Buggy source:
public LockScreenNotification(StatusBarNotification sbn){
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
    this.notification_id=sbn.getId();
    this.mNotification=sbn.getNotification();
    this.packageName=sbn.getPackageName();
    this.isClearable=sbn.isClearable();
    this.tag=sbn.getTag();
    this.isShown=false;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      this.key=sbn.getKey();
    }
  }
}

Fixed version (ground truth):
public LockScreenNotification(StatusBarNotification sbn){
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
    this.notification_id=sbn.getId();
    this.mNotification=sbn.getNotification();
    this.packageName=sbn.getPackageName();
    this.isOngoing=sbn.isOngoing();
    this.tag=sbn.getTag();
    this.isShown=false;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      this.key=sbn.getKey();
    }
  }
}
Program: 86965
Project: 86965
Buggy source:
public void notificationRemoved(){
  if (notificationCardsLayout == null) {
    return;
  }
  for (int i=0; i < NotificationService.removedNotifications.size(); i++) {
    LockScreenNotification lsn=NotificationService.removedNotifications.get(i);
    notificationCardsLayout.removeView(lsn.getCardView());
  }
  setMoreCard();
}

Fixed version (ground truth):
public void notificationRemoved(){
  if (notificationCardsLayout == null) {
    return;
  }
  for (int i=0; i < NotificationService.removedNotifications.size(); i++) {
    LockScreenNotification lsn=NotificationService.removedNotifications.get(i);
    notificationCardsLayout.removeView(lsn.getCardView());
  }
  while (noOfNotificationShown() < ((MAX_NOTIFICATION_SHOWN < NotificationService.currentNotifications.size()) ? MAX_NOTIFICATION_SHOWN : NotificationService.currentNotifications.size())) {
    for (int i=0; i < NotificationService.currentNotifications.size(); i++) {
      if (NotificationService.currentNotifications.get(i).isShown()) {
        continue;
      }
 else {
        Log.d(LOG_TAG,"String_Node_Str");
        setNotificationCard(NotificationService.currentNotifications.get(i));
        break;
      }
    }
  }
  setMoreCard();
}
Program: 86970
Project: 86970
Buggy source:
public static void launchDialer(Context context){
  Intent intent=new Intent(Intent.ACTION_DIAL);
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  context.startActivity(intent);
}

Fixed version (ground truth):
public static void launchDialer(Context context){
  Intent intent=new Intent(Intent.ACTION_DIAL);
  intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
  try {
    context.startActivity(intent);
  }
 catch (  Exception e2) {
    Toast.makeText(context,"String_Node_Str",Toast.LENGTH_SHORT).show();
    e2.printStackTrace();
  }
}
Program: 86971
Project: 86971
Buggy source:
private void lockScreenDismiss(int direction,float endVelocity){
  if (endVelocity > 0) {
    if (direction == CustomFlingListener.DIRECTION_UP) {
      layout.animate().translationY(-layout.getHeight()).setInterpolator(new DecelerateInterpolator(endVelocity / 2)).setListener(new AnimateEndListener()).start();
    }
 else     if (direction == CustomFlingListener.DIRECTION_DOWN) {
      layout.animate().translationY(layout.getHeight()).setInterpolator(new DecelerateInterpolator(endVelocity / 2)).setListener(new AnimateEndListener()).start();
    }
 else     if (direction == CustomFlingListener.DIRECTION_LEFT) {
      layout.animate().translationX(-layout.getWidth()).setInterpolator(new DecelerateInterpolator(endVelocity / 2)).setListener(new AnimateEndListener()).start();
    }
 else {
      layout.animate().translationX(+layout.getWidth()).setInterpolator(new DecelerateInterpolator(endVelocity / 2)).setListener(new AnimateEndListener()).start();
    }
  }
 else {
    layout.animate().translationY(-layout.getHeight()).setListener(new AnimateEndListener()).setInterpolator(new AccelerateInterpolator()).start();
  }
}

Fixed version (ground truth):
private void lockScreenDismiss(int direction,float endVelocity){
  Log.d(LOG_TAG,"String_Node_Str" + endVelocity);
  if (endVelocity > 0) {
    if (direction == CustomFlingListener.DIRECTION_UP) {
      layout.animate().translationY(-layout.getHeight()).setInterpolator(new DecelerateInterpolator(endVelocity / 2)).setListener(new AnimateEndListener()).start();
    }
 else     if (direction == CustomFlingListener.DIRECTION_DOWN) {
      layout.animate().translationY(layout.getHeight()).setInterpolator(new DecelerateInterpolator(endVelocity / 2)).setListener(new AnimateEndListener()).start();
    }
 else     if (direction == CustomFlingListener.DIRECTION_LEFT) {
      layout.animate().translationX(-layout.getWidth()).setInterpolator(new DecelerateInterpolator(endVelocity / 2)).setListener(new AnimateEndListener()).start();
    }
 else {
      layout.animate().translationX(+layout.getWidth()).setInterpolator(new DecelerateInterpolator(endVelocity / 2)).setListener(new AnimateEndListener()).start();
    }
  }
 else {
    layout.animate().translationY(-layout.getHeight()).setListener(new AnimateEndListener()).setInterpolator(new AccelerateInterpolator()).start();
  }
}
Program: 86972
Project: 86972
Buggy source:
@Override public void onBottomToTop(float endVelocity){
  lockScreenDismiss(CustomFlingListener.DIRECTION_UP,DEFAULT_START_ANIMATION_VELOCITY);
}

Fixed version (ground truth):
@Override public void onBottomToTop(float endVelocity){
  lockScreenDismiss(CustomFlingListener.DIRECTION_UP,endVelocity);
}
Program: 86973
Project: 86973
Buggy source:
@Override public void onTopToBottom(float endVelocity){
  lockScreenDismiss(CustomFlingListener.DIRECTION_DOWN,DEFAULT_START_ANIMATION_VELOCITY);
  NotificationAreaHelper.expand(context);
}

Fixed version (ground truth):
@Override public void onTopToBottom(float endVelocity){
  lockScreenDismiss(CustomFlingListener.DIRECTION_DOWN,endVelocity);
  NotificationAreaHelper.expand(context);
}
Program: 86976
Project: 86976
Buggy source:
/** 
 * Called when a drawer has settled in a completely closed state. 
 */
public void onDrawerClosed(View view){
  super.onDrawerClosed(view);
  if (mTitle != null) {
    setTitle(mTitle);
  }
}

Fixed version (ground truth):
/** 
 * Called when a drawer has settled in a completely closed state. 
 */
public void onDrawerClosed(View view){
  super.onDrawerClosed(view);
switch (listAdapter.getItemViewType(position)) {
case NavigationDrawerListAdapter.ITEM_TYPE_PROFILE:
    listAdapter.setSelectedProfileIndex(listAdapter.getItemArrayIndex(position));
  break;
case NavigationDrawerListAdapter.ITEM_TYPE_NEW_PROFILE:
break;
case NavigationDrawerListAdapter.ITEM_TYPE_MAIN:
FragmentManager fragmentManager=getFragmentManager();
boolean isValid=true;
int itemArrayIndex=listAdapter.getItemArrayIndex(position);
switch (itemArrayIndex) {
case INDEX_MANAGE_ENVIRONMENTS:
fragmentManager.beginTransaction().replace(R.id.container,new ManageEnvironmentFragment()).commit();
break;
case INDEX_ENVIRONMENT_OVERLAP:
fragmentManager.beginTransaction().replace(R.id.container,new OverlappingEnvironmentsFragment()).commit();
break;
case INDEX_MASTER_PASSWORD:
fragmentManager.beginTransaction().replace(R.id.container,new SetMasterPasswordFragment()).commit();
break;
default :
isValid=false;
}
if (isValid) {
mTitle=mainItemList.get(itemArrayIndex);
listAdapter.setSelectedMainItemIndex(itemArrayIndex);
listAdapter.notifyDataSetChanged();
}
break;
case NavigationDrawerListAdapter.ITEM_TYPE_SECONDARY:
fragmentManager=getFragmentManager();
switch (listAdapter.getItemArrayIndex(position)) {
default :
Toast.makeText(SmartLockScreenSettings.this,"String_Node_Str",Toast.LENGTH_SHORT).show();
}
break;
default :
return;
}
if (mTitle != null) {
setTitle(mTitle);
}
position=-1;
}
Program: 86977
Project: 86977
Buggy source:
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
switch (listAdapter.getItemViewType(position)) {
case NavigationDrawerListAdapter.ITEM_TYPE_PROFILE:
    listAdapter.setSelectedProfileIndex(listAdapter.getItemArrayIndex(position));
  break;
case NavigationDrawerListAdapter.ITEM_TYPE_NEW_PROFILE:
break;
case NavigationDrawerListAdapter.ITEM_TYPE_MAIN:
FragmentManager fragmentManager=getFragmentManager();
boolean isValid=true;
int itemArrayIndex=listAdapter.getItemArrayIndex(position);
switch (itemArrayIndex) {
case INDEX_MANAGE_ENVIRONMENTS:
fragmentManager.beginTransaction().replace(R.id.container,new ManageEnvironmentFragment()).commit();
break;
case INDEX_ENVIRONMENT_OVERLAP:
fragmentManager.beginTransaction().replace(R.id.container,new OverlappingEnvironmentsFragment()).commit();
break;
case INDEX_MASTER_PASSWORD:
fragmentManager.beginTransaction().replace(R.id.container,new SetMasterPasswordFragment()).commit();
break;
default :
isValid=false;
}
if (isValid) {
mTitle=mainItemList.get(itemArrayIndex);
listAdapter.setSelectedMainItemIndex(itemArrayIndex);
listAdapter.notifyDataSetChanged();
}
break;
case NavigationDrawerListAdapter.ITEM_TYPE_SECONDARY:
fragmentManager=getFragmentManager();
switch (listAdapter.getItemArrayIndex(position)) {
default :
Toast.makeText(SmartLockScreenSettings.this,"String_Node_Str",Toast.LENGTH_SHORT).show();
}
break;
default :
return;
}
drawerLayout.closeDrawers();
}

Fixed version (ground truth):
@Override public void onItemClick(AdapterView<?> parent,View view,int position,long id){
  SmartLockScreenSettings.this.position=position;
  drawerLayout.closeDrawers();
}
Program: 86978
Project: 86978
Buggy source:
public NoSecurity(){
  super(Passphrase.TYPE_NONE);
}

Fixed version (ground truth):
public NoSecurity(){
  super(Passphrase.TYPE_NONE,null);
}
Program: 86979
Project: 86979
Buggy source:
public static void removeEnvironmentFromOverlapPreferences(long environmentId,Context context){
  initPreferences(context);
  Map<String,?> preferenceMap=preferences.getAll();
  for (  String key : preferenceMap.keySet()) {
    if (key.startsWith(KEY_PREFIX_OVERLAP_CHOICE)) {
      List<Long> envIds=getEnvironmentIdsFromKey(key);
      long prefEnv=(Long)preferenceMap.get(key);
      if (envIds.contains(environmentId)) {
        SharedPreferences.Editor editor=preferences.edit();
        editor.remove(key);
        envIds.remove(environmentId);
        if (envIds.size() > 1 && prefEnv != environmentId && preferences.getLong(buildKeyForEnvironmentIds(envIds),-1) == -1) {
          editor.putLong(buildKeyForEnvironmentIds(envIds),prefEnv);
        }
        editor.apply();
      }
    }
  }
}

Fixed version (ground truth):
public static void removeEnvironmentFromOverlapPreferences(long environmentId,Context context){
  initPreferences(context);
  Map<String,?> preferenceMap=preferences.getAll();
  for (  String key : preferenceMap.keySet()) {
    if (key.startsWith(KEY_PREFIX_OVERLAP_CHOICE)) {
      List<Long> envIds=getEnvironmentIdsFromKey(key);
      long prefEnv=(Long)preferenceMap.get(key);
      if (envIds.contains(environmentId)) {
        SharedPreferences.Editor editor=preferences.edit();
        editor.remove(key);
        envIds.remove(environmentId);
        if (envIds.size() > 1 && prefEnv != environmentId && preferences.getLong(buildKeyForEnvironmentIds(envIds),-1) == -1) {
          editor.putLong(buildKeyForEnvironmentIds(envIds),prefEnv);
        }
        editor.apply();
      }
    }
  }
  preferences=null;
}
Program: 86980
Project: 86980
Buggy source:
public static void setEnvironmentOverlapChoice(List<Environment> overlappingEnvironments,long chosenEnvironmentId,Context context){
  initPreferences(context);
  if (overlappingEnvironments == null || overlappingEnvironments.size() < 1) {
    return;
  }
  SharedPreferences.Editor editor=preferences.edit();
  editor.putLong(buildKeyForEnvironments(overlappingEnvironments),chosenEnvironmentId);
  editor.apply();
}

Fixed version (ground truth):
public static void setEnvironmentOverlapChoice(List<Environment> overlappingEnvironments,long chosenEnvironmentId,Context context){
  initPreferences(context);
  if (overlappingEnvironments == null || overlappingEnvironments.size() < 1) {
    return;
  }
  SharedPreferences.Editor editor=preferences.edit();
  editor.putLong(buildKeyForEnvironments(overlappingEnvironments),chosenEnvironmentId);
  editor.apply();
  preferences=null;
}
Program: 86981
Project: 86981
Buggy source:
public static void setMasterPassword(Context context,String passwordString,String passwordType){
  if (Utility.checkForNullAndWarn(passwordString,LOG_TAG) || Utility.checkForNullAndWarn(passwordType,LOG_TAG)) {
    return;
  }
  initPreferences(context);
  SharedPreferences.Editor editor=preferences.edit();
  editor.putString(KEY_MASTER_PASSWORD,passwordString);
  editor.putString(KEY_MASTER_PASSWORD_TYPE,passwordType);
  editor.apply();
}

Fixed version (ground truth):
public static void setMasterPassword(Context context,String passwordString,String passwordType){
  if (Utility.checkForNullAndWarn(passwordString,LOG_TAG) || Utility.checkForNullAndWarn(passwordType,LOG_TAG)) {
    return;
  }
  initPreferences(context);
  SharedPreferences.Editor editor=preferences.edit();
  editor.putString(KEY_MASTER_PASSWORD,passwordString);
  editor.putString(KEY_MASTER_PASSWORD_TYPE,passwordType);
  editor.apply();
  preferences=null;
}
Program: 86982
Project: 86982
Buggy source:
public static void setDeviceOwnerUserId(Context context,long id){
  initPreferences(context);
  SharedPreferences.Editor editor=preferences.edit();
  editor.putLong(KEY_DEVICE_OWNER_USER_ID,id);
  editor.apply();
}

Fixed version (ground truth):
public static void setDeviceOwnerUserId(Context context,long id){
  initPreferences(context);
  SharedPreferences.Editor editor=preferences.edit();
  editor.putLong(KEY_DEVICE_OWNER_USER_ID,id);
  editor.apply();
  preferences=null;
}
Program: 86986
Project: 86986
Buggy source:
@Override public void onCancelSetMasterPassword(){
  finish();
}

Fixed version (ground truth):
@Override public void onCancelSetMasterPassword(){
  setResult(RESULT_CANCELED);
  finish();
}
Program: 86987
Project: 86987
Buggy source:
@Override public void onMasterPasswordSet(){
  finish();
}

Fixed version (ground truth):
@Override public void onMasterPasswordSet(){
  setResult(RESULT_OK);
  finish();
}
Program: 86989
Project: 86989
Buggy source:
public void remove(){
  if (layout == null) {
    layout=getLayout();
  }
  if (params == null) {
    params=getLayoutParams();
  }
  try {
    windowManager.removeView(layout);
    layout=null;
  }
 catch (  Exception e) {
  }
}

Fixed version (ground truth):
public void remove(){
  if (layout == null) {
    layout=getLayout();
  }
  try {
    windowManager.removeView(layout);
    layout=null;
    params=null;
  }
 catch (  Exception e) {
  }
}
Program: 86992
Project: 86992
Buggy source:
@Override public View getInnerView(Context context,ViewGroup parent){
  LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
  RelativeLayout relativeLayout=new RelativeLayout(context);
  LinearLayout layout=new LinearLayout(context);
  layout.setLayoutParams(params);
  layout.setOrientation(LinearLayout.VERTICAL);
  layout.addView(passphraseEditText);
  layout.addView(passphraseConfirmationEditText);
  relativeLayout.addView(layout);
  relativeLayout.addView(passphraseEnterPatternTextView);
  parent.addView(relativeLayout);
  return layout;
}

Fixed version (ground truth):
@Override public View getInnerView(Context context,ViewGroup parent){
  LinearLayout.LayoutParams params=new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.WRAP_CONTENT);
  RelativeLayout relativeLayout=new RelativeLayout(context);
  LinearLayout layout=new LinearLayout(context);
  layout.setLayoutParams(params);
  layout.setOrientation(LinearLayout.VERTICAL);
  layout.addView(passphraseEditText);
  layout.addView(passphraseConfirmationEditText);
  relativeLayout.addView(layout);
  parent.addView(relativeLayout);
  return layout;
}
Program: 86995
Project: 86995
Buggy source:
public static boolean initialize(Context activityContext){
  boolean isMasterPasswordSet=false;
  if (!(activityContext instanceof Activity)) {
    Log.e(LOG_TAG,"String_Node_Str");
    return false;
  }
  AdminActions.initAdmin(activityContext);
  if (SharedPreferencesHelper.getMasterPasswordType(activityContext) == null) {
    activityContext.startActivity(new Intent(activityContext,SetMasterPassword.class));
  }
 else {
    isMasterPasswordSet=true;
  }
  if (!isMasterPasswordSet) {
    isMasterPasswordSet=SharedPreferencesHelper.getMasterPasswordType(activityContext) != null;
  }
  return isMasterPasswordSet && AdminActions.isAdminEnabled();
}

Fixed version (ground truth):
public static void initialize(Context activityContext,int requestCode){
  if (!(activityContext instanceof Activity)) {
    Log.e(LOG_TAG,"String_Node_Str");
    return;
  }
  AdminActions.initAdmin(activityContext);
  if (SharedPreferencesHelper.getMasterPasswordType(activityContext) == null) {
    ((Activity)activityContext).startActivityForResult(new Intent(activityContext,SetMasterPassword.class),requestCode);
  }
}
Program: 86996
Project: 86996
Buggy source:
private void initBluetoothDispItems(){
  mSelectedBluetoothItems=new ArrayList<Integer>();
  mSelectedBluetoothDevices=new ArrayList<BluetoothDevice>();
  setBluetoothItemsEnabled(true);
  enableBluetoothCheckBox.setChecked(true);
  bluetoothAllCheckbox.setChecked(false);
  if (environment.isBluetoothAllOrAny()) {
    bluetoothAllCheckbox.setChecked(true);
  }
  bluetoothDevices=BluetoothEnvironmentVariable.getPairedBluetoothDevices(getActivity());
  Vector<BluetoothEnvironmentVariable> bluetoothVariables=environment.getBluetoothEnvironmentVariables();
  for (int i=0; i < bluetoothDevices.size(); i++) {
    for (int j=0; j < bluetoothVariables.size(); j++) {
      if (bluetoothVariables.get(j).getDeviceAddress().equals(bluetoothDevices.get(i).getAddress())) {
        mSelectedBluetoothDevices.add(bluetoothDevices.get(i));
        mSelectedBluetoothItems.add(i);
      }
    }
  }
}

Fixed version (ground truth):
private void initBluetoothDispItems(){
  mSelectedBluetoothItems=new ArrayList<Integer>();
  mSelectedBluetoothDevices=new ArrayList<BluetoothDevice>();
  setBluetoothItemsEnabled(true);
  enableBluetoothCheckBox.setChecked(true);
  bluetoothAllCheckbox.setChecked(false);
  if (environment.isBluetoothAllOrAny()) {
    bluetoothAllCheckbox.setChecked(true);
  }
  bluetoothDevices=BluetoothEnvironmentVariable.getPairedBluetoothDevices(getActivity());
  Vector<BluetoothEnvironmentVariable> bluetoothVariables=environment.getBluetoothEnvironmentVariables();
  for (int i=0; i < bluetoothDevices.size(); i++) {
    for (int j=0; j < bluetoothVariables.size(); j++) {
      if (bluetoothVariables.get(j).getDeviceAddress().equals(bluetoothDevices.get(i).getAddress())) {
        Log.d(LOG_TAG,"String_Node_Str" + bluetoothDevices.get(i).getName() + "String_Node_Str");
        mSelectedBluetoothDevices.add(bluetoothDevices.get(i));
        mSelectedBluetoothItems.add(i);
      }
    }
  }
}
Program: 86999
Project: 86999
Buggy source:
public static Passphrase getMasterPassword(Context context){
  Passphrase masterPassphrase=getNewInstanceOfType(SharedPreferencesHelper.getMasterPasswordType(context));
  masterPassphrase.encryptedPasswordString=SharedPreferencesHelper.getMasterPasswordString(context);
  if (masterPassphrase.passphraseType.equals(TYPE_NONE)) {
    masterPassphrase.encryptedPasswordString="String_Node_Str";
  }
  masterPassphrase.decryptPassword();
  masterPassphrase.setPasswordRepresentation(masterPassphrase.getPassphraseRepresentationFromPassphraseString(masterPassphrase.passwordString));
  return masterPassphrase;
}

Fixed version (ground truth):
public static Passphrase getMasterPassword(Context context){
  String masterPasswordType=SharedPreferencesHelper.getMasterPasswordType(context), masterPasswordString=SharedPreferencesHelper.getMasterPasswordString(context);
  if (masterPasswordType == null || masterPasswordString == null) {
    masterPasswordType=TYPE_NONE;
    masterPasswordString="String_Node_Str";
  }
  Passphrase masterPassphrase=getNewInstanceOfType(masterPasswordType);
  masterPassphrase.encryptedPasswordString=masterPasswordString;
  if (masterPassphrase.passphraseType.equals(TYPE_NONE)) {
    masterPassphrase.encryptedPasswordString="String_Node_Str";
  }
  masterPassphrase.decryptPassword();
  masterPassphrase.setPasswordRepresentation(masterPassphrase.getPassphraseRepresentationFromPassphraseString(masterPassphrase.passwordString));
  return masterPassphrase;
}
Program: 87000
Project: 87000
Buggy source:
public Passphrase getPassphraseForEnvironment(Context context,Environment environment){
  if (id > 0) {
    if (environment.getId() <= 0) {
      environment=Environment.getBareboneEnvironment(context,environment.getName());
    }
    Cursor passwordCursor=context.getContentResolver().query(UsersEntry.buildUserUriWithIdEnvironmentAndPassword(id,environment.getId()),null,null,null,null);
    if (passwordCursor.moveToFirst()) {
      Passphrase returnPassphrase=Passphrase.getPassphraseFromCursor(passwordCursor);
      passwordCursor.close();
      return returnPassphrase;
    }
    Log.w(LOG_TAG,"String_Node_Str");
    return null;
  }
  Log.w(LOG_TAG,"String_Node_Str");
  return null;
}

Fixed version (ground truth):
public Passphrase getPassphraseForEnvironment(Context context,Environment environment){
  if (id > 0) {
    if (environment.getId() <= 0) {
      environment=Environment.getBareboneEnvironment(context,environment.getName());
    }
    Cursor passwordCursor=context.getContentResolver().query(UsersEntry.buildUserUriWithIdEnvironmentAndPassword(id,environment.getId()),null,null,null,null);
    if (passwordCursor != null && passwordCursor.moveToFirst()) {
      Passphrase returnPassphrase=Passphrase.getPassphraseFromCursor(passwordCursor);
      passwordCursor.close();
      return returnPassphrase;
    }
    Log.w(LOG_TAG,"String_Node_Str");
    return null;
  }
  Log.w(LOG_TAG,"String_Node_Str");
  return null;
}
Program: 87005
Project: 87005
Buggy source:
private long insertEnvironmentWifiNetwork(Uri uri,SQLiteDatabase db,ContentValues values){
  long environmentId=Long.parseLong(uri.getPathSegments().get(1));
  String wifiSelection=WiFiNetworksEntry.COLUMN_SSID + "String_Node_Str" + WiFiNetworksEntry.COLUMN_ENCRYPTION_TYPE+ "String_Node_Str";
  String[] wifiSelectionArgs=new String[]{values.getAsString(WiFiNetworksEntry.COLUMN_SSID),values.getAsString(WiFiNetworksEntry.COLUMN_ENCRYPTION_TYPE)};
  Cursor wifiCursor=db.query(WiFiNetworksEntry.TABLE_NAME,new String[]{WiFiNetworksEntry._ID},wifiSelection,wifiSelectionArgs,null,null,null);
  long wifiId;
  if (wifiCursor.getCount() == 0) {
    wifiId=db.insert(WiFiNetworksEntry.TABLE_NAME,null,values);
  }
 else {
    wifiCursor.moveToFirst();
    wifiId=wifiCursor.getLong(wifiCursor.getColumnIndex(WiFiNetworksEntry._ID));
  }
  if (wifiId == -1) {
    wifiCursor.close();
    return -1;
  }
  ContentValues environmentContentValues=new ContentValues();
  environmentContentValues.put(EnvironmentEntry.COLUMN_IS_WIFI_ENABLED,1);
  environmentContentValues.put(EnvironmentEntry.COLUMN_WIFI_ID,wifiId);
  wifiCursor.close();
  return db.update(EnvironmentEntry.TABLE_NAME,environmentContentValues,EnvironmentEntry._ID + "String_Node_Str",new String[]{String.valueOf(environmentId)});
}

Fixed version (ground truth):
private long[] insertEnvironmentWifiNetwork(Uri uri,SQLiteDatabase db,ContentValues values){
  long environmentId=Long.parseLong(uri.getPathSegments().get(1));
  String wifiSelection=WiFiNetworksEntry.COLUMN_SSID + "String_Node_Str" + WiFiNetworksEntry.COLUMN_ENCRYPTION_TYPE+ "String_Node_Str";
  String[] wifiSelectionArgs=new String[]{values.getAsString(WiFiNetworksEntry.COLUMN_SSID),values.getAsString(WiFiNetworksEntry.COLUMN_ENCRYPTION_TYPE)};
  Cursor wifiCursor=db.query(WiFiNetworksEntry.TABLE_NAME,new String[]{WiFiNetworksEntry._ID},wifiSelection,wifiSelectionArgs,null,null,null);
  long wifiId;
  if (wifiCursor.getCount() == 0) {
    wifiId=db.insert(WiFiNetworksEntry.TABLE_NAME,null,values);
  }
 else {
    wifiCursor.moveToFirst();
    wifiId=wifiCursor.getLong(wifiCursor.getColumnIndex(WiFiNetworksEntry._ID));
  }
  wifiCursor.close();
  if (wifiId == -1) {
    return new long[]{-1,-1};
  }
  long oldWifiId=changeEnvironmentVariableValue(EnvironmentEntry.COLUMN_IS_WIFI_ENABLED,1,EnvironmentEntry.COLUMN_WIFI_ID,wifiId,environmentId,db);
  return new long[]{oldWifiId,wifiId};
}
Program: 87006
Project: 87006
Buggy source:
private boolean checkForAllBluetoothDevices(List<BluetoothEnvironmentVariable> variables){
  for (  BluetoothEnvironmentVariable variable : variables) {
    if (!BluetoothReceiver.getCurrentlyConnectedBluetoothDevices().contains(variable)) {
      return false;
    }
  }
  return true;
}

Fixed version (ground truth):
private boolean checkForAllBluetoothDevices(List<BluetoothEnvironmentVariable> variables){
  if (Utility.checkForNullAndWarn(BluetoothReceiver.getCurrentlyConnectedBluetoothDevices(),LOG_TAG)) {
    return false;
  }
  for (  BluetoothEnvironmentVariable variable : variables) {
    if (Utility.checkForNullAndWarn(variable,LOG_TAG)) {
      continue;
    }
    if (!BluetoothReceiver.getCurrentlyConnectedBluetoothDevices().contains(variable)) {
      return false;
    }
  }
  return true;
}