Program: 94570
Project: 94570
Buggy source:
public ServerCode HTTPSendFile(String surl,String file1){
  this.log.debug("String_Node_Str" + surl + "String_Node_Str"+ file1+ "String_Node_Str");
  HttpURLConnection conn=null;
  DataOutputStream dos=null;
  BufferedReader inStream=null;
  String exsistingFileName=file1;
  File fFile2Snd=new File(exsistingFileName);
  String lineEnd="String_Node_Str";
  String twoHyphens="String_Node_Str";
  String boundary="String_Node_Str";
  int bytesRead, bytesAvailable, bufferSize;
  byte[] buffer;
  int maxBufferSize=1 * 1024 * 1024;
  String urlString=surl;
  try {
    FileInputStream fileInputStream=new FileInputStream(new File(exsistingFileName));
    URL url=new URL(urlString);
    conn=(HttpURLConnection)url.openConnection();
    conn.setDoInput(true);
    conn.setDoOutput(true);
    conn.setUseCaches(false);
    for (    String cookie : this.cookies) {
      conn.setRequestProperty("String_Node_Str",cookie);
    }
    conn.setRequestMethod("String_Node_Str");
    conn.setRequestProperty("String_Node_Str","String_Node_Str");
    conn.setRequestProperty("String_Node_Str","String_Node_Str" + boundary);
    if (urlString.startsWith("String_Node_Str")) {
      try {
        SSLContext sc;
        sc=SSLContext.getInstance("String_Node_Str");
        sc.init(null,new TrustManager[]{this},null);
        SSLSocketFactory factory=sc.getSocketFactory();
        ((HttpsURLConnection)conn).setSSLSocketFactory(factory);
        ((HttpsURLConnection)conn).setHostnameVerifier(this);
      }
 catch (      NoSuchAlgorithmException e) {
        this.log.error("String_Node_Str" + e);
        try {
          fileInputStream.close();
        }
 catch (        Exception e1) {
        }
        return ServerCode.UNKNOWN;
      }
catch (      KeyManagementException e) {
        this.log.error("String_Node_Str" + e);
        try {
          fileInputStream.close();
        }
 catch (        Exception e1) {
        }
        return ServerCode.UNKNOWN;
      }
    }
    dos=new DataOutputStream(conn.getOutputStream());
    dos.writeBytes(twoHyphens + boundary + lineEnd);
    dos.writeBytes("String_Node_Str" + "String_Node_Str" + fFile2Snd.getName() + "String_Node_Str"+ lineEnd);
    dos.writeBytes(lineEnd);
    bytesAvailable=fileInputStream.available();
    bufferSize=Math.min(bytesAvailable,maxBufferSize);
    buffer=new byte[bufferSize];
    bytesRead=fileInputStream.read(buffer,0,bufferSize);
    while (bytesRead > 0) {
      dos.write(buffer,0,bufferSize);
      bytesAvailable=fileInputStream.available();
      bufferSize=Math.min(bytesAvailable,maxBufferSize);
      bytesRead=fileInputStream.read(buffer,0,bufferSize);
    }
    dos.writeBytes(lineEnd);
    dos.writeBytes(twoHyphens + boundary + twoHyphens+ lineEnd);
    fileInputStream.close();
    dos.flush();
    dos.close();
  }
 catch (  MalformedURLException ex) {
    this.log.error("String_Node_Str" + ex);
    return ServerCode.UNKNOWN;
  }
catch (  IOException ioe) {
    this.log.error("String_Node_Str" + ioe);
    return ServerCode.UNKNOWN;
  }
catch (  Exception e6) {
    this.log.error("String_Node_Str" + e6);
    return ServerCode.UNKNOWN;
  }
  int r;
  try {
    r=conn.getResponseCode();
  }
 catch (  IOException e1) {
    e1.printStackTrace();
    return ServerCode.UNKNOWN;
  }
  String contentType=conn.getContentType();
  if (r == HttpURLConnection.HTTP_OK && contentType.startsWith("String_Node_Str")) {
    DataInputStream in;
    try {
      in=new DataInputStream(conn.getInputStream());
    }
 catch (    IOException e1) {
      e1.printStackTrace();
      return ServerCode.UNKNOWN;
    }
    Document document=null;
    try {
      document=DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in);
    }
 catch (    SAXException e) {
      e.printStackTrace();
      return ServerCode.UNKNOWN;
    }
catch (    IOException e) {
      e.printStackTrace();
      return ServerCode.UNKNOWN;
    }
catch (    ParserConfigurationException e) {
      e.printStackTrace();
      return ServerCode.UNKNOWN;
    }
    this.lastRequestTime=new Date().getTime();
    ServerCode ret1=Utils.statusIsOK(document,"String_Node_Str");
    if (ret1 != ServerCode.OK) {
      this.log.error("String_Node_Str" + ret1 + "String_Node_Str");
      return ret1;
    }
    return ServerCode.OK;
  }
 else   if (r == HttpURLConnection.HTTP_OK && contentType.startsWith("String_Node_Str")) {
    return ServerCode.ERROR_BAD_RESPONSE;
  }
 else {
    try {
      inStream=new BufferedReader(new InputStreamReader(conn.getInputStream()));
      String str;
      while ((str=inStream.readLine()) != null) {
        System.out.println(str);
        System.out.println("String_Node_Str");
      }
      inStream.close();
    }
 catch (    IOException ioex) {
    }
  }
  return ServerCode.UNKNOWN;
}

