Program: 40388
Project: 40388
Buggy source:
private void showEditNowDialog(StorjNode storjNode,int position){
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setTitle(getString(R.string.edit_node));
  View layout=getLayoutInflater().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());
  textView_nodeSimpleName.setText(storjNode.getSimpleName());
  builder.setView(layout);
  final AlertDialog alertDialog=builder.create();
  TintImageView deleteButton=(TintImageView)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=(StorjNode)mListView.getAdapter().getItem(position);
      alertDialog.cancel();
      deleteNode(selectedNode);
      AlarmReceiver alarm=new AlarmReceiver();
      alarm.pullStorjNodesStats(mContext);
    }
  }
);
  TintImageView saveButton=(TintImageView)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=(StorjNode)mListView.getAdapter().getItem(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,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,getString(R.string.add_error_missing_SimpleName),Toast.LENGTH_SHORT).show();
        error=true;
      }
      DatabaseManager databaseManager=DatabaseManager.getInstance(mContext);
      Cursor cursor=databaseManager.getNode(textView_nodeId.getText().toString());
      if (cursor.getCount() >= 1) {
        Toast.makeText(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);
        AlarmReceiver alarm=new AlarmReceiver();
        alarm.pullStorjNodesStats(mContext);
      }
      alertDialog.cancel();
    }
  }
);
  alertDialog.show();
}

Fixed version (ground truth):
private void showEditNowDialog(StorjNode storjNode,int position){
  AlertDialog.Builder builder=new AlertDialog.Builder(this);
  builder.setTitle(getString(R.string.edit_node));
  View layout=getLayoutInflater().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());
  textView_nodeSimpleName.setText(storjNode.getSimpleName());
  builder.setView(layout);
  final AlertDialog alertDialog=builder.create();
  TintImageView deleteButton=(TintImageView)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=(StorjNode)mListView.getAdapter().getItem(position);
      alertDialog.cancel();
      deleteNode(selectedNode);
      AlarmReceiver alarm=new AlarmReceiver();
      alarm.pullStorjNodesStats(mContext);
    }
  }
);
  TintImageView saveButton=(TintImageView)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=(StorjNode)mListView.getAdapter().getItem(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,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,getString(R.string.add_error_missing_SimpleName),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()))) {
        Toast.makeText(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);
        AlarmReceiver alarm=new AlarmReceiver();
        alarm.pullStorjNodesStats(mContext);
      }
      alertDialog.cancel();
    }
  }
);
  alertDialog.show();
}