Program: 3919
Project: 3919
Buggy source:
/** 
 * Gets a redirection URL to an SSL-enabled Autodiscover service from the standard non-SSL Autodiscover URL.
 * @param domainName the domain name
 * @return A valid SSL-enabled redirection URL. (May be null)
 * @throws EWSHttpException the eWS http exception
 * @throws XMLStreamException the XML stream exception
 * @throws IOException Signals that an I/O exception has occurred.
 * @throws ServiceLocalException the service local exception
 * @throws URISyntaxException the uRI syntax exception
 */
private URI getRedirectUrl(String domainName) throws EWSHttpException, XMLStreamException, IOException, ServiceLocalException, URISyntaxException {
  String url=String.format(AutodiscoverLegacyHttpUrl,"String_Node_Str" + domainName);
  traceMessage(TraceFlags.AutodiscoverConfiguration,String.format("String_Node_Str",url));
  HttpWebRequest request=null;
  try {
    request=new HttpClientWebRequest(httpClient,httpContext);
    try {
      request.setUrl(URI.create(url).toURL());
    }
 catch (    MalformedURLException e) {
      String strErr=String.format("String_Node_Str",url);
      throw new ServiceLocalException(strErr);
    }
    request.setRequestMethod("String_Node_Str");
    request.setAllowAutoRedirect(false);
    request.setAllowAuthentication(false);
    prepareCredentials(request);
    request.prepareConnection();
    try {
      request.executeRequest();
    }
 catch (    IOException e) {
      traceMessage(TraceFlags.AutodiscoverConfiguration,"String_Node_Str");
      return null;
    }
    OutParam<URI> outParam=new OutParam<URI>();
    if (tryGetRedirectionResponse(request,outParam)) {
      return outParam.getParam();
    }
  }
  finally {
    if (request != null) {
      try {
        request.close();
      }
 catch (      Exception e) {
      }
    }
  }
  traceMessage(TraceFlags.AutodiscoverConfiguration,"String_Node_Str");
  return null;
}

Fixed version (ground truth):
/** 
 * Gets a redirection URL to an SSL-enabled Autodiscover service from the standard non-SSL Autodiscover URL.
 * @param domainName the domain name
 * @return A valid SSL-enabled redirection URL. (May be null)
 * @throws EWSHttpException the eWS http exception
 * @throws XMLStreamException the XML stream exception
 * @throws IOException Signals that an I/O exception has occurred.
 * @throws ServiceLocalException the service local exception
 * @throws URISyntaxException the uRI syntax exception
 */
private URI getRedirectUrl(String domainName) throws EWSHttpException, XMLStreamException, IOException, ServiceLocalException, URISyntaxException {
  String url=String.format(AutodiscoverLegacyHttpUrl,"String_Node_Str" + domainName);
  traceMessage(TraceFlags.AutodiscoverConfiguration,String.format("String_Node_Str",url));
  HttpWebRequest request=null;
  try {
    request=new HttpClientWebRequest(httpClient,httpContext);
    request.setProxy(getWebProxy());
    try {
      request.setUrl(URI.create(url).toURL());
    }
 catch (    MalformedURLException e) {
      String strErr=String.format("String_Node_Str",url);
      throw new ServiceLocalException(strErr);
    }
    request.setRequestMethod("String_Node_Str");
    request.setAllowAutoRedirect(false);
    request.setAllowAuthentication(false);
    prepareCredentials(request);
    request.prepareConnection();
    try {
      request.executeRequest();
    }
 catch (    IOException e) {
      traceMessage(TraceFlags.AutodiscoverConfiguration,"String_Node_Str");
      return null;
    }
    OutParam<URI> outParam=new OutParam<URI>();
    if (tryGetRedirectionResponse(request,outParam)) {
      return outParam.getParam();
    }
  }
  finally {
    if (request != null) {
      try {
        request.close();
      }
 catch (      Exception e) {
      }
    }
  }
  traceMessage(TraceFlags.AutodiscoverConfiguration,"String_Node_Str");
  return null;
}