Fixed version (ground truth):
public ServerCode HTTPSendFile(String surl,String file1){
  this.log.debug("String_Node_Str" + surl + "String_Node_Str"+ file1+ "String_Node_Str");
  HttpURLConnection conn=null;
  DataOutputStream dos=null;
  BufferedReader inStream=null;
  String exsistingFileName=file1;
  File fFile2Snd=new File(exsistingFileName);
  String lineEnd="String_Node_Str";
  String twoHyphens="String_Node_Str";
  String boundary="String_Node_Str";
  int bytesRead, bytesAvailable, bufferSize;
  byte[] buffer;
  int maxBufferSize=1 * 1024 * 1024;
  String urlString=surl;
  try {
    FileInputStream fileInputStream=new FileInputStream(new File(exsistingFileName));
    URL url=new URL(urlString);
    conn=(HttpURLConnection)url.openConnection();
    conn.setDoInput(true);
    conn.setDoOutput(true);
    conn.setUseCaches(false);
    for (    String cookie : this.cookies) {
      conn.setRequestProperty("String_Node_Str",cookie);
    }
    conn.setRequestMethod("String_Node_Str");
    conn.setRequestProperty("String_Node_Str","String_Node_Str");
    conn.setRequestProperty("String_Node_Str","String_Node_Str" + boundary);
    if (urlString.startsWith("String_Node_Str")) {
      try {
        SSLContext sc;
        sc=SSLContext.getInstance("String_Node_Str");
        sc.init(null,new TrustManager[]{this},null);
        SSLSocketFactory factory=sc.getSocketFactory();
        ((HttpsURLConnection)conn).setSSLSocketFactory(factory);
        ((HttpsURLConnection)conn).setHostnameVerifier(this);
      }
 catch (      NoSuchAlgorithmException e) {
        this.log.error("String_Node_Str" + e);
        try {
          fileInputStream.close();
        }
 catch (        Exception e1) {
        }
        return ServerCode.UNKNOWN;
      }
catch (      KeyManagementException e) {
        this.log.error("String_Node_Str" + e);
        try {
          fileInputStream.close();
        }
 catch (        Exception e1) {
        }
        return ServerCode.UNKNOWN;
      }
    }
    dos=new DataOutputStream(conn.getOutputStream());
    dos.writeBytes(twoHyphens + boundary + lineEnd);
    dos.writeBytes("String_Node_Str" + "String_Node_Str" + fFile2Snd.getName() + "String_Node_Str"+ lineEnd);
    dos.writeBytes(lineEnd);
    bytesAvailable=fileInputStream.available();
    bufferSize=Math.min(bytesAvailable,maxBufferSize);
    buffer=new byte[bufferSize];
    bytesRead=fileInputStream.read(buffer,0,bufferSize);
    while (bytesRead > 0) {
      dos.write(buffer,0,bufferSize);
      bytesAvailable=fileInputStream.available();
      bufferSize=Math.min(bytesAvailable,maxBufferSize);
      bytesRead=fileInputStream.read(buffer,0,bufferSize);
    }
    dos.writeBytes(lineEnd);
    dos.writeBytes(twoHyphens + boundary + twoHyphens+ lineEnd);
    fileInputStream.close();
    dos.flush();
    dos.close();
  }
 catch (  MalformedURLException ex) {
    this.log.error("String_Node_Str" + ex);
    return ServerCode.UNKNOWN;
  }
catch (  IOException ioe) {
    this.log.error("String_Node_Str" + ioe);
    return ServerCode.UNKNOWN;
  }
catch (  Exception e6) {
    this.log.error("String_Node_Str" + e6);
    return ServerCode.UNKNOWN;
  }
catch (  OutOfMemoryError e6) {
    this.log.error("String_Node_Str" + e6);
    return ServerCode.JOB_VALIDATION_ERROR_UPLOAD_FAILED;
  }
  int r;
  try {
    r=conn.getResponseCode();
  }
 catch (  IOException e1) {
    e1.printStackTrace();
    return ServerCode.UNKNOWN;
  }
  String contentType=conn.getContentType();
  if (r == HttpURLConnection.HTTP_OK && contentType.startsWith("String_Node_Str")) {
    DataInputStream in;
    try {
      in=new DataInputStream(conn.getInputStream());
    }
 catch (    IOException e1) {
      e1.printStackTrace();
      return ServerCode.UNKNOWN;
    }
    Document document=null;
    try {
      document=DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(in);
    }
 catch (    SAXException e) {
      e.printStackTrace();
      return ServerCode.UNKNOWN;
    }
catch (    IOException e) {
      e.printStackTrace();
      return ServerCode.UNKNOWN;
    }
catch (    ParserConfigurationException e) {
      e.printStackTrace();
      return ServerCode.UNKNOWN;
    }
    this.lastRequestTime=new Date().getTime();
    ServerCode ret1=Utils.statusIsOK(document,"String_Node_Str");
    if (ret1 != ServerCode.OK) {
      this.log.error("String_Node_Str" + ret1 + "String_Node_Str");
      return ret1;
    }
    return ServerCode.OK;
  }
 else   if (r == HttpURLConnection.HTTP_OK && contentType.startsWith("String_Node_Str")) {
    return ServerCode.ERROR_BAD_RESPONSE;
  }
 else {
    try {
      inStream=new BufferedReader(new InputStreamReader(conn.getInputStream()));
      String str;
      while ((str=inStream.readLine()) != null) {
        System.out.println(str);
        System.out.println("String_Node_Str");
      }
      inStream.close();
    }
 catch (    IOException ioex) {
    }
  }
  return ServerCode.UNKNOWN;
}