Program: 39957
Project: 39957
Buggy source:
/** 
 * small file using put object api
 */
private UploadServiceResult putObject(final String bucket,String cosPath,String srcPath) throws CosXmlClientException, CosXmlServiceException {
  UPLOAD_PART_COUNT.set(1);
  putObjectRequest=new PutObjectRequest(bucket,cosPath,srcPath);
  putObjectRequest.setProgressListener(cosXmlProgressListener);
  setSignTime(putObjectRequest);
  cosXmlService.putObjectAsync(putObjectRequest,new CosXmlResultListener(){
    @Override public void onSuccess(    CosXmlRequest request,    CosXmlResult result){
synchronized (objectSync) {
        PutObjectResult putObjectResult=(PutObjectResult)result;
        if (uploadServiceResult == null)         uploadServiceResult=new UploadServiceResult();
        uploadServiceResult.httpCode=putObjectResult.httpCode;
        uploadServiceResult.httpMessage=putObjectResult.httpMessage;
        uploadServiceResult.headers=putObjectResult.headers;
        uploadServiceResult.eTag=putObjectResult.eTag;
      }
      UPLOAD_PART_COUNT.decrementAndGet();
    }
    @Override public void onFail(    CosXmlRequest request,    CosXmlClientException exception,    CosXmlServiceException serviceException){
synchronized (objectSync) {
        if (exception != null) {
          mException=exception;
        }
 else {
          mException=serviceException;
        }
        ERROR_EXIT_FLAG=1;
      }
    }
  }
);
  while (UPLOAD_PART_COUNT.get() > 0 && ERROR_EXIT_FLAG == 0)   ;
  if (ERROR_EXIT_FLAG > 0) {
switch (ERROR_EXIT_FLAG) {
case 2:
      realCancel();
    clear();
  throw new CosXmlClientException("String_Node_Str");
case 3:
throw new CosXmlClientException("String_Node_Str");
case 1:
realCancel();
if (mException != null) {
if (mException instanceof CosXmlClientException) {
throw (CosXmlClientException)mException;
}
if (mException instanceof CosXmlServiceException) {
throw (CosXmlServiceException)mException;
}
}
 else {
throw new CosXmlClientException("String_Node_Str");
}
}
}
uploadServiceResult.accessUrl=cosXmlService.getAccessUrl(putObjectRequest);
return uploadServiceResult;
}

Fixed version (ground truth):
/** 
 * small file using put object api
 */
private UploadServiceResult putObject(final String bucket,String cosPath,String srcPath) throws CosXmlClientException, CosXmlServiceException {
  UPLOAD_PART_COUNT.set(1);
  putObjectRequest=new PutObjectRequest(bucket,cosPath,srcPath);
  putObjectRequest.setProgressListener(cosXmlProgressListener);
  setSignTime(putObjectRequest);
  setRequestHeaders(putObjectRequest);
  cosXmlService.putObjectAsync(putObjectRequest,new CosXmlResultListener(){
    @Override public void onSuccess(    CosXmlRequest request,    CosXmlResult result){
synchronized (objectSync) {
        PutObjectResult putObjectResult=(PutObjectResult)result;
        if (uploadServiceResult == null)         uploadServiceResult=new UploadServiceResult();
        uploadServiceResult.httpCode=putObjectResult.httpCode;
        uploadServiceResult.httpMessage=putObjectResult.httpMessage;
        uploadServiceResult.headers=putObjectResult.headers;
        uploadServiceResult.eTag=putObjectResult.eTag;
      }
      UPLOAD_PART_COUNT.decrementAndGet();
    }
    @Override public void onFail(    CosXmlRequest request,    CosXmlClientException exception,    CosXmlServiceException serviceException){
synchronized (objectSync) {
        if (exception != null) {
          mException=exception;
        }
 else {
          mException=serviceException;
        }
        ERROR_EXIT_FLAG=1;
      }
    }
  }
);
  while (UPLOAD_PART_COUNT.get() > 0 && ERROR_EXIT_FLAG == 0)   ;
  if (ERROR_EXIT_FLAG > 0) {
switch (ERROR_EXIT_FLAG) {
case 2:
      realCancel();
    clear();
  throw new CosXmlClientException("String_Node_Str");
case 3:
throw new CosXmlClientException("String_Node_Str");
case 1:
realCancel();
if (mException != null) {
if (mException instanceof CosXmlClientException) {
throw (CosXmlClientException)mException;
}
if (mException instanceof CosXmlServiceException) {
throw (CosXmlServiceException)mException;
}
}
 else {
throw new CosXmlClientException("String_Node_Str");
}
}
}
uploadServiceResult.accessUrl=cosXmlService.getAccessUrl(putObjectRequest);
return uploadServiceResult;
}