Program: 43948
Project: 43948
Buggy source:
/** 
 * ADW: Apply and store the theme stuff
 * @param v
 */
public void applyTheme(View v){
  PreviewPreference themePreview=(PreviewPreference)findPreference("String_Node_Str");
  String packageName=themePreview.getValue().toString();
  SharedPreferences sp=getPreferenceManager().getSharedPreferences();
  SharedPreferences.Editor editor=sp.edit();
  editor.putString("String_Node_Str",packageName);
  if (!packageName.equals(LockscreenSettings.THEME_DEFAULT)) {
    Resources themeResources=null;
    try {
      themeResources=getPackageManager().getResourcesForApplication(packageName.toString());
    }
 catch (    NameNotFoundException e) {
    }
    if (themeResources != null) {
      int tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int network_text_color=themeResources.getColor(tmpId);
        editor.putInt("String_Node_Str",network_text_color);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int network_text_shadow_color=themeResources.getColor(tmpId);
        editor.putInt("String_Node_Str",network_text_shadow_color);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int clock_text_color=themeResources.getColor(tmpId);
        editor.putInt("String_Node_Str",clock_text_color);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int clock_text_shadow_color=themeResources.getColor(tmpId);
        editor.putInt("String_Node_Str",clock_text_shadow_color);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int music_text_color=themeResources.getColor(tmpId);
        editor.putInt("String_Node_Str",music_text_color);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int music_text_shadow_color=themeResources.getColor(tmpId);
        editor.putInt("String_Node_Str",music_text_shadow_color);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int notification_text_color=themeResources.getColor(tmpId);
        editor.putInt("String_Node_Str",notification_text_color);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int notification_text_shadow_color=themeResources.getColor(tmpId);
        editor.putInt("String_Node_Str",notification_text_shadow_color);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int music_control_pad=themeResources.getDimensionPixelSize(tmpId);
        editor.putInt("String_Node_Str",music_control_pad);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int text_notif_pad=themeResources.getDimensionPixelSize(tmpId);
        editor.putInt("String_Node_Str",text_notif_pad);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        boolean background_slide=themeResources.getBoolean(tmpId);
        editor.putBoolean("String_Node_Str",background_slide);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        boolean allow_art_slide=themeResources.getBoolean(tmpId);
        editor.putBoolean("String_Node_Str",allow_art_slide);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        boolean show_icons=themeResources.getBoolean(tmpId);
        editor.putBoolean("String_Node_Str",show_icons);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        boolean simple_text_notif=themeResources.getBoolean(tmpId);
        editor.putBoolean("String_Node_Str",simple_text_notif);
      }
    }
  }
 else {
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
  }
  editor.commit();
  startActivity(new Intent(getBaseContext(),LockscreenSettings.class));
  finish();
}

Fixed version (ground truth):
/** 
 * ADW: Apply and store the theme stuff
 * @param v
 */
public void applyTheme(View v){
  PreviewPreference themePreview=(PreviewPreference)findPreference("String_Node_Str");
  String packageName=themePreview.getValue().toString();
  SharedPreferences sp=getPreferenceManager().getSharedPreferences();
  SharedPreferences.Editor editor=sp.edit();
  editor.putString("String_Node_Str",packageName);
  if (!packageName.equals(LockscreenSettings.THEME_DEFAULT)) {
    Resources themeResources=null;
    try {
      themeResources=getPackageManager().getResourcesForApplication(packageName.toString());
    }
 catch (    NameNotFoundException e) {
    }
    if (themeResources != null) {
      int tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int network_text_color=themeResources.getColor(tmpId);
        editor.putInt("String_Node_Str",network_text_color);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int network_text_shadow_color=themeResources.getColor(tmpId);
        editor.putInt("String_Node_Str",network_text_shadow_color);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int clock_text_color=themeResources.getColor(tmpId);
        editor.putInt("String_Node_Str",clock_text_color);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int clock_text_shadow_color=themeResources.getColor(tmpId);
        editor.putInt("String_Node_Str",clock_text_shadow_color);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int music_text_color=themeResources.getColor(tmpId);
        editor.putInt("String_Node_Str",music_text_color);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int music_text_shadow_color=themeResources.getColor(tmpId);
        editor.putInt("String_Node_Str",music_text_shadow_color);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int notification_text_color=themeResources.getColor(tmpId);
        editor.putInt("String_Node_Str",notification_text_color);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int notification_text_shadow_color=themeResources.getColor(tmpId);
        editor.putInt("String_Node_Str",notification_text_shadow_color);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int music_control_pad=themeResources.getDimensionPixelSize(tmpId);
        editor.putInt("String_Node_Str",music_control_pad);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        int text_notif_pad=themeResources.getDimensionPixelSize(tmpId);
        editor.putInt("String_Node_Str",text_notif_pad);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        boolean background_slide=themeResources.getBoolean(tmpId);
        editor.putBoolean("String_Node_Str",background_slide);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        boolean allow_art_slide=themeResources.getBoolean(tmpId);
        editor.putBoolean("String_Node_Str",allow_art_slide);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        boolean show_icons=themeResources.getBoolean(tmpId);
        editor.putBoolean("String_Node_Str",show_icons);
      }
      tmpId=themeResources.getIdentifier("String_Node_Str","String_Node_Str",packageName.toString());
      if (tmpId != 0) {
        boolean simple_text_notif=themeResources.getBoolean(tmpId);
        editor.putBoolean("String_Node_Str",simple_text_notif);
      }
    }
  }
 else {
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
    editor.remove("String_Node_Str");
  }
  editor.commit();
  if (utils.getCheckBoxPref(getBaseContext(),SMALL_TEXT_KEY,false)) {
    utils.setCheckBoxPref(getBaseContext(),GMAIL_ACCOUNT_KEY,false);
    utils.setCheckBoxPref(getBaseContext(),GMAIL_MERGE_KEY,true);
  }
  startActivity(new Intent(getBaseContext(),LockscreenSettings.class));
  finish();
}