nus-yam/ex-repair huggingface dataset:
Program: 109697
Project: 109697
Buggy source:
public Dialog onCreateDialog(Bundle savedInstanceState){
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
  LayoutInflater inflater=getActivity().getLayoutInflater();
  View new_provider_dialog_view=inflater.inflate(R.layout.new_provider_dialog,null);
  final EditText url_input_field=(EditText)new_provider_dialog_view.findViewById(R.id.new_provider_url);
  final CheckBox danger_checkbox=(CheckBox)new_provider_dialog_view.findViewById(R.id.danger_checkbox);
  builder.setView(new_provider_dialog_view).setMessage(R.string.introduce_new_provider).setPositiveButton(R.string.save,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      String entered_url=url_input_field.getText().toString().trim();
      boolean danger_on=danger_checkbox.isChecked();
      if (validURL(entered_url)) {
        interface_with_ConfigurationWizard.saveProvider(entered_url,danger_on);
        Toast.makeText(getActivity().getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
      }
 else {
        url_input_field.setText("String_Node_Str");
        Toast.makeText(getActivity().getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
      }
    }
  }
).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      dialog.cancel();
    }
  }
);
  return builder.create();
}

Fixed version (ground truth):
public Dialog onCreateDialog(Bundle savedInstanceState){
  AlertDialog.Builder builder=new AlertDialog.Builder(getActivity());
  LayoutInflater inflater=getActivity().getLayoutInflater();
  View new_provider_dialog_view=inflater.inflate(R.layout.new_provider_dialog,null);
  final EditText url_input_field=(EditText)new_provider_dialog_view.findViewById(R.id.new_provider_url);
  final CheckBox danger_checkbox=(CheckBox)new_provider_dialog_view.findViewById(R.id.danger_checkbox);
  builder.setView(new_provider_dialog_view).setMessage(R.string.introduce_new_provider).setPositiveButton(R.string.save,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      String entered_url=url_input_field.getText().toString().trim();
      if (!entered_url.startsWith("String_Node_Str")) {
        entered_url="String_Node_Str".concat(entered_url);
      }
      boolean danger_on=danger_checkbox.isChecked();
      if (validURL(entered_url)) {
        interface_with_ConfigurationWizard.saveProvider(entered_url,danger_on);
        Toast.makeText(getActivity().getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
      }
 else {
        url_input_field.setText("String_Node_Str");
        Toast.makeText(getActivity().getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
      }
    }
  }
).setNegativeButton(R.string.cancel,new DialogInterface.OnClickListener(){
    public void onClick(    DialogInterface dialog,    int id){
      dialog.cancel();
    }
  }
);
  return builder.create();
}
Program: 109698
Project: 109698
Buggy source:
/** 
 * Calculates the parameter x of the SRP-6a algorithm.
 * @param username
 * @param password
 * @param salt the salt of the user
 * @return x
 */
public byte[] calculatePasswordHash(String username,String password,byte[] salt){
  password=password.replaceAll("String_Node_Str","String_Node_Str");
  MessageDigest x_digest=newDigest();
  byte[] user=null;
  byte[] password_bytes=null;
  byte[] colon={};
  try {
    user=Util.trim(username.getBytes("String_Node_Str"));
    colon=Util.trim("String_Node_Str".getBytes("String_Node_Str"));
    password_bytes=Util.trim(password.getBytes("String_Node_Str"));
  }
 catch (  UnsupportedEncodingException e) {
    user=Util.trim(username.getBytes());
    colon=Util.trim("String_Node_Str".getBytes());
    password_bytes=Util.trim(password.getBytes());
  }
  x_digest.update(user);
  x_digest.update(colon);
  x_digest.update(password_bytes);
  byte[] h=x_digest.digest();
  String hstr=new BigInteger(1,h).toString(16);
  x_digest.reset();
  x_digest.update(salt);
  x_digest.update(h);
  byte[] x_digest_bytes=x_digest.digest();
  return x_digest_bytes;
}

Fixed version (ground truth):
/** 
 * Calculates the parameter x of the SRP-6a algorithm.
 * @param username
 * @param password
 * @param salt the salt of the user
 * @return x
 */
public byte[] calculatePasswordHash(String username,String password,byte[] salt){
  password=password.replaceAll("String_Node_Str","String_Node_Str");
  MessageDigest x_digest=newDigest();
  byte[] user=null;
  byte[] password_bytes=null;
  byte[] colon={};
  String encoding="String_Node_Str";
  try {
    user=Util.trim(username.getBytes(encoding));
    colon=Util.trim("String_Node_Str".getBytes(encoding));
    password_bytes=Util.trim(password.getBytes(encoding));
  }
 catch (  UnsupportedEncodingException e) {
    user=Util.trim(username.getBytes());
    colon=Util.trim("String_Node_Str".getBytes());
    password_bytes=Util.trim(password.getBytes());
  }
  x_digest.update(user);
  x_digest.update(colon);
  x_digest.update(password_bytes);
  byte[] h=x_digest.digest();
  String hstr=new BigInteger(1,h).toString(16);
  x_digest.reset();
  x_digest.update(salt);
  x_digest.update(h);
  byte[] x_digest_bytes=x_digest.digest();
  return x_digest_bytes;
}
Program: 109700
Project: 109700
Buggy source:
/** 
 * Calculates the parameter x of the SRP-6a algorithm.
 * @param username
 * @param password
 * @param salt the salt of the user
 * @return x
 */
public byte[] calculatePasswordHash(String username,String password,byte[] salt){
  password=password.replaceAll("String_Node_Str","String_Node_Str");
  MessageDigest x_digest=newDigest();
  byte[] user=null;
  byte[] password_bytes=null;
  byte[] colon={};
  try {
    user=Util.trim(username.getBytes("String_Node_Str"));
    colon=Util.trim("String_Node_Str".getBytes("String_Node_Str"));
    password_bytes=Util.trim(password.getBytes("String_Node_Str"));
  }
 catch (  UnsupportedEncodingException e) {
    user=Util.trim(username.getBytes());
    colon=Util.trim("String_Node_Str".getBytes());
    password_bytes=Util.trim(password.getBytes());
  }
  x_digest.update(user);
  x_digest.update(colon);
  x_digest.update(password_bytes);
  byte[] h=x_digest.digest();
  x_digest.reset();
  x_digest.update(salt);
  x_digest.update(h);
  byte[] x_digest_bytes=x_digest.digest();
  return x_digest_bytes;
}

Fixed version (ground truth):
/** 
 * Calculates the parameter x of the SRP-6a algorithm.
 * @param username
 * @param password
 * @param salt the salt of the user
 * @return x
 */
public byte[] calculatePasswordHash(String username,String password,byte[] salt){
  password=password.replaceAll("String_Node_Str","String_Node_Str");
  MessageDigest x_digest=newDigest();
  byte[] user=null;
  byte[] password_bytes=null;
  byte[] colon={};
  try {
    user=Util.trim(username.getBytes("String_Node_Str"));
    colon=Util.trim("String_Node_Str".getBytes("String_Node_Str"));
    password_bytes=Util.trim(password.getBytes("String_Node_Str"));
  }
 catch (  UnsupportedEncodingException e) {
    user=Util.trim(username.getBytes());
    colon=Util.trim("String_Node_Str".getBytes());
    password_bytes=Util.trim(password.getBytes());
  }
  x_digest.update(user);
  x_digest.update(colon);
  x_digest.update(password_bytes);
  byte[] h=x_digest.digest();
  String hstr=new BigInteger(1,h).toString(16);
  x_digest.reset();
  x_digest.update(salt);
  x_digest.update(h);
  byte[] x_digest_bytes=x_digest.digest();
  return x_digest_bytes;
}
Program: 109701
Project: 109701
Buggy source:
/** 
 * It calculates the parameter S used by response() to obtain session hash K.
 * @param Bbytes the parameter received from the server, in bytes
 * @return the parameter S
 */
private BigInteger calculateS(byte[] Bbytes){
  byte[] Abytes=Util.trim(A.toByteArray());
  Bbytes=Util.trim(Bbytes);
  byte[] u_bytes=getU(Abytes,Bbytes);
  BigInteger B=new BigInteger(1,Bbytes);
  BigInteger u=new BigInteger(1,u_bytes);
  BigInteger B_minus_v=B.subtract(v);
  BigInteger a_ux=a.add(u.multiply(x));
  BigInteger S=B_minus_v.modPow(a_ux,N);
  return S;
}

Fixed version (ground truth):
/** 
 * It calculates the parameter S used by response() to obtain session hash K.
 * @param Bbytes the parameter received from the server, in bytes
 * @return the parameter S
 */
private BigInteger calculateS(byte[] Bbytes){
  byte[] Abytes=Util.trim(A.toByteArray());
  Bbytes=Util.trim(Bbytes);
  byte[] u_bytes=getU(Abytes,Bbytes);
  BigInteger B=new BigInteger(1,Bbytes);
  BigInteger u=new BigInteger(1,u_bytes);
  BigInteger B_minus_v=B.subtract(v);
  String vstr=v.toString(16);
  BigInteger a_ux=a.add(u.multiply(x));
  String xstr=x.toString(16);
  BigInteger S=B_minus_v.modPow(a_ux,N);
  return S;
}
Program: 109702
Project: 109702
Buggy source:
private String getStringFromProvider(String string_url,boolean danger_on){
  String json_file_content="String_Node_Str";
  URL provider_url=null;
  try {
    provider_url=new URL(string_url);
    json_file_content=new Scanner(provider_url.openStream()).useDelimiter("String_Node_Str").next();
  }
 catch (  MalformedURLException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    if (provider_url != null && danger_on) {
      json_file_content=getStringFromProviderWithoutValidate(provider_url);
    }
    e.printStackTrace();
  }
  return json_file_content;
}

Fixed version (ground truth):
private String getStringFromProvider(String string_url,boolean danger_on){
  String json_file_content="String_Node_Str";
  URL provider_url=null;
  int seconds_of_timeout=1;
  try {
    provider_url=new URL(string_url);
    URLConnection url_connection=provider_url.openConnection();
    url_connection.setConnectTimeout(seconds_of_timeout * 1000);
    json_file_content=new Scanner(url_connection.getInputStream()).useDelimiter("String_Node_Str").next();
  }
 catch (  MalformedURLException e) {
    e.printStackTrace();
  }
catch (  SocketTimeoutException e) {
    return "String_Node_Str";
  }
catch (  IOException e) {
    if (provider_url != null && danger_on) {
      json_file_content=getStringFromProviderWithoutValidate(provider_url);
    }
    e.printStackTrace();
  }
catch (  Exception e) {
    e.printStackTrace();
  }
  return json_file_content;
}
Program: 109703
Project: 109703
Buggy source:
@Override public void saveProvider(String provider_url){
  providerAPI_result_receiver=new ProviderAPIResultReceiver(new Handler());
  providerAPI_result_receiver.setReceiver(this);
  Intent provider_API_command=new Intent(this,ProviderAPI.class);
  Bundle method_and_parameters=new Bundle();
  method_and_parameters.putString(ConfigHelper.provider_key_url,provider_url);
  provider_API_command.putExtra(ConfigHelper.downloadNewProviderDotJSON,method_and_parameters);
  provider_API_command.putExtra("String_Node_Str",providerAPI_result_receiver);
  startService(provider_API_command);
}

Fixed version (ground truth):
@Override public void saveProvider(String provider_main_url){
  providerAPI_result_receiver=new ProviderAPIResultReceiver(new Handler());
  providerAPI_result_receiver.setReceiver(this);
  Intent provider_API_command=new Intent(this,ProviderAPI.class);
  Bundle method_and_parameters=new Bundle();
  method_and_parameters.putString(ConfigHelper.provider_main_url,provider_main_url);
  provider_API_command.putExtra(ConfigHelper.downloadNewProviderDotJSON,method_and_parameters);
  provider_API_command.putExtra("String_Node_Str",providerAPI_result_receiver);
  startService(provider_API_command);
}
Program: 109704
Project: 109704
Buggy source:
@Override protected void onHandleIntent(Intent task_for){
  final ResultReceiver receiver=task_for.getParcelableExtra("String_Node_Str");
  Bundle task;
  if ((task=task_for.getBundleExtra(ConfigHelper.downloadJsonFilesBundleExtra)) != null) {
    if (!downloadJsonFiles(task))     receiver.send(ConfigHelper.INCORRECTLY_DOWNLOADED_JSON_FILES,Bundle.EMPTY);
 else     receiver.send(ConfigHelper.CORRECTLY_DOWNLOADED_JSON_FILES,Bundle.EMPTY);
  }
 else   if ((task=task_for.getBundleExtra(ConfigHelper.downloadNewProviderDotJSON)) != null) {
    if (downloadJsonFilesBundleExtra(task))     receiver.send(ConfigHelper.CORRECTLY_DOWNLOADED_JSON_FILES,Bundle.EMPTY);
 else     receiver.send(ConfigHelper.INCORRECTLY_DOWNLOADED_JSON_FILES,Bundle.EMPTY);
  }
}

Fixed version (ground truth):
@Override protected void onHandleIntent(Intent task_for){
  final ResultReceiver receiver=task_for.getParcelableExtra("String_Node_Str");
  Bundle task;
  if ((task=task_for.getBundleExtra(ConfigHelper.downloadJsonFilesBundleExtra)) != null) {
    if (!downloadJsonFiles(task))     receiver.send(ConfigHelper.INCORRECTLY_DOWNLOADED_JSON_FILES,Bundle.EMPTY);
 else     receiver.send(ConfigHelper.CORRECTLY_DOWNLOADED_JSON_FILES,Bundle.EMPTY);
  }
 else   if ((task=task_for.getBundleExtra(ConfigHelper.downloadNewProviderDotJSON)) != null) {
    if (downloadNewProviderDotJSON(task))     receiver.send(ConfigHelper.CORRECTLY_DOWNLOADED_JSON_FILES,Bundle.EMPTY);
 else     receiver.send(ConfigHelper.INCORRECTLY_DOWNLOADED_JSON_FILES,Bundle.EMPTY);
  }
}
Program: 109705
Project: 109705
Buggy source:
private boolean downloadJsonFilesBundleExtra(Bundle task){
  String provider_name=(String)task.get(ConfigHelper.provider_key);
  String cert_url=(String)task.get(ConfigHelper.cert_key);
  String eip_service_json_url=(String)task.get(ConfigHelper.eip_service_key);
  try {
    URL cacert=new URL(cert_url);
    ConfigHelper.addTrustedCertificate(provider_name,cacert.openStream());
    JSONObject eip_service_json=getJSONFromProvider(eip_service_json_url);
    ConfigHelper.saveSharedPref(ConfigHelper.eip_service_key,eip_service_json);
    return true;
  }
 catch (  IOException e) {
    e.printStackTrace();
    return false;
  }
catch (  JSONException e) {
    ConfigHelper.rescueJSONException(e);
    return false;
  }
catch (  Exception e) {
    e.printStackTrace();
    return false;
  }
}

Fixed version (ground truth):
private boolean downloadJsonFilesBundleExtra(Bundle task){
  String provider_main_url=(String)task.get(ConfigHelper.provider_main_url);
  String provider_name=ConfigHelper.extractProviderName(provider_main_url);
  String cert_url=(String)task.get(ConfigHelper.cert_key);
  String eip_service_json_url=(String)task.get(ConfigHelper.eip_service_key);
  try {
    URL cacert=new URL(cert_url);
    ConfigHelper.addTrustedCertificate(provider_name,cacert.openStream());
    JSONObject eip_service_json=getJSONFromProvider(eip_service_json_url);
    ConfigHelper.saveSharedPref(ConfigHelper.eip_service_key,eip_service_json);
    return true;
  }
 catch (  IOException e) {
    e.printStackTrace();
    return false;
  }
catch (  JSONException e) {
    ConfigHelper.rescueJSONException(e);
    return false;
  }
catch (  Exception e) {
    e.printStackTrace();
    return false;
  }
}
Program: 109706
Project: 109706
Buggy source:
private boolean downloadNewProviderDotJSON(Bundle task){
  boolean custom=true;
  String provider_main_url=(String)task.get(ConfigHelper.provider_key_url);
  String provider_name=provider_main_url.replaceFirst("String_Node_Str","String_Node_Str").replaceFirst("String_Node_Str","String_Node_Str");
  String provider_json_url=guessURL(provider_main_url);
  JSONObject provider_json=null;
  try {
    provider_json=getJSONFromProvider(provider_json_url);
  }
 catch (  IOException e) {
    provider_json=downloadNewProviderDotJsonWithoutCert(provider_json_url);
  }
catch (  JSONException e) {
    e.printStackTrace();
    return false;
  }
  if (provider_json == null) {
    return false;
  }
 else {
    String filename=provider_name + "String_Node_Str".replaceFirst("String_Node_Str","String_Node_Str");
    ConfigHelper.saveFile(filename,provider_json.toString());
    ProviderListContent.addItem(new ProviderItem(provider_name,ConfigHelper.openFileInputStream(filename),custom));
    return true;
  }
}

Fixed version (ground truth):
private boolean downloadNewProviderDotJSON(Bundle task){
  boolean custom=true;
  String provider_main_url=(String)task.get(ConfigHelper.provider_main_url);
  String provider_name=provider_main_url.replaceFirst("String_Node_Str","String_Node_Str").replaceFirst("String_Node_Str","String_Node_Str");
  String provider_json_url=guessURL(provider_main_url);
  JSONObject provider_json=null;
  try {
    provider_json=getJSONFromProvider(provider_json_url);
  }
 catch (  IOException e) {
    provider_json=downloadNewProviderDotJsonWithoutCert(provider_json_url);
  }
catch (  JSONException e) {
    e.printStackTrace();
    return false;
  }
  if (provider_json == null) {
    return false;
  }
 else {
    String filename=provider_name + "String_Node_Str".replaceFirst("String_Node_Str","String_Node_Str");
    ConfigHelper.saveFile(filename,provider_json.toString());
    ConfigHelper.saveSharedPref(ConfigHelper.provider_key,provider_json);
    ProviderListContent.addItem(new ProviderItem(provider_name,ConfigHelper.openFileInputStream(filename),custom));
    return true;
  }
}
Program: 109707
Project: 109707
Buggy source:
@Override public void onReceiveResult(int resultCode,Bundle resultData){
  if (resultCode == ConfigHelper.CUSTOM_PROVIDER_ADDED) {
    ProviderListFragment providerList=new ProviderListFragment();
    FragmentManager fragmentManager=getFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.configuration_wizard_layout,providerList,"String_Node_Str").commit();
  }
 else   if (resultCode == ConfigHelper.CORRECTLY_DOWNLOADED_JSON_FILES) {
    setResult(RESULT_OK);
    finish();
  }
 else   if (resultCode == ConfigHelper.INCORRECTLY_DOWNLOADED_JSON_FILES) {
    setResult(RESULT_CANCELED);
    finish();
  }
}

Fixed version (ground truth):
@Override public void onReceiveResult(int resultCode,Bundle resultData){
  if (resultCode == ConfigHelper.CUSTOM_PROVIDER_ADDED) {
    ProviderListFragment providerList=new ProviderListFragment();
    FragmentManager fragmentManager=getFragmentManager();
    fragmentManager.beginTransaction().replace(R.id.configuration_wizard_layout,providerList,"String_Node_Str").commit();
  }
 else   if (resultCode == ConfigHelper.CORRECTLY_DOWNLOADED_JSON_FILES) {
    setResult(RESULT_OK);
    finish();
  }
 else   if (resultCode == ConfigHelper.INCORRECTLY_DOWNLOADED_JSON_FILES) {
    setResult(RESULT_CANCELED);
    Toast.makeText(getApplicationContext(),"String_Node_Str",Toast.LENGTH_LONG).show();
  }
}
Program: 109708
Project: 109708
Buggy source:
private JSONObject downloadNewProviderDotJsonWithoutCert(String provider_json_url){
  JSONObject provider_json=null;
  try {
    URL provider_url=new URL(provider_json_url);
    String provider_json_string=new Scanner(provider_url.openStream()).useDelimiter("String_Node_Str").next();
    provider_json=new JSONObject(provider_json_string);
  }
 catch (  MalformedURLException e1) {
    e1.printStackTrace();
  }
catch (  IOException e1) {
    e1.printStackTrace();
  }
catch (  JSONException e1) {
    e1.printStackTrace();
  }
  return provider_json;
}

Fixed version (ground truth):
private JSONObject downloadNewProviderDotJsonWithoutCert(String provider_json_url){
  JSONObject provider_json=null;
  try {
    URL provider_url=new URL(provider_json_url);
    String provider_json_string=new Scanner(provider_url.openStream()).useDelimiter("String_Node_Str").next();
    provider_json=new JSONObject(provider_json_string);
  }
 catch (  MalformedURLException e1) {
    e1.printStackTrace();
  }
catch (  UnknownHostException e1) {
    e1.printStackTrace();
  }
catch (  IOException e1) {
    e1.printStackTrace();
  }
catch (  JSONException e1) {
    e1.printStackTrace();
  }
  return provider_json;
}
Program: 109709
Project: 109709
Buggy source:
/** 
 * Callback method from   {@link ProviderListFragment.Callbacks}indicating that the item with the given ID was selected.
 */
@Override public void onItemSelected(String id){
  if (mTwoPane) {
  }
 else {
    Iterator<ProviderItem> preseeded_providers_iterator=ProviderListContent.ITEMS.iterator();
    while (preseeded_providers_iterator.hasNext()) {
      ProviderItem current_provider_item=preseeded_providers_iterator.next();
      if (current_provider_item.id.equalsIgnoreCase(id)) {
        try {
          if (current_provider_item.custom)           processAssetsFiles(current_provider_item);
          downloadJSONFiles(current_provider_item);
        }
 catch (        IOException e) {
          e.printStackTrace();
        }
      }
    }
    setResult(RESULT_OK);
    finish();
  }
}

Fixed version (ground truth):
/** 
 * Callback method from   {@link ProviderListFragment.Callbacks}indicating that the item with the given ID was selected.
 */
