Skip to content

UploadMediaItem fails with cryptic error when the file length is zero #39

@ylexus

Description

@ylexus

When a file length is zero, uploading it causes this exception:

java.lang.IllegalArgumentException: The upload was completed but failed to finalize or get the result.
	at com.google.photos.library.v1.upload.PhotosLibraryUploadCallable.buildUploadMediaItemResponse(PhotosLibraryUploadCallable.java:314) ~[google-photos-library-client-1.5.0.jar:1.5.0]
	at com.google.photos.library.v1.upload.PhotosLibraryUploadCallable.call(PhotosLibraryUploadCallable.java:184) ~[google-photos-library-client-1.5.0.jar:1.5.0]
	at com.google.photos.library.v1.upload.PhotosLibraryUploadCallable.call(PhotosLibraryUploadCallable.java:45) ~[google-photos-library-client-1.5.0.jar:1.5.0]
	at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:?]
	at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) ~[?:?]
	at java.util.concurrent.FutureTask.run(Unknown Source) ~[?:?]
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(Unknown Source) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) ~[?:?]
	at java.lang.Thread.run(Unknown Source) ~[?:?]

I think PhotosLibraryUploadCallable should handle it better and fail fast with a more descriptive error.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions