Program: 116890
Project: 116890
Buggy source:
protected long proxyPlainTextRequest(final URL url,String pathInContext,String pathParams,HttpRequest request,final HttpResponse response) throws IOException {
  try {
    String urlStr=url.toString();
    if (urlStr.toLowerCase().startsWith(Constants.ODO_INTERNAL_WEBAPP_URL)) {
      urlStr="String_Node_Str" + com.groupon.odo.proxylib.Utils.getSystemPort(Constants.SYS_HTTP_PORT) + "String_Node_Str";
    }
    OkHttpClient okHttpClient=getUnsafeOkHttpClient();
    okHttpClient.setFollowRedirects(false);
    okHttpClient.setFollowSslRedirects(false);
    Request.Builder okRequestBuilder=new Request.Builder();
    if (urlStr.startsWith("String_Node_Str")) {
      int httpPort=com.groupon.odo.proxylib.Utils.getSystemPort(Constants.SYS_HTTP_PORT);
      urlStr=urlStr.replace(getHostNameFromURL(urlStr),localIP + "String_Node_Str" + httpPort);
    }
    okRequestBuilder=okRequestBuilder.url(urlStr);
    Enumeration<?> enm=request.getFieldNames();
    boolean isGet="String_Node_Str".equals(request.getMethod());
    boolean hasContent=false;
    boolean usedContentLength=false;
    long contentLength=0;
    while (enm.hasMoreElements()) {
      String hdr=(String)enm.nextElement();
      if (!isGet && HttpFields.__ContentType.equals(hdr)) {
        hasContent=true;
      }
      if (!isGet && HttpFields.__ContentLength.equals(hdr)) {
        contentLength=Long.parseLong(request.getField(hdr));
        usedContentLength=true;
      }
      Enumeration<?> vals=request.getFieldValues(hdr);
      while (vals.hasMoreElements()) {
        String val=(String)vals.nextElement();
        if (val != null) {
          if (!isGet && HttpFields.__ContentLength.equals(hdr) && Integer.parseInt(val) > 0) {
            hasContent=true;
          }
          if (!_DontProxyHeaders.containsKey(hdr)) {
            okRequestBuilder=okRequestBuilder.addHeader(hdr,val);
          }
        }
      }
    }
    if ("String_Node_Str".equals(request.getMethod())) {
    }
 else     if ("String_Node_Str".equals(request.getMethod()) || "String_Node_Str".equals(request.getMethod()) || "String_Node_Str".equals(request.getMethod())) {
      RequestBody okRequestBody=null;
      if (hasContent) {
        final String contentType=request.getContentType();
        final byte[] bytes=IOUtils.toByteArray(request.getInputStream());
        okRequestBody=new RequestBody(){
          @Override public MediaType contentType(){
            MediaType.parse(contentType);
            return null;
          }
          @Override public void writeTo(          BufferedSink bufferedSink) throws IOException {
            bufferedSink.write(bytes);
          }
        }
;
        if (usedContentLength) {
          okRequestBuilder=okRequestBuilder.addHeader("String_Node_Str","String_Node_Str" + contentLength);
        }
      }
 else {
        okRequestBody=RequestBody.create(null,new byte[0]);
      }
      if ("String_Node_Str".equals(request.getMethod())) {
        okRequestBuilder=okRequestBuilder.post(okRequestBody);
      }
 else       if ("String_Node_Str".equals(request.getMethod())) {
        okRequestBuilder=okRequestBuilder.put(okRequestBody);
      }
 else       if ("String_Node_Str".equals(request.getMethod())) {
        okRequestBuilder=okRequestBuilder.delete(okRequestBody);
      }
    }
 else     if ("String_Node_Str".equals(request.getMethod())) {
    }
 else     if ("String_Node_Str".equals(request.getMethod())) {
      okRequestBuilder=okRequestBuilder.head();
    }
 else {
      LOG.warn("String_Node_Str",request.getMethod());
      request.setHandled(true);
      return -1;
    }
    Request okRequest=okRequestBuilder.build();
    Response okResponse=okHttpClient.newCall(okRequest).execute();
    response.setStatus(okResponse.code());
    response.setReason(okResponse.message());
    for (int headerNum=0; headerNum < okResponse.headers().size(); headerNum++) {
      String headerName=okResponse.headers().name(headerNum);
      if (!_DontProxyHeaders.containsKey(headerName) && !_ProxyAuthHeaders.containsKey(headerName)) {
        response.addField(headerName,okResponse.headers().value(headerNum));
      }
    }
    try {
      IOUtils.copy(okResponse.body().byteStream(),response.getOutputStream());
    }
 catch (    Exception e) {
    }
    request.setHandled(true);
    return okResponse.body().contentLength();
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str",e);
    reportError(e,url,response);
    request.setHandled(true);
    return -1;
  }
}