@Override public void onItemSelected(String id){
  if (mTwoPane) {
  }
 else {
    Iterator<ProviderItem> preseeded_providers_iterator=ProviderListContent.ITEMS.iterator();
    while (preseeded_providers_iterator.hasNext()) {
      ProviderItem current_provider_item=preseeded_providers_iterator.next();
      if (current_provider_item.id.equalsIgnoreCase(id)) {
        try {
          if (!current_provider_item.custom)           processAssetsFiles(current_provider_item);
          downloadJSONFiles(current_provider_item);
        }
 catch (        IOException e) {
          e.printStackTrace();
        }
      }
    }
    setResult(RESULT_OK);
    finish();
  }
}
Program: 109710
Project: 109710
Buggy source:
public ProviderItem(String name,FileInputStream provider_json,boolean custom){
  try {
    byte[] urls_file_bytes=new byte[provider_json.available()];
    provider_json.read(urls_file_bytes);
    String urls_file_content=new String(urls_file_bytes);
    JSONObject file_contents=new JSONObject(urls_file_content);
    id=name;
    this.name=name;
    eip_service_json_url=(String)file_contents.get("String_Node_Str") + ConfigHelper.eip_service_api_path;
    cert_json_url=(String)file_contents.get("String_Node_Str");
  }
 catch (  JSONException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}

Fixed version (ground truth):
public ProviderItem(String name,FileInputStream provider_json,boolean custom){
  try {
    byte[] urls_file_bytes=new byte[provider_json.available()];
    provider_json.read(urls_file_bytes);
    String urls_file_content=new String(urls_file_bytes);
    JSONObject file_contents=new JSONObject(urls_file_content);
    id=name;
    this.name=name;
    eip_service_json_url=(String)file_contents.get("String_Node_Str") + ConfigHelper.eip_service_api_path;
    cert_json_url=(String)file_contents.get("String_Node_Str");
    this.custom=custom;
  }
 catch (  JSONException e) {
    e.printStackTrace();
  }
catch (  IOException e) {
    e.printStackTrace();
  }
}
Program: 109711
Project: 109711
Buggy source:
private void embedPKCS12File(){
  mResult.mPKCS12Filename=embedFile(mResult.mPKCS12Filename,true);
  if (mResult.mPKCS12Filename.startsWith(VpnProfile.INLINE_TAG)) {
    if (mResult.mAuthenticationType == VpnProfile.TYPE_USERPASS_KEYSTORE)     mResult.mAuthenticationType=VpnProfile.TYPE_USERPASS_PKCS12;
    if (mResult.mAuthenticationType == VpnProfile.TYPE_KEYSTORE)     mResult.mAuthenticationType=VpnProfile.TYPE_PKCS12;
  }
}

Fixed version (ground truth):
private void embedPKCS12File(){
  mResult.mPKCS12Filename=embedFile(mResult.mPKCS12Filename,true);
  if (mResult.mPKCS12Filename != null && mResult.mPKCS12Filename.startsWith(VpnProfile.INLINE_TAG)) {
    if (mResult.mAuthenticationType == VpnProfile.TYPE_USERPASS_KEYSTORE)     mResult.mAuthenticationType=VpnProfile.TYPE_USERPASS_PKCS12;
    if (mResult.mAuthenticationType == VpnProfile.TYPE_KEYSTORE)     mResult.mAuthenticationType=VpnProfile.TYPE_PKCS12;
  }
}
Program: 109712
Project: 109712
Buggy source:
private Vector<Vector<String>> getAllOption(String option,int minarg,int maxarg) throws ConfigParseError {
  Vector<Vector<String>> args=options.get(option);
  if (args == null)   return null;
  for (  Vector<String> optionline : args)   if (optionline.size() < (minarg + 1) || optionline.size() > maxarg + 1) {
    String err=String.format("String_Node_Str",option,optionline.size() - 1,minarg,maxarg);
    throw new ConfigParseError(err);
  }
  options.remove(option);
  return args;
}

Fixed version (ground truth):
private Vector<Vector<String>> getAllOption(String option,int minarg,int maxarg) throws ConfigParseError {
  Vector<Vector<String>> args=options.get(option);
  if (args == null)   return null;
  for (  Vector<String> optionline : args)   if (optionline.size() < (minarg + 1) || optionline.size() > maxarg + 1) {
    String err=String.format(Locale.getDefault(),"String_Node_Str",option,optionline.size() - 1,minarg,maxarg);
    throw new ConfigParseError(err);
  }
  options.remove(option);
  return args;
}
Program: 109713
Project: 109713
Buggy source:
private boolean space(char c){
  return Character.isSpace(c) || c == '\0';
}

Fixed version (ground truth):
private boolean space(char c){
  return Character.isWhitespace(c) || c == '\0';
}
Program: 109714
Project: 109714
Buggy source:
@Override public void updateState(String state,String logmessage){
  if (mProcessThread == null)   return;
  if ("String_Node_Str".equals(state)) {
    if (mDisplayBytecount) {
      showNotification(logmessage,null,true,mConnecttime);
    }
  }
 else {
    if ("String_Node_Str".equals(state)) {
      mDisplayBytecount=true;
      mConnecttime=System.currentTimeMillis();
    }
 else {
      mDisplayBytecount=false;
    }
    String ticker=state.toLowerCase();
    showNotification(state + "String_Node_Str" + logmessage,ticker,false,0);
  }
}

Fixed version (ground truth):
@Override public void updateState(String state,String logmessage){
  if (mProcessThread == null)   return;
  if ("String_Node_Str".equals(state)) {
    if (mDisplayBytecount) {
      showNotification(logmessage,null,true,mConnecttime);
    }
  }
 else {
    if ("String_Node_Str".equals(state)) {
      mDisplayBytecount=true;
      mConnecttime=System.currentTimeMillis();
    }
 else {
      mDisplayBytecount=false;
    }
    String ticker=state.toLowerCase(Locale.getDefault());
    showNotification(state + "String_Node_Str" + logmessage,ticker,false,0);
  }
}
Program: 109715
Project: 109715
Buggy source:
private void showNotification(String msg,String tickerText,boolean lowpriority,long when){
  String ns=Context.NOTIFICATION_SERVICE;
  NotificationManager mNotificationManager=(NotificationManager)getSystemService(ns);
  int icon=R.drawable.ic_stat_vpn;
  android.app.Notification.Builder nbuilder=new Notification.Builder(this);
  nbuilder.setContentTitle("String_Node_Str" + mProfile.mName);
  nbuilder.setContentText(msg);
  nbuilder.setOnlyAlertOnce(true);
  nbuilder.setOngoing(true);
  nbuilder.setContentIntent(getLogPendingIntent());
  nbuilder.setSmallIcon(icon);
  if (when != 0)   nbuilder.setWhen(when);
  jbNotificationExtras(lowpriority,nbuilder);
  if (tickerText != null)   nbuilder.setTicker(tickerText);
  Notification notification=nbuilder.getNotification();
  mNotificationManager.notify(OPENVPN_STATUS,notification);
  startForeground(OPENVPN_STATUS,notification);
}

Fixed version (ground truth):
private void showNotification(String msg,String tickerText,boolean lowpriority,long when){
  String ns=Context.NOTIFICATION_SERVICE;
  NotificationManager mNotificationManager=(NotificationManager)getSystemService(ns);
  int icon=R.drawable.ic_stat_vpn;
  android.app.Notification.Builder nbuilder=new Notification.Builder(this);
  nbuilder.setContentTitle("String_Node_Str" + mProfile.mName);
  nbuilder.setContentText(msg);
  nbuilder.setOnlyAlertOnce(true);
  nbuilder.setOngoing(true);
  nbuilder.setContentIntent(getLogPendingIntent());
  nbuilder.setSmallIcon(icon);
  if (when != 0)   nbuilder.setWhen(when);
  jbNotificationExtras(lowpriority,nbuilder);
  if (tickerText != null)   nbuilder.setTicker(tickerText);
  @SuppressWarnings("String_Node_Str") Notification notification=nbuilder.getNotification();
  mNotificationManager.notify(OPENVPN_STATUS,notification);
  startForeground(OPENVPN_STATUS,notification);
}
Program: 109716
Project: 109716
Buggy source:
private String embedFile(String filename,boolean base64encode){
  if (filename == null)   return null;
  if (filename.startsWith(VpnProfile.INLINE_TAG))   return filename;
  File possibleFile=findFile(filename);
  if (possibleFile == null)   return null;
 else   return readFileContent(possibleFile,base64encode);
}

Fixed version (ground truth):
private String embedFile(String filename,boolean base64encode){
  if (filename == null)   return null;
  if (filename.startsWith(VpnProfile.INLINE_TAG))   return filename;
  File possibleFile=findFile(filename);
  if (possibleFile == null)   return filename;
 else   return readFileContent(possibleFile,base64encode);
}
Program: 109717
Project: 109717
Buggy source:
private void startOpenVPNThreadArgs(String[] argv){
  LinkedList<String> argvlist=new LinkedList<String>();
  for (  String arg : argv)   argvlist.add(arg);
  ProcessBuilder pb=new ProcessBuilder(argvlist);
  String applibpath=argv[0].replace("String_Node_Str" + VpnProfile.MINIVPN,"String_Node_Str");
  String lbpath=pb.environment().get("String_Node_Str");
  if (lbpath == null)   lbpath=applibpath;
 else   lbpath=lbpath + "String_Node_Str" + applibpath;
  if (!applibpath.equals(mNativeDir)) {
    lbpath=lbpath + "String_Node_Str" + mNativeDir;
  }
  pb.environment().put("String_Node_Str",lbpath);
  pb.redirectErrorStream(true);
  try {
    mProcess=pb.start();
    mProcess.getOutputStream().close();
    InputStream in=mProcess.getInputStream();
    BufferedReader br=new BufferedReader(new InputStreamReader(in));
    while (true) {
      String logline=br.readLine();
      if (logline == null)       return;
      OpenVPN.logMessage(0,"String_Node_Str",logline);
    }
  }
 catch (  IOException e) {
    OpenVPN.logMessage(0,"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
    e.printStackTrace();
    stopProcess();
  }
}

Fixed version (ground truth):
private void startOpenVPNThreadArgs(String[] argv){
  LinkedList<String> argvlist=new LinkedList<String>();
  for (  String arg : argv)   argvlist.add(arg);
  ProcessBuilder pb=new ProcessBuilder(argvlist);
  String applibpath=argv[0].replace("String_Node_Str" + VpnProfile.MINIVPN,"String_Node_Str");
  String lbpath=pb.environment().get("String_Node_Str");
  if (lbpath == null)   lbpath=applibpath;
 else   lbpath=lbpath + "String_Node_Str" + applibpath;
  if (!applibpath.equals(mNativeDir)) {
    lbpath=lbpath + "String_Node_Str" + mNativeDir;
  }
  pb.environment().put("String_Node_Str",lbpath);
  pb.redirectErrorStream(true);
  try {
    mProcess=pb.start();
    mProcess.getOutputStream().close();
    InputStream in=mProcess.getInputStream();
    BufferedReader br=new BufferedReader(new InputStreamReader(in));
    while (true) {
      String logline=br.readLine();
      if (logline == null) {
        return;
      }
      OpenVPN.logMessage(0,"String_Node_Str",logline);
    }
  }
 catch (  IOException e) {
    OpenVPN.logMessage(0,"String_Node_Str","String_Node_Str" + e.getLocalizedMessage());
    e.printStackTrace();
    stopProcess();
  }
}
Program: 109718
Project: 109718
Buggy source:
@Override public void run(){
  try {
    Log.i(TAG,"String_Node_Str");
    startOpenVPNThreadArgs(mArgv);
    Log.i(TAG,"String_Node_Str");
  }
 catch (  Exception e) {
    Log.e(TAG,"String_Node_Str" + e.toString());
  }
 finally {
    int exitvalue=0;
    try {
      exitvalue=mProcess.exitValue();
    }
 catch (    IllegalThreadStateException ite) {
      OpenVPN.logError("String_Node_Str" + ite.getLocalizedMessage());
    }
    if (exitvalue != 0)     OpenVPN.logError("String_Node_Str" + exitvalue);
    OpenVPN.updateStateString("String_Node_Str","String_Node_Str");
    mService.processDied();
    Log.i(TAG,"String_Node_Str");
  }
}

Fixed version (ground truth):
@Override public void run(){
  try {
    Log.i(TAG,"String_Node_Str");
    startOpenVPNThreadArgs(mArgv);
    Log.i(TAG,"String_Node_Str");
  }
 catch (  Exception e) {
    Log.e(TAG,"String_Node_Str" + e.toString());
  }
 finally {
    int exitvalue=0;
    try {
      exitvalue=mProcess.waitFor();
    }
 catch (    IllegalThreadStateException ite) {
      OpenVPN.logError("String_Node_Str" + ite.getLocalizedMessage());
    }
catch (    InterruptedException ie) {
      OpenVPN.logError("String_Node_Str" + ie.getLocalizedMessage());
    }
    if (exitvalue != 0)     OpenVPN.logError("String_Node_Str" + exitvalue);
    OpenVPN.updateStateString("String_Node_Str","String_Node_Str");
    mService.processDied();
    Log.i(TAG,"String_Node_Str");
  }
}
Program: 109720
Project: 109720
Buggy source:
void embedFiles(){
  mResult.mCaFilename=embedFile(mResult.mCaFilename);
  mResult.mClientCertFilename=embedFile(mResult.mClientCertFilename);
  mResult.mClientKeyFilename=embedFile(mResult.mClientKeyFilename);
  mResult.mTLSAuthFilename=embedFile(mResult.mTLSAuthFilename);
  if (mResult.mUsername != null && !mResult.mUsername.equals("String_Node_Str")) {
    String data=embedFile(mResult.mUsername);
    mResult.mName=null;
    if (data != null) {
      data=data.replace(VpnProfile.INLINE_TAG,"String_Node_Str");
      String[] parts=data.split("String_Node_Str");
      if (parts.length >= 2) {
        mResult.mName=parts[0];
        mResult.mPassword=parts[1];
      }
    }
  }
}

Fixed version (ground truth):
void embedFiles(){
  mResult.mCaFilename=embedFile(mResult.mCaFilename);
  mResult.mClientCertFilename=embedFile(mResult.mClientCertFilename);
  mResult.mClientKeyFilename=embedFile(mResult.mClientKeyFilename);
  mResult.mTLSAuthFilename=embedFile(mResult.mTLSAuthFilename);
  if (mResult.mUsername != null && !mResult.mUsername.equals("String_Node_Str")) {
    String data=embedFile(mResult.mUsername);
    mResult.mUsername=null;
    if (data != null) {
      data=data.replace(VpnProfile.INLINE_TAG,"String_Node_Str");
      String[] parts=data.split("String_Node_Str");
      if (parts.length >= 2) {
        mResult.mUsername=parts[0];
        mResult.mPassword=parts[1];
      }
    }
  }
}
Program: 109721
Project: 109721
Buggy source:
private void releaseHoldCmd(){
  mWaitingForRelease=false;
  managmentCommand("String_Node_Str");
  managmentCommand("String_Node_Str" + mBytecountinterval + "String_Node_Str");
  managmentCommand("String_Node_Str");
}

Fixed version (ground truth):
private void releaseHoldCmd(){
  mWaitingForRelease=false;
  mReleaseHold=true;
  managmentCommand("String_Node_Str");
  managmentCommand("String_Node_Str" + mBytecountinterval + "String_Node_Str");
  managmentCommand("String_Node_Str");
}
Program: 109722
Project: 109722
Buggy source:
public static String openVpnEscape(String unescaped){
  if (unescaped == null)   return null;
  String escapedString=unescaped.replace("String_Node_Str","String_Node_Str");
  escapedString=escapedString.replace("String_Node_Str","String_Node_Str");
  escapedString=escapedString.replace("String_Node_Str","String_Node_Str");
  if (escapedString.equals(unescaped) && !escapedString.contains("String_Node_Str"))   return unescaped;
 else   return '"' + escapedString + '"';
}

Fixed version (ground truth):
public static String openVpnEscape(String unescaped){
  if (unescaped == null)   return null;
  String escapedString=unescaped.replace("String_Node_Str","String_Node_Str");
  escapedString=escapedString.replace("String_Node_Str","String_Node_Str");
  escapedString=escapedString.replace("String_Node_Str","String_Node_Str");
  if (escapedString.equals(unescaped) && !escapedString.contains("String_Node_Str") && !escapedString.contains("String_Node_Str"))   return unescaped;
 else   return '"' + escapedString + '"';
}
Program: 109723
Project: 109723
Buggy source:
private Notification showNotification(String msg,String tickerText){
  String ns=Context.NOTIFICATION_SERVICE;
  NotificationManager mNotificationManager=(NotificationManager)getSystemService(ns);
  int icon=R.drawable.ic_stat_vpn;
  long when=System.currentTimeMillis();
  android.app.Notification.Builder nbuilder=new Notification.Builder(this);
  nbuilder.setContentTitle("String_Node_Str" + mProfile.mName);
  nbuilder.setContentText(msg);
  nbuilder.setOnlyAlertOnce(true);
  nbuilder.setOngoing(true);
  nbuilder.setContentIntent(getLogPendingIntent());
  nbuilder.setSmallIcon(icon);
  nbuilder.setWhen(when);
  if (tickerText != null)   nbuilder.setTicker(tickerText);
  Notification notification=nbuilder.getNotification();
  mNotificationManager.notify(OPENVPN_STATUS,notification);
  return notification;
}

Fixed version (ground truth):
private Notification showNotification(String msg,String tickerText){
  String ns=Context.NOTIFICATION_SERVICE;
  NotificationManager mNotificationManager=(NotificationManager)getSystemService(ns);
  int icon=R.drawable.ic_stat_vpn;
  long when=System.currentTimeMillis();
  android.app.Notification.Builder nbuilder=new Notification.Builder(this);
  nbuilder.setContentTitle("String_Node_Str" + mProfile.mName);
  nbuilder.setContentText(msg);
  nbuilder.setOnlyAlertOnce(true);
  nbuilder.setOngoing(true);
  nbuilder.setContentIntent(getLogPendingIntent());
  nbuilder.setSmallIcon(icon);
  nbuilder.setWhen(when);
  if (tickerText != null)   nbuilder.setTicker(tickerText);
  Notification notification=nbuilder.getNotification();
  mNotificationManager.notify(OPENVPN_STATUS,notification);
  startForeground(OPENVPN_STATUS,notification);
  return notification;
}
Program: 109724
Project: 109724
Buggy source:
@Override public int onStartCommand(Intent intent,int flags,int startId){
  String prefix=getPackageName();
  String[] argv=intent.getStringArrayExtra(prefix + "String_Node_Str");
  String nativelibdir=intent.getStringExtra(prefix + "String_Node_Str");
  String profileUUID=intent.getStringExtra(prefix + "String_Node_Str");
  mProfile=ProfileManager.get(profileUUID);
  Notification start=showNotification("String_Node_Str" + mProfile.mName,null);
  startForeground(OPENVPN_STATUS,start);
  OpenVPN.addSpeedListener(this);
  if (OpenVpnManagementThread.stopOpenVPN()) {
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
    }
  }
  if (mProcessThread != null) {
    mProcessThread.interrupt();
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
    }
  }
  LocalServerSocket mgmtsocket=openManagmentInterface(8);
  if (mgmtsocket != null) {
    mSocketManager=new OpenVpnManagementThread(mProfile,mgmtsocket,this);
    mSocketManagerThread=new Thread(mSocketManager,"String_Node_Str");
    mSocketManagerThread.start();
    OpenVPN.logInfo("String_Node_Str");
    registerNetworkStateReceiver();
  }
  OpenVPNThread processThread=new OpenVPNThread(this,argv,nativelibdir);
  mProcessThread=new Thread(processThread,"String_Node_Str");
  mProcessThread.start();
  ProfileManager.setConnectedVpnProfile(this,mProfile);
  return START_NOT_STICKY;
}

