Buggy code:
public class StatsActivity extends ListActivity implements AdapterView . OnItemSelectedListener { private static final String TAG = "StatsActivity" ; private static final String LOGFILE = "BetterBatteryStats_Dump.log" ; ProgressDialog m_progressDialog ; private StatsAdapter m_listViewAdapter ; private int m_iStatType = 0 ; private int m_iStat = 0 ; private int m_iSorting = 0 ; @ Override protected void onCreate ( Bundle savedInstanceState ) { } @ Override protected void onResume ( ) { } @ Override protected void onPause ( ) { } @ Override public boolean onKeyDown ( int keyCode , KeyEvent event ) { } @ Override public void onSaveInstanceState ( Bundle savedInstanceState ) { } private void setListViewAdapter ( ) { } public boolean onCreateOptionsMenu ( Menu menu ) { } @ Override public boolean onPrepareOptionsMenu ( Menu menu ) { } public boolean onOptionsItemSelected ( MenuItem item ) { } public void onItemSelected ( AdapterView < ? > parent , View v , int position , long id ) { boolean bChanged = false ; if ( parent == ( ( Spinner ) ( findViewById ( spinnerStatType ) ) ) ) { int iNewStatType = statTypeFromPosition ( position ) ; if ( ( m_iStatType ) != iNewStatType ) { m_iStatType = iNewStatType ; bChanged = true ; } else { return ; } <START_BUG> if ( ( ( m_iStatType ) == ( StatsProvider . STATS_CUSTOM ) ) && ( StatsProvider . getInstance ( this ) . hasCustomRef ( ) ) ) { <END_BUG> Toast . makeText ( this , "Warning:<seq2seq4repair_space>there<seq2seq4repair_space>is<seq2seq4repair_space>no<seq2seq4repair_space>custom<seq2seq4repair_space>reference<seq2seq4repair_space>set." , LENGTH_SHORT ) . show ( ) ; } } else if ( parent == ( ( Spinner ) ( findViewById ( spinnerStat ) ) ) ) { int iNewStat = position ; if ( ( m_iStat ) != iNewStat ) { m_iStat = iNewStat ; bChanged = true ; } else { return ; } if ( ( m_iStat ) == 3 ) { ( ( Spinner ) ( findViewById ( spinnerStatType ) ) ) . setVisibility ( INVISIBLE ) ; ( ( Spinner ) ( findViewById ( spinnerStatType ) ) ) . setEnabled ( false ) ; m_iStatType = BatteryStatsTypes . STATS_SINCE_CHARGED ; } else { ( ( Spinner ) ( findViewById ( spinnerStatType ) ) ) . setVisibility ( VISIBLE ) ; ( ( Spinner ) ( findViewById ( spinnerStatType ) ) ) . setEnabled ( true ) ; } } else { Log . e ( StatsActivity . TAG , "ProcessStatsActivity.onItemSelected<seq2seq4repair_space>error.<seq2seq4repair_space>ID<seq2seq4repair_space>could<seq2seq4repair_space>not<seq2seq4repair_space>be<seq2seq4repair_space>resolved" ) ; Toast . makeText ( this , "Error:<seq2seq4repair_space>could<seq2seq4repair_space>not<seq2seq4repair_space>resolve<seq2seq4repair_space>what<seq2seq4repair_space>changed" , LENGTH_SHORT ) . show ( ) ; } TextView tvSince = ( ( TextView ) ( findViewById ( TextViewSince ) ) ) ; long timeSinceBoot = SystemClock . elapsedRealtime ( ) ; if ( ( m_iStat ) != 3 ) { tvSince . setText ( ( "Since<seq2seq4repair_space>" + ( DateUtils . formatDuration ( StatsProvider . getInstance ( this ) . getBatteryRealtime ( m_iStatType ) ) ) ) ) ; } else { tvSince . setText ( ( "Since<seq2seq4repair_space>boot<seq2seq4repair_space>" + ( DateUtils . formatDuration ( timeSinceBoot ) ) ) ) ; } if ( bChanged ) { new StatsActivity . LoadStatData ( ) . execute ( this ) ; } } public void onNothingSelected ( AdapterView < ? > parent ) { } private void doRefresh ( ) { } private class WriteDumpFile extends AsyncTask { @ Override protected Object doInBackground ( Object ... params ) { } @ Override protected void onPostExecute ( Object o ) { } } private class LoadStatData extends AsyncTask < Context , Integer , StatsAdapter > { @ Override protected StatsAdapter doInBackground ( Context ... params ) { } @ Override protected void onPostExecute ( StatsAdapter o ) { } @ Override protected void onPreExecute ( ) { } } private class SetCustomRef extends AsyncTask < Context , Integer , Boolean > { @ Override protected Boolean doInBackground ( Context ... params ) { } @ Override protected void onPostExecute ( Boolean b ) { } @ Override protected void onPreExecute ( ) { } } private int statTypeFromPosition ( int position ) { } private int positionFromStatType ( int iStatType ) { } }

Fix:
if ( ( ( m_iStatType ) == ( StatsProvider . STATS_CUSTOM ) ) && ( ! ( StatsProvider . getInstance ( this ) . hasCustomRef ( ) ) ) ) {