Fixed version (ground truth):
protected long proxyPlainTextRequest(final URL url,String pathInContext,String pathParams,HttpRequest request,final HttpResponse response) throws IOException {
  try {
    String urlStr=url.toString();
    if (urlStr.toLowerCase().startsWith(Constants.ODO_INTERNAL_WEBAPP_URL)) {
      urlStr="String_Node_Str" + com.groupon.odo.proxylib.Utils.getSystemPort(Constants.SYS_HTTP_PORT) + "String_Node_Str";
    }
    OkHttpClient okHttpClient=getUnsafeOkHttpClient();
    okHttpClient.setFollowRedirects(false);
    okHttpClient.setFollowSslRedirects(false);
    Request.Builder okRequestBuilder=new Request.Builder();
    if (urlStr.startsWith("String_Node_Str") && urlStr.indexOf("String_Node_Str") == urlStr.lastIndexOf("String_Node_Str")) {
      int httpPort=com.groupon.odo.proxylib.Utils.getSystemPort(Constants.SYS_HTTP_PORT);
      urlStr=urlStr.replace(getHostNameFromURL(urlStr),localIP + "String_Node_Str" + httpPort);
    }
    okRequestBuilder=okRequestBuilder.url(urlStr);
    Enumeration<?> enm=request.getFieldNames();
    boolean isGet="String_Node_Str".equals(request.getMethod());
    boolean hasContent=false;
    boolean usedContentLength=false;
    long contentLength=0;
    while (enm.hasMoreElements()) {
      String hdr=(String)enm.nextElement();
      if (!isGet && HttpFields.__ContentType.equals(hdr)) {
        hasContent=true;
      }
      if (!isGet && HttpFields.__ContentLength.equals(hdr)) {
        contentLength=Long.parseLong(request.getField(hdr));
        usedContentLength=true;
      }
      Enumeration<?> vals=request.getFieldValues(hdr);
      while (vals.hasMoreElements()) {
        String val=(String)vals.nextElement();
        if (val != null) {
          if (!isGet && HttpFields.__ContentLength.equals(hdr) && Integer.parseInt(val) > 0) {
            hasContent=true;
          }
          if (!_DontProxyHeaders.containsKey(hdr)) {
            okRequestBuilder=okRequestBuilder.addHeader(hdr,val);
          }
        }
      }
    }
    if ("String_Node_Str".equals(request.getMethod())) {
    }
 else     if ("String_Node_Str".equals(request.getMethod()) || "String_Node_Str".equals(request.getMethod()) || "String_Node_Str".equals(request.getMethod())) {
      RequestBody okRequestBody=null;
      if (hasContent) {
        final String contentType=request.getContentType();
        final byte[] bytes=IOUtils.toByteArray(request.getInputStream());
        okRequestBody=new RequestBody(){
          @Override public MediaType contentType(){
            MediaType.parse(contentType);
            return null;
          }
          @Override public void writeTo(          BufferedSink bufferedSink) throws IOException {
            bufferedSink.write(bytes);
          }
        }
;
        if (usedContentLength) {
          okRequestBuilder=okRequestBuilder.addHeader("String_Node_Str","String_Node_Str" + contentLength);
        }
      }
 else {
        okRequestBody=RequestBody.create(null,new byte[0]);
      }
      if ("String_Node_Str".equals(request.getMethod())) {
        okRequestBuilder=okRequestBuilder.post(okRequestBody);
      }
 else       if ("String_Node_Str".equals(request.getMethod())) {
        okRequestBuilder=okRequestBuilder.put(okRequestBody);
      }
 else       if ("String_Node_Str".equals(request.getMethod())) {
        okRequestBuilder=okRequestBuilder.delete(okRequestBody);
      }
    }
 else     if ("String_Node_Str".equals(request.getMethod())) {
    }
 else     if ("String_Node_Str".equals(request.getMethod())) {
      okRequestBuilder=okRequestBuilder.head();
    }
 else {
      LOG.warn("String_Node_Str",request.getMethod());
      request.setHandled(true);
      return -1;
    }
    Request okRequest=okRequestBuilder.build();
    Response okResponse=okHttpClient.newCall(okRequest).execute();
    response.setStatus(okResponse.code());
    response.setReason(okResponse.message());
    for (int headerNum=0; headerNum < okResponse.headers().size(); headerNum++) {
      String headerName=okResponse.headers().name(headerNum);
      if (!_DontProxyHeaders.containsKey(headerName) && !_ProxyAuthHeaders.containsKey(headerName)) {
        response.addField(headerName,okResponse.headers().value(headerNum));
      }
    }
    try {
      IOUtils.copy(okResponse.body().byteStream(),response.getOutputStream());
    }
 catch (    Exception e) {
    }
    request.setHandled(true);
    return okResponse.body().contentLength();
  }
 catch (  Exception e) {
    LOG.warn("String_Node_Str",e);
    reportError(e,url,response);
    request.setHandled(true);
    return -1;
  }
}