Fixed version (ground truth):
@Override public int onStartCommand(Intent intent,int flags,int startId){
  String prefix=getPackageName();
  String[] argv=intent.getStringArrayExtra(prefix + "String_Node_Str");
  String nativelibdir=intent.getStringExtra(prefix + "String_Node_Str");
  String profileUUID=intent.getStringExtra(prefix + "String_Node_Str");
  mProfile=ProfileManager.get(profileUUID);
  showNotification("String_Node_Str" + mProfile.mName,null);
  OpenVPN.addSpeedListener(this);
  if (OpenVpnManagementThread.stopOpenVPN()) {
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
    }
  }
  if (mProcessThread != null) {
    mProcessThread.interrupt();
    try {
      Thread.sleep(1000);
    }
 catch (    InterruptedException e) {
    }
  }
  LocalServerSocket mgmtsocket=openManagmentInterface(8);
  if (mgmtsocket != null) {
    mSocketManager=new OpenVpnManagementThread(mProfile,mgmtsocket,this);
    mSocketManagerThread=new Thread(mSocketManager,"String_Node_Str");
    mSocketManagerThread.start();
    OpenVPN.logInfo("String_Node_Str");
    registerNetworkStateReceiver();
  }
  OpenVPNThread processThread=new OpenVPNThread(this,argv,nativelibdir);
  mProcessThread=new Thread(processThread,"String_Node_Str");
  mProcessThread.start();
  ProfileManager.setConnectedVpnProfile(this,mProfile);
  return START_NOT_STICKY;
}
Program: 109726
Project: 109726
Buggy source:
void embedFiles(){
  mResult.mCaFilename=VpnProfile.INLINE_TAG + embedFile(mResult.mCaFilename);
  mResult.mClientCertFilename=VpnProfile.INLINE_TAG + embedFile(mResult.mClientCertFilename);
  mResult.mClientKeyFilename=VpnProfile.INLINE_TAG + embedFile(mResult.mClientKeyFilename);
  mResult.mTLSAuthFilename=VpnProfile.INLINE_TAG + embedFile(mResult.mTLSAuthFilename);
  if (mResult.mUsername != null && !mResult.mUsername.equals("String_Node_Str")) {
    String data=embedFile(mResult.mUsername);
    mResult.mName=null;
    if (data != null) {
      String[] parts=data.split("String_Node_Str");
      if (parts.length >= 2) {
        mResult.mName=parts[0];
        mResult.mPassword=parts[1];
      }
    }
  }
}

