Program: 29789
Project: 29789
Buggy source:
/** 
 * Extract the payload (client side stub jar files) to the directory specified via --retrieve option.
 * @param outboundPayload Payload to be extracted
 * @param actionReport    ActionReport of the deploy command.
 * @param retrieveDir     Directory where the payload should be extracted to.
 */
private void extractPayload(Payload.Outbound outboundPayload,ActionReport actionReport,File retrieveDir){
  File payloadZip=null;
  FileOutputStream payloadOutputStream=null;
  FileInputStream payloadInputStream=null;
  try {
    final ByteArrayOutputStream baos=new ByteArrayOutputStream(1024);
    actionReport.writeReport(baos);
    final ByteArrayInputStream bais=new ByteArrayInputStream(baos.toByteArray());
    final Properties reportProps=new Properties();
    reportProps.setProperty("String_Node_Str","String_Node_Str");
    outboundPayload.addPart(0,actionReport.getContentType(),"String_Node_Str",reportProps,bais);
    payloadZip=File.createTempFile("String_Node_Str","String_Node_Str");
    payloadOutputStream=new FileOutputStream(payloadZip);
    outboundPayload.writeTo(payloadOutputStream);
    payloadOutputStream.flush();
    payloadOutputStream.close();
    final PayloadFilesManager pfm=new PayloadFilesManager.Perm(retrieveDir,null,logger);
    payloadInputStream=new FileInputStream(payloadZip);
    final PayloadImpl.Inbound inboundPayload=PayloadImpl.Inbound.newInstance("String_Node_Str",payloadInputStream);
    pfm.processParts(inboundPayload);
  }
 catch (  Exception ex) {
    logger.log(Level.WARNING,ex.getMessage(),ex);
  }
 finally {
    if (payloadOutputStream != null) {
      try {
        payloadOutputStream.close();
      }
 catch (      IOException ioex) {
        logger.warning(ioex.getMessage());
      }
    }
    if (payloadInputStream != null) {
      try {
        payloadInputStream.close();
      }
 catch (      IOException ioex) {
        logger.warning(ioex.getMessage());
      }
    }
    if (payloadZip != null) {
      payloadZip.delete();
    }
  }
}

Fixed version (ground truth):
/** 
 * Extract the payload (client side stub jar files) to the directory specified via --retrieve option.
 * @param outboundPayload Payload to be extracted
 * @param actionReport    ActionReport of the deploy command.
 * @param retrieveDir     Directory where the payload should be extracted to.
 */
private void extractPayload(Payload.Outbound outboundPayload,ActionReport actionReport,File retrieveDir){
  File payloadZip=null;
  FileOutputStream payloadOutputStream=null;
  FileInputStream payloadInputStream=null;
  try {
    final ByteArrayOutputStream baos=new ByteArrayOutputStream(1024);
    actionReport.writeReport(baos);
    final ByteArrayInputStream bais=new ByteArrayInputStream(baos.toByteArray());
    final Properties reportProps=new Properties();
    reportProps.setProperty("String_Node_Str","String_Node_Str");
    outboundPayload.addPart(0,actionReport.getContentType(),"String_Node_Str",reportProps,bais);
    payloadZip=File.createTempFile("String_Node_Str","String_Node_Str");
    payloadOutputStream=new FileOutputStream(payloadZip);
    outboundPayload.writeTo(payloadOutputStream);
    payloadOutputStream.flush();
    payloadOutputStream.close();
    final PayloadFilesManager pfm=new PayloadFilesManager.Perm(retrieveDir,null,logger);
    payloadInputStream=new FileInputStream(payloadZip);
    final PayloadImpl.Inbound inboundPayload=PayloadImpl.Inbound.newInstance("String_Node_Str",payloadInputStream);
    pfm.processParts(inboundPayload);
  }
 catch (  Exception ex) {
    logger.log(Level.WARNING,ex.getMessage(),ex);
  }
 finally {
    if (payloadOutputStream != null) {
      try {
        payloadOutputStream.close();
      }
 catch (      IOException ioex) {
        logger.warning(ioex.getMessage());
      }
    }
    if (payloadInputStream != null) {
      try {
        payloadInputStream.close();
      }
 catch (      IOException ioex) {
        logger.warning(ioex.getMessage());
      }
    }
    if (payloadZip != null) {
      if (payloadZip.delete() == false) {
        logger.log(Level.WARNING,"String_Node_Str",payloadZip.toString());
      }
    }
  }
}