Program: 103391
Project: 103391
Buggy source:
/** 
 * Posts a <tt>file</tt> to the <tt>address</tt>.
 * @param address the address to post the form to.
 * @param fileParamName the name of the param for the file.
 * @param file the file we will send.
 * @param usernamePropertyName the property to use to retrieve/storeusername value if protected site is hit, for username ConfigurationService service is used.
 * @param passwordPropertyName the property to use to retrieve/storepassword value if protected site is hit, for password CredentialsStorageService service is used.
 * @return the result or null if send was not possible orcredentials ask if any was canceled.
 */
public static HTTPResponseResult postFile(String address,String fileParamName,File file,String usernamePropertyName,String passwordPropertyName){
  DefaultHttpClient httpClient=null;
  try {
    HttpPost postMethod=new HttpPost(address);
    httpClient=getHttpClient(usernamePropertyName,passwordPropertyName,postMethod.getURI().getHost());
    String mimeType=URLConnection.guessContentTypeFromName(file.getPath());
    if (mimeType == null)     mimeType="String_Node_Str";
    FileBody bin=new FileBody(file,mimeType);
    MultipartEntity reqEntity=new MultipartEntity();
    reqEntity.addPart(fileParamName,bin);
    postMethod.setEntity(reqEntity);
    HttpEntity resEntity=executeMethod(httpClient,postMethod);
    if (resEntity == null)     return null;
    if (logger.isDebugEnabled())     logger.debug("String_Node_Str" + EntityUtils.toString(resEntity));
    return new HTTPResponseResult(reqEntity,httpClient);
  }
 catch (  Throwable e) {
    logger.error("String_Node_Str" + address,e);
  }
  return null;
}

Fixed version (ground truth):
/** 
 * Posts a <tt>file</tt> to the <tt>address</tt>.
 * @param address the address to post the form to.
 * @param fileParamName the name of the param for the file.
 * @param file the file we will send.
 * @param usernamePropertyName the property to use to retrieve/storeusername value if protected site is hit, for username ConfigurationService service is used.
 * @param passwordPropertyName the property to use to retrieve/storepassword value if protected site is hit, for password CredentialsStorageService service is used.
 * @return the result or null if send was not possible orcredentials ask if any was canceled.
 */
public static HTTPResponseResult postFile(String address,String fileParamName,File file,String usernamePropertyName,String passwordPropertyName){
  DefaultHttpClient httpClient=null;
  try {
    HttpPost postMethod=new HttpPost(address);
    httpClient=getHttpClient(usernamePropertyName,passwordPropertyName,postMethod.getURI().getHost());
    String mimeType=URLConnection.guessContentTypeFromName(file.getPath());
    if (mimeType == null)     mimeType="String_Node_Str";
    FileBody bin=new FileBody(file,mimeType);
    MultipartEntity reqEntity=new MultipartEntity();
    reqEntity.addPart(fileParamName,bin);
    postMethod.setEntity(reqEntity);
    HttpEntity resEntity=executeMethod(httpClient,postMethod);
    if (resEntity == null)     return null;
    return new HTTPResponseResult(reqEntity,httpClient);
  }
 catch (  Throwable e) {
    logger.error("String_Node_Str" + address,e);
  }
  return null;
}