Program: 54971
Project: 54971
Buggy source:
/** 
 * Will create a IQ Source instance according to the user settings.
 * @return true on success; false on error
 */
public boolean createSource(){
  long frequency;
  int sampleRate;
  int sourceType=Integer.valueOf(preferences.getString(getString(R.string.pref_sourceType),"String_Node_Str"));
switch (sourceType) {
case FILE_SOURCE:
    try {
      frequency=Integer.valueOf(preferences.getString(getString(R.string.pref_filesource_frequency),"String_Node_Str"));
      sampleRate=Integer.valueOf(preferences.getString(getString(R.string.pref_filesource_sampleRate),"String_Node_Str"));
    }
 catch (    NumberFormatException e) {
      this.runOnUiThread(new Runnable(){
        @Override public void run(){
          Toast.makeText(MainActivity.this,"String_Node_Str",Toast.LENGTH_LONG).show();
        }
      }
);
      return false;
    }
  String filename=preferences.getString(getString(R.string.pref_filesource_file),"String_Node_Str");
int fileFormat=Integer.valueOf(preferences.getString(getString(R.string.pref_filesource_format),"String_Node_Str"));
boolean repeat=preferences.getBoolean(getString(R.string.pref_filesource_repeat),false);
source=new FileIQSource(filename,sampleRate,frequency,16384,repeat,fileFormat);
break;
case HACKRF_SOURCE:
source=new HackrfSource();
source.setFrequency(preferences.getLong(getString(R.string.pref_frequency),97000000));
source.setSampleRate(preferences.getInt(getString(R.string.pref_sampleRate),HackrfSource.MAX_SAMPLERATE));
((HackrfSource)source).setVgaRxGain(preferences.getInt(getString(R.string.pref_hackrf_vgaRxGain),HackrfSource.MAX_VGA_RX_GAIN / 2));
((HackrfSource)source).setLnaGain(preferences.getInt(getString(R.string.pref_hackrf_lnaGain),HackrfSource.MAX_LNA_GAIN / 2));
((HackrfSource)source).setAmplifier(preferences.getBoolean(getString(R.string.pref_hackrf_amplifier),false));
((HackrfSource)source).setAntennaPower(preferences.getBoolean(getString(R.string.pref_hackrf_antennaPower),false));
((HackrfSource)source).setUpconverterFrequencyShift(Integer.valueOf(preferences.getString(getString(R.string.pref_hackrf_upconverterFrequencyShift),"String_Node_Str")));
break;
case RTLSDR_SOURCE:
if (preferences.getBoolean(getString(R.string.pref_rtlsdr_externalServer),false)) source=new RtlsdrSource(preferences.getString(getString(R.string.pref_rtlsdr_ip),"String_Node_Str"),Integer.valueOf(preferences.getString(getString(R.string.pref_rtlsdr_port),"String_Node_Str")));
 else {
source=new RtlsdrSource("String_Node_Str",1234);
}
frequency=preferences.getLong(getString(R.string.pref_frequency),97000000);
sampleRate=preferences.getInt(getString(R.string.pref_sampleRate),source.getMaxSampleRate());
if (sampleRate > 2000000) sampleRate=2000000;
source.setFrequency(frequency);
source.setSampleRate(sampleRate);
((RtlsdrSource)source).setFrequencyCorrection(Integer.valueOf(preferences.getString(getString(R.string.pref_rtlsdr_frequencyCorrection),"String_Node_Str")));
((RtlsdrSource)source).setUpconverterFrequencyShift(Integer.valueOf(preferences.getString(getString(R.string.pref_rtlsdr_upconverterFrequencyShift),"String_Node_Str")));
((RtlsdrSource)source).setManualGain(preferences.getBoolean(getString(R.string.pref_rtlsdr_manual_gain),false));
((RtlsdrSource)source).setAutomaticGainControl(preferences.getBoolean(getString(R.string.pref_rtlsdr_agc),false));
if (((RtlsdrSource)source).isManualGain()) {
((RtlsdrSource)source).setGain(preferences.getInt(getString(R.string.pref_rtlsdr_gain),0));
((RtlsdrSource)source).setIFGain(preferences.getInt(getString(R.string.pref_rtlsdr_ifGain),0));
}
break;
default :
Log.e(LOGTAG,"String_Node_Str" + sourceType);
return false;
}
analyzerSurface.setSource(source);
return true;
}

