Program: 181044
Project: 181044
Buggy source:
private void initDefaultSettings(){
  ContentResolver resolver=getContentResolver();
  int intVal=0;
  mUseDefaultPref=(CheckBoxPreference)findPreference(KEY_TTS_USE_DEFAULT);
  try {
    intVal=Settings.Secure.getInt(resolver,TTS_USE_DEFAULTS);
  }
 catch (  SettingNotFoundException e) {
    intVal=TextToSpeech.Engine.FALLBACK_TTS_USE_DEFAULTS;
    Settings.Secure.putInt(resolver,TTS_USE_DEFAULTS,intVal);
  }
  mUseDefaultPref.setChecked(intVal == 1);
  mUseDefaultPref.setOnPreferenceChangeListener(this);
  String engine=Settings.Secure.getString(resolver,TTS_DEFAULT_SYNTH);
  if (engine == null) {
    engine=FALLBACK_TTS_DEFAULT_SYNTH;
    Settings.Secure.putString(resolver,TTS_DEFAULT_SYNTH,engine);
  }
  mDefaultEng=engine;
  mDefaultRatePref=(ListPreference)findPreference(KEY_TTS_DEFAULT_RATE);
  try {
    intVal=Settings.Secure.getInt(resolver,TTS_DEFAULT_RATE);
  }
 catch (  SettingNotFoundException e) {
    intVal=TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_RATE;
    Settings.Secure.putInt(resolver,TTS_DEFAULT_RATE,intVal);
  }
  mDefaultRatePref.setValue(String.valueOf(intVal));
  mDefaultRatePref.setOnPreferenceChangeListener(this);
  String language=null;
  String country=null;
  String variant=null;
  mDefaultLocPref=(ListPreference)findPreference(KEY_TTS_DEFAULT_LANG);
  language=Settings.Secure.getString(resolver,TTS_DEFAULT_LANG);
  if (language != null) {
    mDefaultLanguage=language;
  }
 else {
    language=TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_LANG;
    country=TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_COUNTRY;
    variant=TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_VARIANT;
    Settings.Secure.putString(resolver,TTS_DEFAULT_LANG,language);
    Settings.Secure.putString(resolver,TTS_DEFAULT_COUNTRY,country);
    Settings.Secure.putString(resolver,TTS_DEFAULT_VARIANT,variant);
  }
  if (country == null) {
    country=Settings.Secure.getString(resolver,KEY_TTS_DEFAULT_COUNTRY);
    if (country.compareTo("String_Node_Str") != 0) {
      mDefaultCountry=country;
    }
 else {
      country=TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_COUNTRY;
      variant=TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_VARIANT;
      Settings.Secure.putString(resolver,TTS_DEFAULT_COUNTRY,country);
      Settings.Secure.putString(resolver,TTS_DEFAULT_VARIANT,variant);
    }
  }
  if (variant == null) {
    variant=Settings.Secure.getString(resolver,KEY_TTS_DEFAULT_VARIANT);
    if (variant.compareTo("String_Node_Str") != 0) {
      mDefaultLocVariant=variant;
    }
 else {
      variant=TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_VARIANT;
      Settings.Secure.putString(resolver,TTS_DEFAULT_VARIANT,variant);
    }
  }
  String localeString=new String(language);
  if (country.compareTo("String_Node_Str") != 0) {
    localeString+=LOCALE_DELIMITER + country;
  }
 else {
    localeString+=LOCALE_DELIMITER + "String_Node_Str";
  }
  if (variant.compareTo("String_Node_Str") != 0) {
    localeString+=LOCALE_DELIMITER + variant;
  }
  Log.v(TAG,"String_Node_Str" + localeString);
  mDefaultLocPref.setValue(localeString);
  mDefaultLocPref.setOnPreferenceChangeListener(this);
}

Fixed version (ground truth):
private void initDefaultSettings(){
  ContentResolver resolver=getContentResolver();
  int intVal=0;
  mUseDefaultPref=(CheckBoxPreference)findPreference(KEY_TTS_USE_DEFAULT);
  try {
    intVal=Settings.Secure.getInt(resolver,TTS_USE_DEFAULTS);
  }
 catch (  SettingNotFoundException e) {
    intVal=TextToSpeech.Engine.FALLBACK_TTS_USE_DEFAULTS;
    Settings.Secure.putInt(resolver,TTS_USE_DEFAULTS,intVal);
  }
  mUseDefaultPref.setChecked(intVal == 1);
  mUseDefaultPref.setOnPreferenceChangeListener(this);
  String engine=Settings.Secure.getString(resolver,TTS_DEFAULT_SYNTH);
  if (engine == null) {
    engine=FALLBACK_TTS_DEFAULT_SYNTH;
    Settings.Secure.putString(resolver,TTS_DEFAULT_SYNTH,engine);
  }
  mDefaultEng=engine;
  mDefaultRatePref=(ListPreference)findPreference(KEY_TTS_DEFAULT_RATE);
  try {
    intVal=Settings.Secure.getInt(resolver,TTS_DEFAULT_RATE);
  }
 catch (  SettingNotFoundException e) {
    intVal=TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_RATE;
    Settings.Secure.putInt(resolver,TTS_DEFAULT_RATE,intVal);
  }
  mDefaultRatePref.setValue(String.valueOf(intVal));
  mDefaultRatePref.setOnPreferenceChangeListener(this);
  String language=null;
  String country=null;
  String variant=null;
  mDefaultLocPref=(ListPreference)findPreference(KEY_TTS_DEFAULT_LANG);
  language=Settings.Secure.getString(resolver,TTS_DEFAULT_LANG);
  if (language != null) {
    mDefaultLanguage=language;
  }
 else {
    language=TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_LANG;
    country=TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_COUNTRY;
    variant=TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_VARIANT;
    Settings.Secure.putString(resolver,TTS_DEFAULT_LANG,language);
    Settings.Secure.putString(resolver,TTS_DEFAULT_COUNTRY,country);
    Settings.Secure.putString(resolver,TTS_DEFAULT_VARIANT,variant);
  }
  if (country == null) {
    country=Settings.Secure.getString(resolver,KEY_TTS_DEFAULT_COUNTRY);
    if (country != null) {
      mDefaultCountry=country;
    }
 else {
      country=TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_COUNTRY;
      variant=TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_VARIANT;
      Settings.Secure.putString(resolver,TTS_DEFAULT_COUNTRY,country);
      Settings.Secure.putString(resolver,TTS_DEFAULT_VARIANT,variant);
    }
  }
  if (variant == null) {
    variant=Settings.Secure.getString(resolver,KEY_TTS_DEFAULT_VARIANT);
    if (variant != null) {
      mDefaultLocVariant=variant;
    }
 else {
      variant=TextToSpeech.Engine.FALLBACK_TTS_DEFAULT_VARIANT;
      Settings.Secure.putString(resolver,TTS_DEFAULT_VARIANT,variant);
    }
  }
  String localeString=new String(language);
  if (country.compareTo("String_Node_Str") != 0) {
    localeString+=LOCALE_DELIMITER + country;
  }
 else {
    localeString+=LOCALE_DELIMITER + "String_Node_Str";
  }
  if (variant.compareTo("String_Node_Str") != 0) {
    localeString+=LOCALE_DELIMITER + variant;
  }
  Log.v(TAG,"String_Node_Str" + localeString);
  mDefaultLocPref.setValue(localeString);
  mDefaultLocPref.setOnPreferenceChangeListener(this);
}