Program: 54837
Project: 54837
Buggy source:
public void subtestUpload_ResumableWithError(ErrorType error,int contentLength,boolean contentLengthKnown,int maxByteIndexUploadedOnIOException) throws Exception {
  MediaTransport fakeTransport=new MediaTransport(contentLength,true);
  if (error == ErrorType.IO_EXCEPTION) {
    fakeTransport.testIOException=true;
  }
 else   if (error == ErrorType.SERVER_UNAVAILABLE) {
    fakeTransport.testServerError=true;
  }
  fakeTransport.contentLengthNotSpecified=!contentLengthKnown;
  fakeTransport.maxByteIndexUploadedOnIOException=maxByteIndexUploadedOnIOException;
  byte[] testedData=new byte[contentLength];
  new Random().nextBytes(testedData);
  InputStream is=new ByteArrayInputStream(testedData);
  InputStreamContent mediaContent=new InputStreamContent(TEST_CONTENT_TYPE,is);
  if (contentLengthKnown) {
    mediaContent.setLength(contentLength);
  }
  MediaHttpUploader uploader=new MediaHttpUploader(mediaContent,fakeTransport,new HttpRequestInitializer(){
    public void initialize(    HttpRequest request){
      request.setIOExceptionHandler(new HttpBackOffIOExceptionHandler(BackOff.ZERO_BACKOFF));
      request.setUnsuccessfulResponseHandler(new HttpBackOffUnsuccessfulResponseHandler(BackOff.ZERO_BACKOFF));
    }
  }
);
  uploader.setDisableGZipContent(true);
  HttpResponse response=uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL));
  assertEquals(200,response.getStatusCode());
  int calls=contentLength / uploader.getChunkSize();
  assertEquals(maxByteIndexUploadedOnIOException + 1 == contentLength ? calls + 2 : calls + 3,fakeTransport.lowLevelExecCalls);
  assertTrue(Arrays.equals(testedData,fakeTransport.bytesReceived));
}

Fixed version (ground truth):
public void subtestUpload_ResumableWithError(ErrorType error,int contentLength,boolean contentLengthKnown,int maxByteIndexUploadedOnError,int chunks) throws Exception {
  MediaTransport fakeTransport=new MediaTransport(contentLength,true);
  if (error == ErrorType.IO_EXCEPTION) {
    fakeTransport.testIOException=true;
  }
 else   if (error == ErrorType.SERVER_UNAVAILABLE) {
    fakeTransport.testServerError=true;
  }
  fakeTransport.contentLengthNotSpecified=!contentLengthKnown;
  fakeTransport.maxByteIndexUploadedOnError=maxByteIndexUploadedOnError;
  byte[] testedData=new byte[contentLength];
  new Random().nextBytes(testedData);
  InputStream is=new ByteArrayInputStream(testedData);
  InputStreamContent mediaContent=new InputStreamContent(TEST_CONTENT_TYPE,is);
  if (contentLengthKnown) {
    mediaContent.setLength(contentLength);
  }
  MediaHttpUploader uploader=new MediaHttpUploader(mediaContent,fakeTransport,new HttpRequestInitializer(){
    public void initialize(    HttpRequest request){
      request.setIOExceptionHandler(new HttpBackOffIOExceptionHandler(BackOff.ZERO_BACKOFF));
      request.setUnsuccessfulResponseHandler(new HttpBackOffUnsuccessfulResponseHandler(BackOff.ZERO_BACKOFF));
    }
  }
);
  uploader.setDisableGZipContent(true);
  HttpResponse response=uploader.upload(new GenericUrl(TEST_RESUMABLE_REQUEST_URL));
  assertEquals(200,response.getStatusCode());
  int calls=2 + chunks;
  assertEquals(calls,fakeTransport.lowLevelExecCalls);
  assertTrue(Arrays.equals(testedData,fakeTransport.bytesReceived));
}