Program: 9795
Project: 9795
Buggy source:
@Override protected void loadExtraPreferencesTo(Activity activity,PreferenceGroup subpanel){
  final Context c=subpanel.getContext();
  final OpenvpnProfile profile=(OpenvpnProfile)getProfile();
  mUserAuth=new CheckBoxPreference(c);
  mUserAuth.setTitle(R.string.vpn_openvpn_userauth);
  mUserAuth.setSummary(R.string.vpn_openvpn_userauth_summary);
  mUserAuth.setChecked(profile.getUserAuth());
  mUserAuth.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener(){
    public boolean onPreferenceChange(    Preference pref,    Object newValue){
      boolean enabled=(Boolean)newValue;
      profile.setUserAuth(enabled);
      mUserAuth.setChecked(enabled);
      return true;
    }
  }
);
  subpanel.addPreference(mUserAuth);
  mCert=new CertChoosePreference(c);
  mCert.setTitle(R.string.vpn_ca_certificate);
  if (profile.getCertName() != null) {
    Certificate cert=parseCert(profile.getCertName());
    if (cert != null)     mCert.setSummary(cert.toString());
  }
 else {
    mCert.setSummary(R.string.vpn_ca_certificate_title);
  }
  mCert.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference pref,    Object newValue){
      Certificate cert=(Certificate)newValue;
      try {
        KeyStore ks=KeyStore.getInstance("String_Node_Str");
        ks.load(null,null);
        ks.setCertificateEntry("String_Node_Str",cert);
        ByteArrayOutputStream out=new ByteArrayOutputStream();
        ks.store(out,null);
        profile.setCertName(out.toByteArray());
        ((Activity)c).runOnUiThread(new RunnableEx<String>(cert.toString()){
          @Override public void run(          String cert){
            mCert.setSummary(cert);
          }
        }
);
      }
 catch (      KeyStoreException e) {
        e.printStackTrace();
      }
catch (      NoSuchAlgorithmException e) {
        e.printStackTrace();
      }
catch (      CertificateException e) {
        e.printStackTrace();
      }
catch (      IOException e) {
        e.printStackTrace();
      }
      return true;
    }
  }
);
  mCert.setOnPreferenceClickListener(new FileChooseClickListener(activity));
  subpanel.addPreference(mCert);
  mUserCert=new KeyChoosePreference(c);
  mUserCert.setTitle(R.string.vpn_user_certificate);
  if (profile.getUserCertName() == null) {
    mUserCert.setSummary(R.string.vpn_user_certificate_title);
  }
 else {
    mUserCert.setSummary(profile.getUserCertName());
  }
  mUserCert.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference pref,    Object newValue){
      String alias=(String)newValue;
      profile.setUserCertName(alias);
      ((Activity)c).runOnUiThread(new RunnableEx<String>(alias){
        @Override public void run(        String alias){
          mUserCert.setSummary(alias);
        }
      }
);
      return true;
    }
  }
);
  subpanel.addPreference(mUserCert);
}

Fixed version (ground truth):
@Override protected void loadExtraPreferencesTo(Activity activity,PreferenceGroup subpanel){
  final Context c=subpanel.getContext();
  final OpenvpnProfile profile=(OpenvpnProfile)getProfile();
  mUserAuth=new CheckBoxPreference(c);
  mUserAuth.setTitle(R.string.vpn_openvpn_userauth);
  mUserAuth.setSummary(R.string.vpn_openvpn_userauth_summary);
  mUserAuth.setChecked(profile.getUserAuth());
  mUserAuth.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener(){
    public boolean onPreferenceChange(    Preference pref,    Object newValue){
      boolean enabled=(Boolean)newValue;
      profile.setUserAuth(enabled);
      mUserAuth.setChecked(enabled);
      return true;
    }
  }
);
  subpanel.addPreference(mUserAuth);
  mCert=new CertChoosePreference(c);
  mCert.setTitle(R.string.vpn_ca_certificate);
  if (profile.getCertName() != null) {
    Certificate cert=parseCert(profile.getCertName());
    if (cert != null)     mCert.setSummary(cert.toString());
  }
 else {
    mCert.setSummary(R.string.vpn_ca_certificate_title);
  }
  mCert.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference pref,    Object newValue){
      Certificate cert=(Certificate)newValue;
      try {
        KeyStore ks=KeyStore.getInstance("String_Node_Str");
        ks.load(null,null);
        ks.setCertificateEntry("String_Node_Str",cert);
        ByteArrayOutputStream out=new ByteArrayOutputStream();
        ks.store(out,null);
        profile.setCertName(out.toByteArray());
        ((Activity)c).runOnUiThread(new RunnableEx<String>(cert.toString()){
          @Override public void run(          String cert){
            mCert.setSummary(cert);
          }
        }
);
      }
 catch (      Exception e) {
        throw new RuntimeException(e);
      }
      return true;
    }
  }
);
  mCert.setOnPreferenceClickListener(new FileChooseClickListener(activity));
  subpanel.addPreference(mCert);
  mUserCert=new KeyChoosePreference(c);
  mUserCert.setTitle(R.string.vpn_user_certificate);
  if (profile.getUserCertName() == null) {
    mUserCert.setSummary(R.string.vpn_user_certificate_title);
  }
 else {
    mUserCert.setSummary(profile.getUserCertName());
  }
  mUserCert.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener(){
    @Override public boolean onPreferenceChange(    Preference pref,    Object newValue){
      String alias=(String)newValue;
      profile.setUserCertName(alias);
      ((Activity)c).runOnUiThread(new RunnableEx<String>(alias){
        @Override public void run(        String alias){
          mUserCert.setSummary(alias);
        }
      }
);
      return true;
    }
  }
);
  subpanel.addPreference(mUserCert);
}