Program: 14172
Project: 14172
Buggy source:
/** 
 * Create the named object part in metadata and on the backend.
 * @return the ObjectEntity object representing the successfully created object
 */
@Override public PartEntity createObjectPart(final ObjectStorageProviderClient provider,ObjectEntity mpuEntity,PartEntity entity,final InputStream content,User requestUser) throws S3Exception {
  if (BucketState.extant.equals(entity.getBucket().getState())) {
    try {
      entity=MpuPartMetadataManagers.getInstance().initiatePartCreation(entity);
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str" + entity.getResourceFullName());
      InternalErrorException ex=new InternalErrorException(entity.getResourceFullName());
      ex.initCause(e);
      throw ex;
    }
  }
 else {
    throw new NoSuchBucketException(entity.getBucket().getBucketName());
  }
  final Date lastModified;
  final String etag;
  UploadPartResponseType response;
  try {
    final PartEntity uploadingObject=entity;
    final UploadPartType putRequest=new UploadPartType();
    putRequest.setBucket(uploadingObject.getBucket().getBucketUuid());
    putRequest.setKey(mpuEntity.getObjectUuid());
    putRequest.setUser(requestUser);
    putRequest.setContentLength(entity.getSize().toString());
    putRequest.setPartNumber(String.valueOf(entity.getPartNumber()));
    putRequest.setUploadId(entity.getUploadId());
    Callable<UploadPartResponseType> putCallable=new Callable<UploadPartResponseType>(){
      @Override public UploadPartResponseType call() throws Exception {
        LOG.debug("String_Node_Str");
        UploadPartResponseType response=provider.uploadPart(putRequest,content);
        LOG.debug("String_Node_Str" + response.getStatusMessage());
        return response;
      }
    }
;
    final FutureTask<UploadPartResponseType> putTask=new FutureTask<>(putCallable);
    PUT_OBJECT_SERVICE.execute(putTask);
    final long failTime=System.currentTimeMillis() + getPutTimeoutInMillis();
    final long checkIntervalSec=ObjectStorageProperties.OBJECT_CREATION_EXPIRATION_INTERVAL_SEC / 2;
    final AtomicReference<PartEntity> entityRef=new AtomicReference<>(uploadingObject);
    Callable updateTimeout=new Callable(){
      @Override public Object call() throws Exception {
        PartEntity tmp=entityRef.get();
        try {
          entityRef.getAndSet(MpuPartMetadataManagers.getInstance().updateCreationTimeout(tmp));
        }
 catch (        Exception ex) {
          LOG.warn("String_Node_Str" + tmp.getPartUuid() + "String_Node_Str",ex);
        }
        return entityRef.get();
      }
    }
;
    response=waitForCompletion(putTask,uploadingObject.getPartUuid(),updateTimeout,failTime,checkIntervalSec);
    entity=entityRef.get();
    lastModified=response.getLastModified();
    etag=response.getEtag();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str" + entity.getBucket().getBucketUuid() + "String_Node_Str"+ entity.getPartUuid(),e);
    try {
      MpuPartMetadataManagers.getInstance().transitionPartToState(entity,ObjectState.deleting);
    }
 catch (    Exception ex) {
      LOG.error("String_Node_Str",e);
    }
    throw new InternalErrorException(entity.getObjectKey());
  }
  try {
    return MpuPartMetadataManagers.getInstance().finalizeCreation(entity,lastModified,etag);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    throw new InternalErrorException(entity.getResourceFullName());
  }
}

Fixed version (ground truth):
/** 
 * Create the named object part in metadata and on the backend.
 * @return the ObjectEntity object representing the successfully created object
 */
@Override public PartEntity createObjectPart(final ObjectStorageProviderClient provider,ObjectEntity mpuEntity,PartEntity entity,final InputStream content,User requestUser) throws S3Exception {
  if (BucketState.extant.equals(entity.getBucket().getState())) {
    try {
      entity=MpuPartMetadataManagers.getInstance().initiatePartCreation(entity);
    }
 catch (    Exception e) {
      LOG.error("String_Node_Str" + entity.getResourceFullName());
      InternalErrorException ex=new InternalErrorException(entity.getResourceFullName());
      ex.initCause(e);
      throw ex;
    }
  }
 else {
    throw new NoSuchBucketException(entity.getBucket().getBucketName());
  }
  final Date lastModified;
  final String etag;
  UploadPartResponseType response;
  try {
    final PartEntity uploadingObject=entity;
    final UploadPartType putRequest=new UploadPartType();
    putRequest.setBucket(uploadingObject.getBucket().getBucketUuid());
    putRequest.setKey(mpuEntity.getObjectUuid());
    putRequest.setUser(requestUser);
    putRequest.setContentLength(entity.getSize().toString());
    putRequest.setPartNumber(String.valueOf(entity.getPartNumber()));
    putRequest.setUploadId(entity.getUploadId());
    Callable<UploadPartResponseType> putCallable=new Callable<UploadPartResponseType>(){
      @Override public UploadPartResponseType call() throws Exception {
        LOG.trace("String_Node_Str");
        UploadPartResponseType response=provider.uploadPart(putRequest,content);
        LOG.trace("String_Node_Str" + response.getStatusMessage());
        return response;
      }
    }
;
    final FutureTask<UploadPartResponseType> putTask=new FutureTask<>(putCallable);
    PUT_OBJECT_SERVICE.execute(putTask);
    final long failTime=System.currentTimeMillis() + getPutTimeoutInMillis();
    final long checkIntervalSec=ObjectStorageProperties.OBJECT_CREATION_EXPIRATION_INTERVAL_SEC / 2;
    final AtomicReference<PartEntity> entityRef=new AtomicReference<>(uploadingObject);
    Callable updateTimeout=new Callable(){
      @Override public Object call() throws Exception {
        PartEntity tmp=entityRef.get();
        try {
          entityRef.getAndSet(MpuPartMetadataManagers.getInstance().updateCreationTimeout(tmp));
        }
 catch (        Exception ex) {
          LOG.warn("String_Node_Str" + tmp.getPartUuid() + "String_Node_Str",ex);
        }
        return entityRef.get();
      }
    }
;
    response=waitForCompletion(putTask,uploadingObject.getPartUuid(),updateTimeout,failTime,checkIntervalSec);
    entity=entityRef.get();
    lastModified=response.getLastModified();
    etag=response.getEtag();
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str" + entity.getBucket().getBucketUuid() + "String_Node_Str"+ entity.getPartUuid(),e);
    try {
      MpuPartMetadataManagers.getInstance().transitionPartToState(entity,ObjectState.deleting);
    }
 catch (    Exception ex) {
      LOG.error("String_Node_Str",e);
    }
    throw new InternalErrorException(entity.getObjectKey());
  }
  try {
    return MpuPartMetadataManagers.getInstance().finalizeCreation(entity,lastModified,etag);
  }
 catch (  Exception e) {
    LOG.error("String_Node_Str",e);
    throw new InternalErrorException(entity.getResourceFullName());
  }
}