Fixed version (ground truth):
void embedFiles(){
  mResult.mCaFilename=embedFile(mResult.mCaFilename);
  mResult.mClientCertFilename=embedFile(mResult.mClientCertFilename);
  mResult.mClientKeyFilename=embedFile(mResult.mClientKeyFilename);
  mResult.mTLSAuthFilename=embedFile(mResult.mTLSAuthFilename);
  if (mResult.mUsername != null && !mResult.mUsername.equals("String_Node_Str")) {
    String data=embedFile(mResult.mUsername);
    mResult.mName=null;
    if (data != null) {
      data=data.replace(VpnProfile.INLINE_TAG,"String_Node_Str");
      String[] parts=data.split("String_Node_Str");
      if (parts.length >= 2) {
        mResult.mName=parts[0];
        mResult.mPassword=parts[1];
      }
    }
  }
}
Program: 109727
Project: 109727
Buggy source:
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  final Intent intent=getIntent();
  final String action=intent.getAction();
  mPM=ProfileManager.getInstance(this);
  if (Intent.ACTION_MAIN.equals(action)) {
    String shortcutUUID=intent.getStringExtra(EXTRA_KEY);
    VpnProfile profileToConnect=ProfileManager.get(shortcutUUID);
    if (profileToConnect == null) {
      Toast notfound=Toast.makeText(this,R.string.shortcut_profile_notfound,Toast.LENGTH_SHORT);
      notfound.show();
      finish();
      return;
    }
    mSelectedProfile=profileToConnect;
    launchVPN();
  }
 else   if (Intent.ACTION_CREATE_SHORTCUT.equals(action)) {
    createListView();
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle icicle){
  super.onCreate(icicle);
  mPM=ProfileManager.getInstance(this);
}
Program: 109728
Project: 109728
Buggy source:
private String cidrToIPAndNetmask(String route){
  String[] parts=route.split("String_Node_Str");
  if (parts.length == 1)   return route;
  if (parts.length != 2)   return null;
  int len;
  try {
    len=Integer.parseInt(parts[1]);
  }
 catch (  NumberFormatException ne) {
    return null;
  }
  if (len < 0 || len > 32)   return null;
  long nm=0xffffffffl;
  nm=(nm << (32 - len)) & 0xffffffffl;
  String netmask=String.format("String_Node_Str",(nm & 0xff000000) >> 24,(nm & 0xff0000) >> 16,(nm & 0xff00) >> 8,nm & 0xff);
  return parts[0] + "String_Node_Str" + netmask;
}

