Program: 20251
Project: 20251
Buggy source:
@Override public void execute(PaymentInfoMagcard payinfo){
  StringBuffer sb=new StringBuffer();
  try {
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append(URLEncoder.encode(m_sCommerceID,"String_Node_Str"));
    sb.append("String_Node_Str");
    sb.append(URLEncoder.encode(m_sCommercePassword,"String_Node_Str"));
    sb.append("String_Node_Str");
    NumberFormat formatter=new DecimalFormat("String_Node_Str");
    String amount=formatter.format(Math.abs(payinfo.getTotal()));
    sb.append(URLEncoder.encode(amount.replace(',','.'),"String_Node_Str"));
    if (payinfo.getTrack1(true) == null && payinfo.getTrack2(true) == null && payinfo.getTrack3(true) == null) {
      sb.append("String_Node_Str");
      sb.append(URLEncoder.encode(payinfo.getCardNumber(),"String_Node_Str"));
      sb.append("String_Node_Str");
      String tmp=payinfo.getExpirationDate();
      sb.append(URLEncoder.encode(tmp,"String_Node_Str"));
      String[] cc_name=payinfo.getHolderName().split("String_Node_Str");
      sb.append("String_Node_Str");
      if (cc_name.length > 0) {
        sb.append(URLEncoder.encode(cc_name[0],"String_Node_Str"));
      }
      sb.append("String_Node_Str");
      if (cc_name.length > 1) {
        sb.append(URLEncoder.encode(cc_name[1],"String_Node_Str"));
      }
    }
 else {
      sb.append("String_Node_Str");
      sb.append(payinfo.getTrack1(false));
    }
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append(m_bTestMode);
    if (payinfo.getTotal() >= 0.0) {
      sb.append("String_Node_Str");
      sb.append(OPERATIONVALIDATE);
    }
 else {
      sb.append("String_Node_Str");
      sb.append(OPERATIONREFUND);
      sb.append("String_Node_Str");
      sb.append(payinfo.getTransactionID());
    }
    URL url=new URL(ENDPOINTADDRESS);
    URLConnection connection=url.openConnection();
    connection.setDoOutput(true);
    connection.setUseCaches(false);
    connection.setRequestProperty("String_Node_Str","String_Node_Str");
    DataOutputStream out=new DataOutputStream(connection.getOutputStream());
    out.write(sb.toString().getBytes());
    out.flush();
    out.close();
    BufferedReader in=new BufferedReader(new InputStreamReader(connection.getInputStream()));
    String returned=in.readLine();
    in.close();
    AuthorizeNetParser anp=new AuthorizeNetParser(returned);
    Map props=anp.splitXML();
    if (anp.getResult().equals(LocalRes.getIntString("String_Node_Str"))) {
      if (APPROVED.equals(props.get("String_Node_Str"))) {
        payinfo.paymentOK((String)props.get("String_Node_Str"),(String)props.get("String_Node_Str"),returned);
      }
 else {
        StringBuilder errorLine=new StringBuilder();
        if (anp.getNumErrors() > 0) {
          for (int i=1; i <= anp.getNumErrors(); i++) {
            errorLine.append(props.get("String_Node_Str" + Integer.toString(i)));
            errorLine.append("String_Node_Str");
            errorLine.append(props.get("String_Node_Str" + Integer.toString(i)));
            errorLine.append("String_Node_Str");
          }
        }
        payinfo.paymentError(AppLocal.getIntString("String_Node_Str"),errorLine.toString());
      }
    }
 else {
      payinfo.paymentError(anp.getResult(),"String_Node_Str");
    }
  }
 catch (  UnsupportedEncodingException eUE) {
    payinfo.paymentError(AppLocal.getIntString("String_Node_Str"),eUE.getMessage());
  }
catch (  MalformedURLException eMURL) {
    payinfo.paymentError(AppLocal.getIntString("String_Node_Str"),eMURL.getMessage());
  }
catch (  IOException e) {
    payinfo.paymentError(AppLocal.getIntString("String_Node_Str"),e.getMessage());
  }
}

