Program: 13014
Project: 13014
Buggy source:
/** 
 * Performs a batch operation by uploading an s-ramp package archive to the s-ramp server for processing.  The contents of the s-ramp archive will be processed, and the results will be returned as a Map.  The Map is indexed by the S-RAMP Archive entry path, and each each value in the Map will either be a   {@link BaseArtifactType} or an{@link SrampAtomException}, depending on success vs. failure of that entry.
 * @param archive the s-ramp package archive to upload
 * @return the collection of results (one per entry in the s-ramp package)
 * @throws SrampClientException
 * @throws SrampAtomException
 */
public Map<String,?> uploadBatch(SrampArchive archive) throws SrampClientException, SrampAtomException {
  File packageFile=null;
  InputStream packageStream=null;
  try {
    packageFile=archive.pack();
    packageStream=FileUtils.openInputStream(packageFile);
    ClientRequest request=createClientRequest(this.endpoint);
    request.header("String_Node_Str","String_Node_Str");
    request.body(MediaType.APPLICATION_ZIP,packageStream);
    ClientResponse<MultipartInput> clientResponse=request.post(MultipartInput.class);
    MultipartInput response=clientResponse.getEntity();
    List<InputPart> parts=response.getParts();
    Map<String,Object> rval=new HashMap<String,Object>(parts.size());
    for (    InputPart part : parts) {
      String contentId=part.getHeaders().getFirst("String_Node_Str");
      String path=contentId.substring(1,contentId.lastIndexOf('@'));
      HttpResponseBean rbean=part.getBody(HttpResponseBean.class,null);
      if (rbean.getCode() == 201) {
        Entry entry=(Entry)rbean.getBody();
        BaseArtifactType artifact=SrampAtomUtils.unwrapSrampArtifact(entry);
        rval.put(path,artifact);
      }
 else       if (rbean.getCode() == 409) {
        if (MediaType.APPLICATION_SRAMP_ATOM_EXCEPTION.equals(rbean.getHeaders().get("String_Node_Str"))) {
          SrampAtomException exception=(SrampAtomException)rbean.getBody();
          rval.put(path,exception);
        }
 else {
          String errorReason=(String)rbean.getBody();
          SrampAtomException exception=new SrampAtomException(errorReason);
          rval.put(path,exception);
        }
      }
 else {
        SrampAtomException exception=new SrampAtomException("String_Node_Str" + rbean.getCode() + "String_Node_Str"+ contentId+ "String_Node_Str");
        rval.put(path,exception);
      }
    }
    return rval;
  }
 catch (  SrampAtomException e) {
    throw e;
  }
catch (  Throwable e) {
    throw new SrampClientException(e);
  }
 finally {
    IOUtils.closeQuietly(packageStream);
    FileUtils.deleteQuietly(packageFile);
  }
}

Fixed version (ground truth):
/** 
 * Performs a batch operation by uploading an s-ramp package archive to the s-ramp server for processing.  The contents of the s-ramp archive will be processed, and the results will be returned as a Map.  The Map is indexed by the S-RAMP Archive entry path, and each each value in the Map will either be a   {@link BaseArtifactType} or an{@link SrampAtomException}, depending on success vs. failure of that entry.
 * @param archive the s-ramp package archive to upload
 * @return the collection of results (one per entry in the s-ramp package)
 * @throws SrampClientException
 * @throws SrampAtomException
 */
public Map<String,?> uploadBatch(SrampArchive archive) throws SrampClientException, SrampAtomException {
  File packageFile=null;
  InputStream packageStream=null;
  try {
    if (archive.getEntries().isEmpty()) {
      return new HashMap<String,Object>();
    }
    packageFile=archive.pack();
    packageStream=FileUtils.openInputStream(packageFile);
    ClientRequest request=createClientRequest(this.endpoint);
    request.header("String_Node_Str","String_Node_Str");
    request.body(MediaType.APPLICATION_ZIP,packageStream);
    ClientResponse<MultipartInput> clientResponse=request.post(MultipartInput.class);
    MultipartInput response=clientResponse.getEntity();
    List<InputPart> parts=response.getParts();
    Map<String,Object> rval=new HashMap<String,Object>(parts.size());
    for (    InputPart part : parts) {
      String contentId=part.getHeaders().getFirst("String_Node_Str");
      String path=contentId.substring(1,contentId.lastIndexOf('@'));
      HttpResponseBean rbean=part.getBody(HttpResponseBean.class,null);
      if (rbean.getCode() == 201) {
        Entry entry=(Entry)rbean.getBody();
        BaseArtifactType artifact=SrampAtomUtils.unwrapSrampArtifact(entry);
        rval.put(path,artifact);
      }
 else       if (rbean.getCode() == 409) {
        if (MediaType.APPLICATION_SRAMP_ATOM_EXCEPTION.equals(rbean.getHeaders().get("String_Node_Str"))) {
          SrampAtomException exception=(SrampAtomException)rbean.getBody();
          rval.put(path,exception);
        }
 else {
          String errorReason=(String)rbean.getBody();
          SrampAtomException exception=new SrampAtomException(errorReason);
          rval.put(path,exception);
        }
      }
 else {
        SrampAtomException exception=new SrampAtomException("String_Node_Str" + rbean.getCode() + "String_Node_Str"+ contentId+ "String_Node_Str");
        rval.put(path,exception);
      }
    }
    return rval;
  }
 catch (  SrampAtomException e) {
    throw e;
  }
catch (  Throwable e) {
    throw new SrampClientException(e);
  }
 finally {
    IOUtils.closeQuietly(packageStream);
    FileUtils.deleteQuietly(packageFile);
  }
}