Fixed version (ground truth):
private String cidrToIPAndNetmask(String route){
  String[] parts=route.split("String_Node_Str");
  if (parts.length == 1)   parts=(route + "String_Node_Str").split("String_Node_Str");
  if (parts.length != 2)   return null;
  int len;
  try {
    len=Integer.parseInt(parts[1]);
  }
 catch (  NumberFormatException ne) {
    return null;
  }
  if (len < 0 || len > 32)   return null;
  long nm=0xffffffffl;
  nm=(nm << (32 - len)) & 0xffffffffl;
  String netmask=String.format("String_Node_Str",(nm & 0xff000000) >> 24,(nm & 0xff0000) >> 16,(nm & 0xff00) >> 8,nm & 0xff);
  return parts[0] + "String_Node_Str" + netmask;
}
Program: 109729
Project: 109729
Buggy source:
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.config);
  OpenVPN.foo();
  mServerAddress=(TextView)findViewById(R.id.address);
  mServerPort=(TextView)findViewById(R.id.port);
  mClientCert=(FileSelectLayout)findViewById(R.id.certselect);
  mClientKey=(FileSelectLayout)findViewById(R.id.keyselect);
  mCaCert=(FileSelectLayout)findViewById(R.id.certselect);
  mpkcs12=(FileSelectLayout)findViewById(R.id.pkcs12select);
  mUseLzo=(CheckBox)findViewById(R.id.lzo);
  mTcpUdp=(ToggleButton)findViewById(id.tcpudp);
  mType=(Spinner)findViewById(R.id.type);
  mPKCS12Password=(TextView)findViewById(R.id.pkcs12password);
  mAliasName=(TextView)findViewById(R.id.aliasname);
  mUseTlsAuth=(CheckBox)findViewById(R.id.useTLSAuth);
  mTLSDirection=(Spinner)findViewById(R.id.tls_direction);
  mShowAdvanced=(CheckBox)findViewById(R.id.show_advanced);
  mTlsFile=(FileSelectLayout)findViewById(R.id.tlsAuth);
  addFileSelectLayout(mCaCert);
  addFileSelectLayout(mClientCert);
  addFileSelectLayout(mClientKey);
  addFileSelectLayout(mTlsFile);
  addFileSelectLayout(mpkcs12);
  loadPreferences();
  mType.setOnItemSelectedListener(this);
  mShowAdvanced.setOnCheckedChangeListener(this);
  mUseTlsAuth.setOnCheckedChangeListener(this);
  findViewById(R.id.select_keystore_button).setOnClickListener(this);
  findViewById(R.id.about).setOnClickListener(this);
  findViewById(R.id.connect).setOnClickListener(this);
  if (mHandler == null) {
    mHandler=new Handler(this);
  }
}

Fixed version (ground truth):
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.config);
  OpenVPN.foo();
  mServerAddress=(TextView)findViewById(R.id.address);
  mServerPort=(TextView)findViewById(R.id.port);
  mClientCert=(FileSelectLayout)findViewById(R.id.certselect);
  mClientKey=(FileSelectLayout)findViewById(R.id.keyselect);
  mCaCert=(FileSelectLayout)findViewById(R.id.caselect);
  mpkcs12=(FileSelectLayout)findViewById(R.id.pkcs12select);
  mUseLzo=(CheckBox)findViewById(R.id.lzo);
  mTcpUdp=(ToggleButton)findViewById(id.tcpudp);
  mType=(Spinner)findViewById(R.id.type);
  mPKCS12Password=(TextView)findViewById(R.id.pkcs12password);
  mAliasName=(TextView)findViewById(R.id.aliasname);
  mUseTlsAuth=(CheckBox)findViewById(R.id.useTLSAuth);
  mTLSDirection=(Spinner)findViewById(R.id.tls_direction);
  mShowAdvanced=(CheckBox)findViewById(R.id.show_advanced);
  mTlsFile=(FileSelectLayout)findViewById(R.id.tlsAuth);
  addFileSelectLayout(mCaCert);
  addFileSelectLayout(mClientCert);
  addFileSelectLayout(mClientKey);
  addFileSelectLayout(mTlsFile);
  addFileSelectLayout(mpkcs12);
  loadPreferences();
  mType.setOnItemSelectedListener(this);
  mShowAdvanced.setOnCheckedChangeListener(this);
  mUseTlsAuth.setOnCheckedChangeListener(this);
  findViewById(R.id.select_keystore_button).setOnClickListener(this);
  findViewById(R.id.about).setOnClickListener(this);
  findViewById(R.id.connect).setOnClickListener(this);
  if (mHandler == null) {
    mHandler=new Handler(this);
  }
}
Program: 109730
Project: 109730
Buggy source:
public static Properties getKafkaConfigProperties(Context context){
  Properties props=new Properties();
  String contextString=context.toString();
  for (  final String kv : contextString.substring(14,contextString.length() - 3).split("String_Node_Str")) {
    log.info("String_Node_Str" + kv);
    String k=kv.trim().split("String_Node_Str")[0];
    log.info("String_Node_Str" + k);
    String v=kv.trim().split("String_Node_Str")[1];
    log.info("String_Node_Str" + v);
    if (!k.equals("String_Node_Str") && !k.equals("String_Node_Str")) {
      props.put(k,v);
    }
  }
  log.info("String_Node_Str" + props);
  return props;
}

Fixed version (ground truth):
public static Properties getKafkaConfigProperties(Context context){
  Properties props=new Properties();
  String contextString=context.toString();
  for (  final String kv : contextString.substring(14,contextString.length() - 3).split("String_Node_Str")) {
    String k=kv.trim().split("String_Node_Str")[0];
    String v=kv.trim().split("String_Node_Str")[1];
    log.info("String_Node_Str" + k + "String_Node_Str"+ v);
    if (!k.equals("String_Node_Str") && !k.equals("String_Node_Str")) {
      props.put(k,v);
    }
  }
  log.info("String_Node_Str" + props);
  return props;
}