Program: 24970
Project: 24970
Buggy source:
private boolean applyPreferences() throws RemoteException {
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
  ENABLE_DEBUG_LOG=true;
  Log.i(TAG,"String_Node_Str" + ENABLE_DEBUG_LOG);
  boolean useBridges=prefs.getBoolean(TorConstants.PREF_BRIDGES_ENABLED,false);
  boolean becomeRelay=prefs.getBoolean(TorConstants.PREF_OR,false);
  boolean ReachableAddresses=prefs.getBoolean(TorConstants.PREF_REACHABLE_ADDRESSES,false);
  boolean enableHiddenServices=prefs.getBoolean("String_Node_Str",false);
  boolean enableStrictNodes=prefs.getBoolean("String_Node_Str",false);
  String entranceNodes=prefs.getString("String_Node_Str",null);
  String exitNodes=prefs.getString("String_Node_Str",null);
  String excludeNodes=prefs.getString("String_Node_Str",null);
  String proxyType=prefs.getString("String_Node_Str",null);
  if (proxyType != null) {
    String proxyHost=prefs.getString("String_Node_Str",null);
    String proxyPort=prefs.getString("String_Node_Str",null);
    if (proxyHost != null && proxyPort != null) {
      mBinder.updateConfiguration(proxyType + "String_Node_Str",proxyHost + ':' + proxyPort,false);
    }
  }
  File fileGeoIP=new File(appBinHome,"String_Node_Str");
  mBinder.updateConfiguration("String_Node_Str",fileGeoIP.getAbsolutePath(),false);
  mBinder.updateConfiguration("String_Node_Str",entranceNodes,false);
  mBinder.updateConfiguration("String_Node_Str",exitNodes,false);
  mBinder.updateConfiguration("String_Node_Str",excludeNodes,false);
  mBinder.updateConfiguration("String_Node_Str",enableStrictNodes ? "String_Node_Str" : "String_Node_Str",false);
  if (useBridges) {
    String bridgeList=prefs.getString(TorConstants.PREF_BRIDGES_LIST,"String_Node_Str");
    if (bridgeList == null || bridgeList.length() == 0) {
      showAlert(getString(R.string.bridge_error),getString(R.string.bridge_requires_ip) + getString(R.string.send_email_for_bridges));
      return false;
    }
    mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
    String bridgeDelim="String_Node_Str";
    if (bridgeList.indexOf("String_Node_Str") != -1) {
      bridgeDelim="String_Node_Str";
    }
    StringTokenizer st=new StringTokenizer(bridgeList,bridgeDelim);
    while (st.hasMoreTokens()) {
      mBinder.updateConfiguration("String_Node_Str",st.nextToken(),false);
    }
    mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
  }
 else {
    mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
  }
  try {
    if (ReachableAddresses) {
      String ReachableAddressesPorts=prefs.getString(TorConstants.PREF_REACHABLE_ADDRESSES_PORTS,"String_Node_Str");
      mBinder.updateConfiguration("String_Node_Str",ReachableAddressesPorts,false);
    }
 else {
      mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
    }
  }
 catch (  Exception e) {
    showAlert(getString(R.string.error),getString(R.string.your_reachableaddresses_settings_caused_an_exception_));
    return false;
  }
  try {
    if (becomeRelay && (!useBridges) && (!ReachableAddresses)) {
      int ORPort=Integer.parseInt(prefs.getString(TorConstants.PREF_OR_PORT,"String_Node_Str"));
      String nickname=prefs.getString(TorConstants.PREF_OR_NICKNAME,"String_Node_Str");
      mBinder.updateConfiguration("String_Node_Str",ORPort + "String_Node_Str",false);
      mBinder.updateConfiguration("String_Node_Str",nickname,false);
      mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
    }
 else {
      mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
      mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
      mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
    }
  }
 catch (  Exception e) {
    showAlert(getString(R.string.error),getString(R.string.your_relay_settings_caused_an_exception_));
    return false;
  }
  if (enableHiddenServices) {
    mBinder.updateConfiguration("String_Node_Str",appDataHome.getAbsolutePath(),false);
    String hsPorts=prefs.getString("String_Node_Str","String_Node_Str");
    StringTokenizer st=new StringTokenizer(hsPorts,"String_Node_Str");
    String hsPortConfig=null;
    while (st.hasMoreTokens()) {
      hsPortConfig=st.nextToken();
      if (hsPortConfig.indexOf("String_Node_Str") == -1) {
        hsPortConfig=hsPortConfig + "String_Node_Str" + hsPortConfig;
      }
      mBinder.updateConfiguration("String_Node_Str",hsPortConfig,false);
    }
  }
 else {
    mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
  }
  mBinder.saveConfiguration();
  return true;
}

