Program: 54954
Project: 54954
Buggy source:
/** 
 * Will check if any preference conflicts with the current state of the app and fix it
 */
public void checkForChangedPreferences(){
  int sourceType=Integer.valueOf(preferences.getString(getString(R.string.pref_sourceType),"String_Node_Str"));
  if (source != null) {
switch (sourceType) {
case FILE_SOURCE:
      if (!(source instanceof FileIQSource)) {
        source.close();
        createSource();
      }
 else {
        long freq=Integer.valueOf(preferences.getString(getString(R.string.pref_filesource_frequency),"String_Node_Str"));
        int sampRate=Integer.valueOf(preferences.getString(getString(R.string.pref_filesource_sampleRate),"String_Node_Str"));
        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);
        if (freq != source.getFrequency() || sampRate != source.getSampleRate() || !fileName.equals(((FileIQSource)source).getFilename()) || repeat != ((FileIQSource)source).isRepeat() || fileFormat != ((FileIQSource)source).getFileFormat()) {
          source.close();
          createSource();
        }
      }
    break;
case HACKRF_SOURCE:
  if (!(source instanceof HackrfSource)) {
    source.close();
    createSource();
  }
 else {
    boolean amp=preferences.getBoolean(getString(R.string.pref_hackrf_amplifier),false);
    boolean antennaPower=preferences.getBoolean(getString(R.string.pref_hackrf_antennaPower),false);
    int frequencyShift=Integer.valueOf(preferences.getString(getString(R.string.pref_hackrf_frequencyShift),"String_Node_Str"));
    if (((HackrfSource)source).isAmplifierOn() != amp)     ((HackrfSource)source).setAmplifier(amp);
    if (((HackrfSource)source).isAntennaPowerOn() != antennaPower)     ((HackrfSource)source).setAntennaPower(antennaPower);
    if (((HackrfSource)source).getFrequencyShift() != frequencyShift)     ((HackrfSource)source).setFrequencyShift(frequencyShift);
  }
break;
case RTLSDR_SOURCE:
if (!(source instanceof RtlsdrSource)) {
source.close();
createSource();
}
 else {
String ip=preferences.getString(getString(R.string.pref_rtlsdr_ip),"String_Node_Str");
int port=Integer.valueOf(preferences.getString(getString(R.string.pref_rtlsdr_port),"String_Node_Str"));
boolean externalServer=preferences.getBoolean(getString(R.string.pref_rtlsdr_externalServer),false);
if (externalServer) {
  if (!ip.equals(((RtlsdrSource)source).getIpAddress()) || port != ((RtlsdrSource)source).getPort()) {
    source.close();
    createSource();
    return;
  }
}
 else {
  if (!((RtlsdrSource)source).getIpAddress().equals("String_Node_Str") || 1234 != ((RtlsdrSource)source).getPort()) {
    source.close();
    createSource();
    return;
  }
}
int frequencyCorrection=Integer.valueOf(preferences.getString(getString(R.string.pref_rtlsdr_frequencyCorrection),"String_Node_Str"));
int frequencyShift=Integer.valueOf(preferences.getString(getString(R.string.pref_rtlsdr_frequencyShift),"String_Node_Str"));
if (frequencyCorrection != ((RtlsdrSource)source).getFrequencyCorrection()) ((RtlsdrSource)source).setFrequencyCorrection(frequencyCorrection);
if (((RtlsdrSource)source).getFrequencyShift() != frequencyShift) ((RtlsdrSource)source).setFrequencyShift(frequencyShift);
}
break;
default :
}
}
if (analyzerSurface != null) {
analyzerSurface.setVerticalScrollEnabled(preferences.getBoolean(getString(R.string.pref_scrollDB),true));
analyzerSurface.setVerticalZoomEnabled(preferences.getBoolean(getString(R.string.pref_zoomDB),true));
analyzerSurface.setDecoupledAxis(preferences.getBoolean(getString(R.string.pref_decoupledAxis),false));
analyzerSurface.setDisplayRelativeFrequencies(preferences.getBoolean(getString(R.string.pref_relativeFrequencies),false));
analyzerSurface.setWaterfallColorMapType(Integer.valueOf(preferences.getString(getString(R.string.pref_colorMapType),"String_Node_Str")));
analyzerSurface.setFftDrawingType(Integer.valueOf(preferences.getString(getString(R.string.pref_fftDrawingType),"String_Node_Str")));
analyzerSurface.setAverageLength(Integer.valueOf(preferences.getString(getString(R.string.pref_averaging),"String_Node_Str")));
analyzerSurface.setPeakHoldEnabled(preferences.getBoolean(getString(R.string.pref_peakHold),false));
analyzerSurface.setFftRatio(Float.valueOf(preferences.getString(getString(R.string.pref_spectrumWaterfallRatio),"String_Node_Str")));
analyzerSurface.setFontSize(Integer.valueOf(preferences.getString(getString(R.string.pref_fontSize),"String_Node_Str")));
analyzerSurface.setShowDebugInformation(preferences.getBoolean(getString(R.string.pref_showDebugInformation),false));
}
String screenOrientation=preferences.getString(getString(R.string.pref_screenOrientation),"String_Node_Str");
if (screenOrientation.equals("String_Node_Str")) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_FULL_SENSOR);
 else if (screenOrientation.equals("String_Node_Str")) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
 else if (screenOrientation.equals("String_Node_Str")) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
 else if (screenOrientation.equals("String_Node_Str")) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
 else if (screenOrientation.equals("String_Node_Str")) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
}