Fixed version (ground truth):
/** 
 * Will create a IQ Source instance according to the user settings.
 * @return true on success; false on error
 */
public boolean createSource(){
  long frequency;
  int sampleRate;
  int sourceType=Integer.valueOf(preferences.getString(getString(R.string.pref_sourceType),"String_Node_Str"));
switch (sourceType) {
case FILE_SOURCE:
    try {
      frequency=Integer.valueOf(preferences.getString(getString(R.string.pref_filesource_frequency),"String_Node_Str"));
      sampleRate=Integer.valueOf(preferences.getString(getString(R.string.pref_filesource_sampleRate),"String_Node_Str"));
    }
 catch (    NumberFormatException e) {
      this.runOnUiThread(new Runnable(){
        @Override public void run(){
          Toast.makeText(MainActivity.this,"String_Node_Str",Toast.LENGTH_LONG).show();
        }
      }
);
      return false;
    }
  String filename=preferences.getString(getString(R.string.pref_filesource_file),"String_Node_Str");
int fileFormat=Integer.valueOf(preferences.getString(getString(R.string.pref_filesource_format),"String_Node_Str"));
boolean repeat=preferences.getBoolean(getString(R.string.pref_filesource_repeat),false);
source=new FileIQSource(filename,sampleRate,frequency,16384,repeat,fileFormat);
break;
case HACKRF_SOURCE:
source=new HackrfSource();
source.setFrequency(preferences.getLong(getString(R.string.pref_frequency),97000000));
source.setSampleRate(preferences.getInt(getString(R.string.pref_sampleRate),HackrfSource.MAX_SAMPLERATE));
((HackrfSource)source).setVgaRxGain(preferences.getInt(getString(R.string.pref_hackrf_vgaRxGain),HackrfSource.MAX_VGA_RX_GAIN / 2));
((HackrfSource)source).setLnaGain(preferences.getInt(getString(R.string.pref_hackrf_lnaGain),HackrfSource.MAX_LNA_GAIN / 2));
((HackrfSource)source).setAmplifier(preferences.getBoolean(getString(R.string.pref_hackrf_amplifier),false));
((HackrfSource)source).setAntennaPower(preferences.getBoolean(getString(R.string.pref_hackrf_antennaPower),false));
((HackrfSource)source).setFrequencyShift(Integer.valueOf(preferences.getString(getString(R.string.pref_hackrf_frequencyShift),"String_Node_Str")));
break;
case RTLSDR_SOURCE:
if (preferences.getBoolean(getString(R.string.pref_rtlsdr_externalServer),false)) source=new RtlsdrSource(preferences.getString(getString(R.string.pref_rtlsdr_ip),"String_Node_Str"),Integer.valueOf(preferences.getString(getString(R.string.pref_rtlsdr_port),"String_Node_Str")));
 else {
source=new RtlsdrSource("String_Node_Str",1234);
}
frequency=preferences.getLong(getString(R.string.pref_frequency),97000000);
sampleRate=preferences.getInt(getString(R.string.pref_sampleRate),source.getMaxSampleRate());
if (sampleRate > 2000000) sampleRate=2000000;
source.setFrequency(frequency);
source.setSampleRate(sampleRate);
((RtlsdrSource)source).setFrequencyCorrection(Integer.valueOf(preferences.getString(getString(R.string.pref_rtlsdr_frequencyCorrection),"String_Node_Str")));
((RtlsdrSource)source).setFrequencyShift(Integer.valueOf(preferences.getString(getString(R.string.pref_rtlsdr_frequencyShift),"String_Node_Str")));
((RtlsdrSource)source).setManualGain(preferences.getBoolean(getString(R.string.pref_rtlsdr_manual_gain),false));
((RtlsdrSource)source).setAutomaticGainControl(preferences.getBoolean(getString(R.string.pref_rtlsdr_agc),false));
if (((RtlsdrSource)source).isManualGain()) {
((RtlsdrSource)source).setGain(preferences.getInt(getString(R.string.pref_rtlsdr_gain),0));
((RtlsdrSource)source).setIFGain(preferences.getInt(getString(R.string.pref_rtlsdr_ifGain),0));
}
break;
default :
Log.e(LOGTAG,"String_Node_Str" + sourceType);
return false;
}
analyzerSurface.setSource(source);
return true;
}