Program: 54944
Project: 54944
Buggy source:
public EditBookmarkDialog(final Activity activity,final long bookmarkID){
  final LinearLayout ll_root=(LinearLayout)activity.getLayoutInflater().inflate(R.layout.edit_bookmark,null);
  final EditText et_name=(EditText)ll_root.findViewById(R.id.et_editBookmark_name);
  final Spinner sp_category=(Spinner)ll_root.findViewById(R.id.sp_editBookmark_category);
  final EditText et_frequency=(EditText)ll_root.findViewById(R.id.et_editBookmark_frequency);
  final EditText et_channelWidth=(EditText)ll_root.findViewById(R.id.et_editBookmark_channelWidth);
  final Spinner sp_mode=(Spinner)ll_root.findViewById(R.id.sp_editBookmark_mode);
  final EditText et_squelch=(EditText)ll_root.findViewById(R.id.et_editBookmark_squelch);
  final EditText et_comment=(EditText)ll_root.findViewById(R.id.et_editBookmark_comment);
  final ArrayAdapter<CharSequence> modeAdapter=ArrayAdapter.createFromResource(activity,R.array.demodulation_modes,android.R.layout.simple_spinner_item);
  modeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  sp_mode.setAdapter(modeAdapter);
  final SimpleCursorAdapter categoryAdapter=new SimpleCursorAdapter(activity,android.R.layout.simple_spinner_dropdown_item,categoriesCursor,new String[]{BookmarkCategories.COLUMN_NAME_CATEGORY_NAME},new int[]{android.R.id.text1},0);
  sp_category.setAdapter(categoryAdapter);
  if (bookmarkID >= 0) {
    Cursor cursor=activity.getContentResolver().query(ContentUris.withAppendedId(Bookmarks.CONTENT_URI,bookmarkID),null,null,new String[]{},null);
    cursor.moveToNext();
    et_name.setText(cursor.getString(cursor.getColumnIndex(Bookmarks.COLUMN_NAME_NAME)));
    et_frequency.setText("String_Node_Str" + cursor.getLong(cursor.getColumnIndex(Bookmarks.COLUMN_NAME_FREQUENCY)));
    et_channelWidth.setText("String_Node_Str" + cursor.getInt(cursor.getColumnIndex(Bookmarks.COLUMN_NAME_CHANNEL_WIDTH)));
    sp_mode.setSelection(cursor.getInt(cursor.getColumnIndex(Bookmarks.COLUMN_NAME_MODE)));
    et_squelch.setText("String_Node_Str" + cursor.getFloat(cursor.getColumnIndex(Bookmarks.COLUMN_NAME_SQUELCH)));
    et_comment.setText(cursor.getString(cursor.getColumnIndex(Bookmarks.COLUMN_NAME_COMMENT)));
    int categoryPosition=getPositionOfId(categoriesCursor,cursor.getLong(cursor.getColumnIndex(Bookmarks.COLUMN_NAME_CATEGORY_ID)),BookmarkCategories._ID);
    if (categoryPosition >= 0)     sp_category.setSelection(categoryPosition);
    cursor.close();
  }
 else {
    double frequency=rfControlInterface.requestCurrentChannelFrequency();
    int channelWidth=rfControlInterface.requestCurrentChannelWidth();
    int mode=rfControlInterface.requestCurrentDemodulationMode();
    float squelch=rfControlInterface.requestCurrentSquelch();
    if (frequency < 0)     frequency=100000000;
    if (channelWidth < 0)     channelWidth=0;
    if (squelch < 0)     squelch=-50;
    et_name.setText("String_Node_Str");
    et_frequency.setText("String_Node_Str" + frequency);
    et_channelWidth.setText("String_Node_Str" + channelWidth);
    sp_mode.setSelection(mode);
    et_squelch.setText("String_Node_Str" + squelch);
    et_comment.setText("String_Node_Str");
  }
  dialog=new AlertDialog.Builder(activity).setTitle(bookmarkID < 0 ? "String_Node_Str" : "String_Node_Str").setView(ll_root).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
    }
  }
).setPositiveButton(bookmarkID < 0 ? "String_Node_Str" : "String_Node_Str",new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      String name=et_name.getText().toString();
      long categoryId=sp_category.getSelectedItemId();
      if (et_frequency.getText().length() == 0) {
        Toast.makeText(activity,"String_Node_Str",Toast.LENGTH_LONG).show();
        return;
      }
      double frequency=Double.valueOf(et_frequency.getText().toString());
      if (frequency < rfControlInterface.requestMaxSourceFrequency() / 1000000)       frequency=frequency * 1000000;
      if (et_channelWidth.getText().length() == 0) {
        Toast.makeText(activity,"String_Node_Str",Toast.LENGTH_LONG).show();
        return;
      }
      int channelWidth=Integer.valueOf(et_channelWidth.getText().toString());
      int mode=sp_mode.getSelectedItemPosition();
      float squelch=Float.valueOf(et_squelch.getText().toString());
      String comment=et_comment.getText().toString();
      ContentValues values=new ContentValues();
      values.put(Bookmarks.COLUMN_NAME_NAME,name);
      values.put(Bookmarks.COLUMN_NAME_COMMENT,comment);
      values.put(Bookmarks.COLUMN_NAME_CATEGORY_ID,categoryId);
      values.put(Bookmarks.COLUMN_NAME_FREQUENCY,frequency);
      values.put(Bookmarks.COLUMN_NAME_CHANNEL_WIDTH,channelWidth);
      values.put(Bookmarks.COLUMN_NAME_MODE,mode);
      values.put(Bookmarks.COLUMN_NAME_SQUELCH,squelch);
      if (bookmarkID >= 0)       activity.getContentResolver().update(ContentUris.withAppendedId(Bookmarks.CONTENT_URI,bookmarkID),values,null,null);
 else       activity.getContentResolver().insert(Bookmarks.CONTENT_URI,values);
      if (bookmarksCursor != null)       bookmarksCursor.requery();
    }
  }
).create();
  dialog.show();
}