Fixed version (ground truth):
@Override public void execute(PaymentInfoMagcard payinfo){
  StringBuffer sb=new StringBuffer();
  try {
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append(URLEncoder.encode(m_sCommerceID,"String_Node_Str"));
    sb.append("String_Node_Str");
    sb.append(URLEncoder.encode(m_sCommercePassword,"String_Node_Str"));
    sb.append("String_Node_Str");
    NumberFormat formatter=new DecimalFormat("String_Node_Str");
    String amount=formatter.format(Math.abs(payinfo.getTotal()));
    sb.append(URLEncoder.encode(amount.replace(',','.'),"String_Node_Str"));
    if (payinfo.getTrack1(true) == null) {
      sb.append("String_Node_Str");
      sb.append(URLEncoder.encode(payinfo.getCardNumber(),"String_Node_Str"));
      sb.append("String_Node_Str");
      String tmp=payinfo.getExpirationDate();
      sb.append(URLEncoder.encode(tmp,"String_Node_Str"));
      String[] cc_name=payinfo.getHolderName().split("String_Node_Str");
      sb.append("String_Node_Str");
      if (cc_name.length > 0) {
        sb.append(URLEncoder.encode(cc_name[0],"String_Node_Str"));
      }
      sb.append("String_Node_Str");
      if (cc_name.length > 1) {
        sb.append(URLEncoder.encode(cc_name[1],"String_Node_Str"));
      }
    }
 else {
      sb.append("String_Node_Str");
      sb.append(payinfo.getTrack1(false));
    }
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append("String_Node_Str");
    sb.append(m_bTestMode);
    if (payinfo.getTotal() >= 0.0) {
      sb.append("String_Node_Str");
      sb.append(OPERATIONVALIDATE);
    }
 else {
      sb.append("String_Node_Str");
      sb.append(OPERATIONREFUND);
      sb.append("String_Node_Str");
      sb.append(payinfo.getTransactionID());
    }
    URL url=new URL(ENDPOINTADDRESS);
    URLConnection connection=url.openConnection();
    connection.setDoOutput(true);
    connection.setUseCaches(false);
    connection.setRequestProperty("String_Node_Str","String_Node_Str");
    DataOutputStream out=new DataOutputStream(connection.getOutputStream());
    out.write(sb.toString().getBytes());
    out.flush();
    out.close();
    BufferedReader in=new BufferedReader(new InputStreamReader(connection.getInputStream()));
    String returned=in.readLine();
    in.close();
    AuthorizeNetParser anp=new AuthorizeNetParser(returned);
    Map props=anp.splitXML();
    if (anp.getResult().equals(LocalRes.getIntString("String_Node_Str"))) {
      if (APPROVED.equals(props.get("String_Node_Str"))) {
        payinfo.paymentOK((String)props.get("String_Node_Str"),(String)props.get("String_Node_Str"),returned);
      }
 else {
        StringBuilder errorLine=new StringBuilder();
        if (anp.getNumErrors() > 0) {
          for (int i=1; i <= anp.getNumErrors(); i++) {
            errorLine.append(props.get("String_Node_Str" + Integer.toString(i)));
            errorLine.append("String_Node_Str");
            errorLine.append(props.get("String_Node_Str" + Integer.toString(i)));
            errorLine.append("String_Node_Str");
          }
        }
        payinfo.paymentError(AppLocal.getIntString("String_Node_Str"),errorLine.toString());
      }
    }
 else {
      payinfo.paymentError(anp.getResult(),"String_Node_Str");
    }
  }
 catch (  UnsupportedEncodingException eUE) {
    payinfo.paymentError(AppLocal.getIntString("String_Node_Str"),eUE.getMessage());
  }
catch (  MalformedURLException eMURL) {
    payinfo.paymentError(AppLocal.getIntString("String_Node_Str"),eMURL.getMessage());
  }
catch (  IOException e) {
    payinfo.paymentError(AppLocal.getIntString("String_Node_Str"),e.getMessage());
  }
}