Fixed version (ground truth):
private boolean applyPreferences() throws RemoteException {
  SharedPreferences prefs=PreferenceManager.getDefaultSharedPreferences(this);
  ENABLE_DEBUG_LOG=prefs.getBoolean("String_Node_Str",false);
  Log.i(TAG,"String_Node_Str" + ENABLE_DEBUG_LOG);
  boolean useBridges=prefs.getBoolean(TorConstants.PREF_BRIDGES_ENABLED,false);
  boolean becomeRelay=prefs.getBoolean(TorConstants.PREF_OR,false);
  boolean ReachableAddresses=prefs.getBoolean(TorConstants.PREF_REACHABLE_ADDRESSES,false);
  boolean enableHiddenServices=prefs.getBoolean("String_Node_Str",false);
  boolean enableStrictNodes=prefs.getBoolean("String_Node_Str",false);
  String entranceNodes=prefs.getString("String_Node_Str",null);
  String exitNodes=prefs.getString("String_Node_Str",null);
  String excludeNodes=prefs.getString("String_Node_Str",null);
  String proxyType=prefs.getString("String_Node_Str",null);
  if (proxyType != null) {
    String proxyHost=prefs.getString("String_Node_Str",null);
    String proxyPort=prefs.getString("String_Node_Str",null);
    if (proxyHost != null && proxyPort != null) {
      mBinder.updateConfiguration(proxyType + "String_Node_Str",proxyHost + ':' + proxyPort,false);
    }
  }
  File fileGeoIP=new File(appBinHome,"String_Node_Str");
  mBinder.updateConfiguration("String_Node_Str",fileGeoIP.getAbsolutePath(),false);
  mBinder.updateConfiguration("String_Node_Str",entranceNodes,false);
  mBinder.updateConfiguration("String_Node_Str",exitNodes,false);
  mBinder.updateConfiguration("String_Node_Str",excludeNodes,false);
  mBinder.updateConfiguration("String_Node_Str",enableStrictNodes ? "String_Node_Str" : "String_Node_Str",false);
  if (useBridges) {
    String bridgeList=prefs.getString(TorConstants.PREF_BRIDGES_LIST,"String_Node_Str");
    if (bridgeList == null || bridgeList.length() == 0) {
      showAlert(getString(R.string.bridge_error),getString(R.string.bridge_requires_ip) + getString(R.string.send_email_for_bridges));
      return false;
    }
    mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
    String bridgeDelim="String_Node_Str";
    if (bridgeList.indexOf("String_Node_Str") != -1) {
      bridgeDelim="String_Node_Str";
    }
    StringTokenizer st=new StringTokenizer(bridgeList,bridgeDelim);
    while (st.hasMoreTokens()) {
      mBinder.updateConfiguration("String_Node_Str",st.nextToken(),false);
    }
    mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
  }
 else {
    mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
  }
  try {
    if (ReachableAddresses) {
      String ReachableAddressesPorts=prefs.getString(TorConstants.PREF_REACHABLE_ADDRESSES_PORTS,"String_Node_Str");
      mBinder.updateConfiguration("String_Node_Str",ReachableAddressesPorts,false);
    }
 else {
      mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
    }
  }
 catch (  Exception e) {
    showAlert(getString(R.string.error),getString(R.string.your_reachableaddresses_settings_caused_an_exception_));
    return false;
  }
  try {
    if (becomeRelay && (!useBridges) && (!ReachableAddresses)) {
      int ORPort=Integer.parseInt(prefs.getString(TorConstants.PREF_OR_PORT,"String_Node_Str"));
      String nickname=prefs.getString(TorConstants.PREF_OR_NICKNAME,"String_Node_Str");
      mBinder.updateConfiguration("String_Node_Str",ORPort + "String_Node_Str",false);
      mBinder.updateConfiguration("String_Node_Str",nickname,false);
      mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
    }
 else {
      mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
      mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
      mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
    }
  }
 catch (  Exception e) {
    showAlert(getString(R.string.error),getString(R.string.your_relay_settings_caused_an_exception_));
    return false;
  }
  if (enableHiddenServices) {
    mBinder.updateConfiguration("String_Node_Str",appDataHome.getAbsolutePath(),false);
    String hsPorts=prefs.getString("String_Node_Str","String_Node_Str");
    StringTokenizer st=new StringTokenizer(hsPorts,"String_Node_Str");
    String hsPortConfig=null;
    while (st.hasMoreTokens()) {
      hsPortConfig=st.nextToken();
      if (hsPortConfig.indexOf("String_Node_Str") == -1) {
        hsPortConfig=hsPortConfig + "String_Node_Str" + hsPortConfig;
      }
      mBinder.updateConfiguration("String_Node_Str",hsPortConfig,false);
    }
  }
 else {
    mBinder.updateConfiguration("String_Node_Str","String_Node_Str",false);
  }
  mBinder.saveConfiguration();
  return true;
}