Buggy code:
public class EditProjectDialog extends DialogFragment implements LoaderManager . LoaderCallbacks < Cursor > , View . OnClickListener , View . OnFocusChangeListener { private static final String LOG_TAG = EditProjectDialog . class . getSimpleName ( ) ; long mProjRecId = 0 ; Uri mUri ; Uri mProjectsUri = Uri . withAppendedPath ( CONTENT_URI , "projects" ) ; ContentValues mValues = new ContentValues ( ) ; HashMap < Long , String > mExistingProjCodes = new HashMap < Long , String > ( ) ; private EditText mProjCode ; private EditText mDescription ; private EditText mContext ; private EditText mCaveats ; private EditText mContactPerson ; private EditText mStartDate ; private EditText mEndDate ; private EditText mActiveDateView ; SimpleDateFormat mDateFormat = new SimpleDateFormat ( "yyyy-MM-dd" , Locale . US ) ; private Calendar mCalendar = Calendar . getInstance ( ) ; private OnDateSetListener myDateListener = new DatePickerDialog . OnDateSetListener ( ) { @ Override public void onDateSet ( DatePicker view , int year , int monthOfYear , int dayOfMonth ) { } } ; static EditProjectDialog newInstance ( long mProjRecId ) { } @ Override public void onCreate ( Bundle savedInstanceState ) { } @ Override public View onCreateView ( LayoutInflater inflater , ViewGroup root , Bundle savedInstanceState ) { } @ Override public void onClick ( View v ) { } private void fireOffDatePicker ( ) { } @ Override public void onStart ( ) { } @ Override public void onFocusChange ( View v , boolean hasFocus ) { } @ Override public void onCancel ( DialogInterface dialog ) { } private int saveProjRecord ( ) { Context c = getActivity ( ) ; String projCodeString = mValues . getAsString ( "ProjCode" ) ; <START_BUG> if ( projCodeString == "" ) { <END_BUG> Toast . makeText ( this . getActivity ( ) , c . getResources ( ) . getString ( edit_proj_msg_no_proj ) , LENGTH_LONG ) . show ( ) ; return 0 ; } if ( mExistingProjCodes . containsValue ( projCodeString ) ) { Toast . makeText ( this . getActivity ( ) , ( ( ( ( c . getResources ( ) . getString ( edit_proj_msg_dup_proj ) ) + "<seq2seq4repair_space>\"" ) + projCodeString ) + "\"" ) , LENGTH_LONG ) . show ( ) ; Log . v ( EditProjectDialog . LOG_TAG , ( "in<seq2seq4repair_space>saveProjRecord,<seq2seq4repair_space>canceled<seq2seq4repair_space>because<seq2seq4repair_space>of<seq2seq4repair_space>duplicate<seq2seq4repair_space>ProjCode;<seq2seq4repair_space>mProjRecId<seq2seq4repair_space>=<seq2seq4repair_space>" + ( mProjRecId ) ) ) ; return 0 ; } ContentResolver rs = c . getContentResolver ( ) ; if ( ( mProjRecId ) == ( - 1 ) ) { Log . v ( EditProjectDialog . LOG_TAG , "entered<seq2seq4repair_space>saveProjRecord<seq2seq4repair_space>with<seq2seq4repair_space>(mProjRecId<seq2seq4repair_space>==<seq2seq4repair_space>-1);<seq2seq4repair_space>canceled" ) ; return 0 ; } if ( ( mProjRecId ) == 0 ) { mUri = rs . insert ( mProjectsUri , mValues ) ; Log . v ( EditProjectDialog . LOG_TAG , ( "new<seq2seq4repair_space>record<seq2seq4repair_space>in<seq2seq4repair_space>saveProjRecord;<seq2seq4repair_space>returned<seq2seq4repair_space>URI:<seq2seq4repair_space>" + ( mUri . toString ( ) ) ) ) ; long newRecId = Long . parseLong ( mUri . getLastPathSegment ( ) ) ; if ( newRecId < 1 ) { Log . v ( EditProjectDialog . LOG_TAG , ( ( "new<seq2seq4repair_space>record<seq2seq4repair_space>in<seq2seq4repair_space>saveProjRecord<seq2seq4repair_space>has<seq2seq4repair_space>Id<seq2seq4repair_space>==<seq2seq4repair_space>" + newRecId ) + ");<seq2seq4repair_space>canceled" ) ) ; return 0 ; } mProjRecId = newRecId ; getLoaderManager ( ) . restartLoader ( EXISTING_PROJCODES , null , this ) ; mUri = ContentUris . withAppendedId ( mProjectsUri , mProjRecId ) ; Log . v ( EditProjectDialog . LOG_TAG , ( "new<seq2seq4repair_space>record<seq2seq4repair_space>in<seq2seq4repair_space>saveProjRecord;<seq2seq4repair_space>URI<seq2seq4repair_space>re-parsed:<seq2seq4repair_space>" + ( mUri . toString ( ) ) ) ) ; SharedPreferences sharedPref = getActivity ( ) . getPreferences ( MODE_PRIVATE ) ; SharedPreferences . Editor prefEditor = sharedPref . edit ( ) ; prefEditor . putLong ( DEFAULT_PROJECT_ID , mProjRecId ) ; prefEditor . commit ( ) ; return 1 ; } else { mUri = ContentUris . withAppendedId ( mProjectsUri , mProjRecId ) ; int numUpdated = rs . update ( mUri , mValues , null , null ) ; Log . v ( EditProjectDialog . LOG_TAG , ( "Saved<seq2seq4repair_space>record<seq2seq4repair_space>in<seq2seq4repair_space>saveProjRecord;<seq2seq4repair_space>numUpdated:<seq2seq4repair_space>" + numUpdated ) ) ; return numUpdated ; } } @ Override public Loader < Cursor > onCreateLoader ( int id , Bundle args ) { } @ Override public void onLoadFinished ( Loader < Cursor > loader , Cursor c ) { } @ Override public void onLoaderReset ( Loader < Cursor > loader ) { } }

Fix:
if ( ( projCodeString . length ( ) ) == 0 ) {