Program: 40372
Project: 40372
Buggy source:
private void showEditNowDialog(StorjNode storjNode,int position){
  AlertDialog.Builder builder=new AlertDialog.Builder(mContext);
  builder.setTitle(mContext.getString(R.string.edit_node));
  LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View layout=inflater.inflate(R.layout.activity_main_edit_node_popup,null);
  AppCompatEditText textView_nodeSimpleName=(AppCompatEditText)layout.findViewById(R.id.textView_edit_simpleName);
  AppCompatEditText textView_nodeId=(AppCompatEditText)layout.findViewById(R.id.textView_edit_nodeID);
  textView_nodeId.setText(storjNode.getNodeID().getValue());
  textView_nodeSimpleName.setText(storjNode.getSimpleName().getValue());
  builder.setView(layout);
  final AlertDialog alertDialog=builder.create();
  ImageView deleteButton=(ImageView)layout.findViewById(R.id.button_edit_delete_node);
  deleteButton.setTag(position);
  deleteButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      int position=(Integer)v.getTag();
      StorjNode selectedNode=mItems.get(position);
      alertDialog.cancel();
      deleteNode(selectedNode);
      pullSotrjNodeStats(mContext);
    }
  }
);
  ImageView saveButton=(ImageView)layout.findViewById(R.id.button_edit_save_node);
  saveButton.setTag(position);
  saveButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      int position=(Integer)v.getTag();
      boolean error=false;
      StorjNode selectedNode=mItems.get(position);
      TextView textView_nodeId=(TextView)v.getRootView().findViewById(R.id.textView_edit_nodeID);
      TextView textView_simpleName=(TextView)v.getRootView().findViewById(R.id.textView_edit_simpleName);
      if (textView_nodeId.getText().toString().matches("String_Node_Str")) {
        Toast.makeText(mContext,mContext.getString(R.string.add_error_missing_nodeID),Toast.LENGTH_SHORT).show();
        error=true;
      }
 else       if (textView_simpleName.getText().toString().matches("String_Node_Str")) {
        Toast.makeText(mContext,mContext.getString(R.string.add_error_missing_SimpleName),Toast.LENGTH_SHORT).show();
        error=true;
      }
 else       if (textView_nodeId.getText().length() != 40) {
        Toast.makeText(mContext,mContext.getString(R.string.add_error_wrong_character_count),Toast.LENGTH_SHORT).show();
        error=true;
      }
      DatabaseManager databaseManager=DatabaseManager.getInstance(mContext);
      Cursor cursor=databaseManager.getNode(textView_nodeId.getText().toString());
      if (cursor.getCount() >= 1 && !(textView_nodeId.getText().toString().equals(selectedNode.getNodeID().getValue()))) {
        Toast.makeText(mContext,mContext.getString(R.string.add_error_node_exists),Toast.LENGTH_SHORT).show();
        error=true;
      }
      if (!error) {
        StorjNode updatedNode=new StorjNode(textView_nodeId.getText().toString());
        updatedNode.setSimpleName(textView_simpleName.getText().toString());
        updateNode(selectedNode,updatedNode);
        pullSotrjNodeStats(mContext);
      }
      alertDialog.cancel();
    }
  }
);
  alertDialog.show();
}

Fixed version (ground truth):
private void showEditNowDialog(StorjNode storjNode,int position){
  AlertDialog.Builder builder=new AlertDialog.Builder(mContext);
  builder.setTitle(mContext.getString(R.string.edit_node));
  LayoutInflater inflater=(LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  View layout=inflater.inflate(R.layout.activity_main_edit_node_popup,null);
  AppCompatEditText textView_nodeSimpleName=(AppCompatEditText)layout.findViewById(R.id.textView_edit_simpleName);
  AppCompatEditText textView_nodeId=(AppCompatEditText)layout.findViewById(R.id.textView_edit_nodeID);
  textView_nodeId.setText(storjNode.getNodeID().getValue());
  textView_nodeSimpleName.setText(storjNode.getSimpleName().getValue());
  builder.setView(layout);
  final AlertDialog alertDialog=builder.create();
  ImageView deleteButton=(ImageView)layout.findViewById(R.id.button_edit_delete_node);
  deleteButton.setTag(position);
  deleteButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      int position=(Integer)v.getTag();
      StorjNode selectedNode=mItems.get(position);
      alertDialog.cancel();
      deleteNode(selectedNode);
      if (!AlarmReceiver.mRunning) {
        pullSotrjNodeStats(mContext);
      }
 else {
        AlarmReceiver.mRetrigger=true;
      }
    }
  }
);
  ImageView saveButton=(ImageView)layout.findViewById(R.id.button_edit_save_node);
  saveButton.setTag(position);
  saveButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      int position=(Integer)v.getTag();
      boolean error=false;
      StorjNode selectedNode=mItems.get(position);
      TextView textView_nodeId=(TextView)v.getRootView().findViewById(R.id.textView_edit_nodeID);
      TextView textView_simpleName=(TextView)v.getRootView().findViewById(R.id.textView_edit_simpleName);
      if (textView_nodeId.getText().toString().matches("String_Node_Str")) {
        Toast.makeText(mContext,mContext.getString(R.string.add_error_missing_nodeID),Toast.LENGTH_SHORT).show();
        error=true;
      }
 else       if (textView_simpleName.getText().toString().matches("String_Node_Str")) {
        Toast.makeText(mContext,mContext.getString(R.string.add_error_missing_SimpleName),Toast.LENGTH_SHORT).show();
        error=true;
      }
 else       if (textView_nodeId.getText().length() != 40) {
        Toast.makeText(mContext,mContext.getString(R.string.add_error_wrong_character_count),Toast.LENGTH_SHORT).show();
        error=true;
      }
      DatabaseManager databaseManager=DatabaseManager.getInstance(mContext);
      Cursor cursor=databaseManager.getNode(textView_nodeId.getText().toString());
      if (cursor.getCount() >= 1 && !(textView_nodeId.getText().toString().equals(selectedNode.getNodeID().getValue()))) {
        Toast.makeText(mContext,mContext.getString(R.string.add_error_node_exists),Toast.LENGTH_SHORT).show();
        error=true;
      }
      if (!error) {
        StorjNode updatedNode=new StorjNode(textView_nodeId.getText().toString());
        updatedNode.setSimpleName(textView_simpleName.getText().toString());
        updateNode(selectedNode,updatedNode);
        if (!AlarmReceiver.mRunning) {
          pullSotrjNodeStats(mContext);
        }
 else {
          AlarmReceiver.mRetrigger=true;
        }
      }
      alertDialog.cancel();
    }
  }
);
  alertDialog.show();
}