Fixed version (ground truth):
/** 
 * Will check if any preference conflicts with the current state of the app and fix it
 */
public void checkForChangedPreferences(){
  int sourceType=Integer.valueOf(preferences.getString(getString(R.string.pref_sourceType),"String_Node_Str"));
  if (source != null) {
switch (sourceType) {
case FILE_SOURCE:
      if (!(source instanceof FileIQSource)) {
        source.close();
        createSource();
      }
 else {
        long freq=Integer.valueOf(preferences.getString(getString(R.string.pref_filesource_frequency),"String_Node_Str"));
        int sampRate=Integer.valueOf(preferences.getString(getString(R.string.pref_filesource_sampleRate),"String_Node_Str"));
        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);
        if (freq != source.getFrequency() || sampRate != source.getSampleRate() || !fileName.equals(((FileIQSource)source).getFilename()) || repeat != ((FileIQSource)source).isRepeat() || fileFormat != ((FileIQSource)source).getFileFormat()) {
          source.close();
          createSource();
        }
      }
    break;
case HACKRF_SOURCE:
  if (!(source instanceof HackrfSource)) {
    source.close();
    createSource();
  }
 else {
    boolean amp=preferences.getBoolean(getString(R.string.pref_hackrf_amplifier),false);
    boolean antennaPower=preferences.getBoolean(getString(R.string.pref_hackrf_antennaPower),false);
    int frequencyShift=Integer.valueOf(preferences.getString(getString(R.string.pref_hackrf_frequencyShift),"String_Node_Str"));
    if (((HackrfSource)source).isAmplifierOn() != amp)     ((HackrfSource)source).setAmplifier(amp);
    if (((HackrfSource)source).isAntennaPowerOn() != antennaPower)     ((HackrfSource)source).setAntennaPower(antennaPower);
    if (((HackrfSource)source).getFrequencyShift() != frequencyShift)     ((HackrfSource)source).setFrequencyShift(frequencyShift);
  }
break;
case RTLSDR_SOURCE:
if (!(source instanceof RtlsdrSource)) {
source.close();
createSource();
}
 else {
String ip=preferences.getString(getString(R.string.pref_rtlsdr_ip),"String_Node_Str");
int port=Integer.valueOf(preferences.getString(getString(R.string.pref_rtlsdr_port),"String_Node_Str"));
boolean externalServer=preferences.getBoolean(getString(R.string.pref_rtlsdr_externalServer),false);
if (externalServer) {
  if (!ip.equals(((RtlsdrSource)source).getIpAddress()) || port != ((RtlsdrSource)source).getPort()) {
    source.close();
    createSource();
    return;
  }
}
 else {
  if (!((RtlsdrSource)source).getIpAddress().equals("String_Node_Str") || 1234 != ((RtlsdrSource)source).getPort()) {
    source.close();
    createSource();
    return;
  }
}
int frequencyCorrection=Integer.valueOf(preferences.getString(getString(R.string.pref_rtlsdr_frequencyCorrection),"String_Node_Str"));
int frequencyShift=Integer.valueOf(preferences.getString(getString(R.string.pref_rtlsdr_frequencyShift),"String_Node_Str"));
if (frequencyCorrection != ((RtlsdrSource)source).getFrequencyCorrection()) ((RtlsdrSource)source).setFrequencyCorrection(frequencyCorrection);
if (((RtlsdrSource)source).getFrequencyShift() != frequencyShift) ((RtlsdrSource)source).setFrequencyShift(frequencyShift);
}
break;
default :
}
}
if (analyzerSurface != null) {
analyzerSurface.setVerticalScrollEnabled(preferences.getBoolean(getString(R.string.pref_scrollDB),true));
analyzerSurface.setVerticalZoomEnabled(preferences.getBoolean(getString(R.string.pref_zoomDB),true));
analyzerSurface.setDecoupledAxis(preferences.getBoolean(getString(R.string.pref_decoupledAxis),false));
analyzerSurface.setDisplayRelativeFrequencies(preferences.getBoolean(getString(R.string.pref_relativeFrequencies),false));
analyzerSurface.setWaterfallColorMapType(Integer.valueOf(preferences.getString(getString(R.string.pref_colorMapType),"String_Node_Str")));
analyzerSurface.setFftDrawingType(Integer.valueOf(preferences.getString(getString(R.string.pref_fftDrawingType),"String_Node_Str")));
analyzerSurface.setAverageLength(Integer.valueOf(preferences.getString(getString(R.string.pref_averaging),"String_Node_Str")));
analyzerSurface.setPeakHoldEnabled(preferences.getBoolean(getString(R.string.pref_peakHold),false));
analyzerSurface.setFftRatio(Float.valueOf(preferences.getString(getString(R.string.pref_spectrumWaterfallRatio),"String_Node_Str")));
analyzerSurface.setFontSize(Integer.valueOf(preferences.getString(getString(R.string.pref_fontSize),"String_Node_Str")));
analyzerSurface.setShowDebugInformation(preferences.getBoolean(getString(R.string.pref_showDebugInformation),false));
}
String screenOrientation=preferences.getString(getString(R.string.pref_screenOrientation),"String_Node_Str");
if (screenOrientation.equals("String_Node_Str")) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED);
 else if (screenOrientation.equals("String_Node_Str")) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
 else if (screenOrientation.equals("String_Node_Str")) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
 else if (screenOrientation.equals("String_Node_Str")) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
 else if (screenOrientation.equals("String_Node_Str")) setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
}