Fixed version (ground truth):
public EditBookmarkDialog(final Activity activity,final long bookmarkID){
  final LinearLayout ll_root=(LinearLayout)activity.getLayoutInflater().inflate(R.layout.edit_bookmark,null);
  final EditText et_name=(EditText)ll_root.findViewById(R.id.et_editBookmark_name);
  final Spinner sp_category=(Spinner)ll_root.findViewById(R.id.sp_editBookmark_category);
  final EditText et_frequency=(EditText)ll_root.findViewById(R.id.et_editBookmark_frequency);
  final EditText et_channelWidth=(EditText)ll_root.findViewById(R.id.et_editBookmark_channelWidth);
  final Spinner sp_mode=(Spinner)ll_root.findViewById(R.id.sp_editBookmark_mode);
  final EditText et_squelch=(EditText)ll_root.findViewById(R.id.et_editBookmark_squelch);
  final EditText et_comment=(EditText)ll_root.findViewById(R.id.et_editBookmark_comment);
  final ArrayAdapter<CharSequence> modeAdapter=ArrayAdapter.createFromResource(activity,R.array.demodulation_modes,android.R.layout.simple_spinner_item);
  modeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  sp_mode.setAdapter(modeAdapter);
  final SimpleCursorAdapter categoryAdapter=new SimpleCursorAdapter(activity,android.R.layout.simple_spinner_dropdown_item,categoriesCursor,new String[]{BookmarkCategories.COLUMN_NAME_CATEGORY_NAME},new int[]{android.R.id.text1},0);
  sp_category.setAdapter(categoryAdapter);
  if (bookmarkID >= 0) {
    Cursor cursor=activity.getContentResolver().query(ContentUris.withAppendedId(Bookmarks.CONTENT_URI,bookmarkID),null,null,new String[]{},null);
    cursor.moveToNext();
    et_name.setText(cursor.getString(cursor.getColumnIndex(Bookmarks.COLUMN_NAME_NAME)));
    et_frequency.setText("String_Node_Str" + cursor.getLong(cursor.getColumnIndex(Bookmarks.COLUMN_NAME_FREQUENCY)));
    et_channelWidth.setText("String_Node_Str" + cursor.getInt(cursor.getColumnIndex(Bookmarks.COLUMN_NAME_CHANNEL_WIDTH)));
    sp_mode.setSelection(cursor.getInt(cursor.getColumnIndex(Bookmarks.COLUMN_NAME_MODE)));
    et_squelch.setText("String_Node_Str" + cursor.getFloat(cursor.getColumnIndex(Bookmarks.COLUMN_NAME_SQUELCH)));
    et_comment.setText(cursor.getString(cursor.getColumnIndex(Bookmarks.COLUMN_NAME_COMMENT)));
    int categoryPosition=getPositionOfId(categoriesCursor,cursor.getLong(cursor.getColumnIndex(Bookmarks.COLUMN_NAME_CATEGORY_ID)),BookmarkCategories._ID);
    if (categoryPosition >= 0)     sp_category.setSelection(categoryPosition);
    cursor.close();
  }
 else {
    long frequency=rfControlInterface.requestCurrentChannelFrequency();
    int channelWidth=rfControlInterface.requestCurrentChannelWidth();
    int mode=rfControlInterface.requestCurrentDemodulationMode();
    float squelch=rfControlInterface.requestCurrentSquelch();
    if (frequency < 0)     frequency=100000000;
    if (channelWidth < 0)     channelWidth=0;
    if (squelch < -100 || squelch > 10)     squelch=-30;
    et_name.setText("String_Node_Str");
    et_frequency.setText("String_Node_Str" + frequency);
    et_channelWidth.setText("String_Node_Str" + channelWidth);
    sp_mode.setSelection(mode);
    et_squelch.setText("String_Node_Str" + squelch);
    et_comment.setText("String_Node_Str");
  }
  new AlertDialog.Builder(activity).setTitle(bookmarkID < 0 ? "String_Node_Str" : "String_Node_Str").setView(ll_root).setNegativeButton("String_Node_Str",new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
    }
  }
).setPositiveButton(bookmarkID < 0 ? "String_Node_Str" : "String_Node_Str",new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      String name=et_name.getText().toString();
      long categoryId=sp_category.getSelectedItemId();
      if (et_frequency.getText().length() == 0) {
        Toast.makeText(activity,"String_Node_Str",Toast.LENGTH_LONG).show();
        return;
      }
      double frequency=Double.valueOf(et_frequency.getText().toString());
      if (frequency < rfControlInterface.requestMaxSourceFrequency() / 1000000)       frequency=frequency * 1000000;
      if (et_channelWidth.getText().length() == 0) {
        Toast.makeText(activity,"String_Node_Str",Toast.LENGTH_LONG).show();
        return;
      }
      int channelWidth=Integer.valueOf(et_channelWidth.getText().toString());
      int mode=sp_mode.getSelectedItemPosition();
      float squelch=Float.valueOf(et_squelch.getText().toString());
      String comment=et_comment.getText().toString();
      ContentValues values=new ContentValues();
      values.put(Bookmarks.COLUMN_NAME_NAME,name);
      values.put(Bookmarks.COLUMN_NAME_COMMENT,comment);
      values.put(Bookmarks.COLUMN_NAME_CATEGORY_ID,categoryId);
      values.put(Bookmarks.COLUMN_NAME_FREQUENCY,frequency);
      values.put(Bookmarks.COLUMN_NAME_CHANNEL_WIDTH,channelWidth);
      values.put(Bookmarks.COLUMN_NAME_MODE,mode);
      values.put(Bookmarks.COLUMN_NAME_SQUELCH,squelch);
      if (bookmarkID >= 0)       activity.getContentResolver().update(ContentUris.withAppendedId(Bookmarks.CONTENT_URI,bookmarkID),values,null,null);
 else       activity.getContentResolver().insert(Bookmarks.CONTENT_URI,values);
      if (bookmarksCursor != null)       bookmarksCursor.requery();
    }
  }
).create().show();
}