Skip to content
This repository was archived by the owner on Apr 18, 2026. It is now read-only.
This repository was archived by the owner on Apr 18, 2026. It is now read-only.

NullPointerException in PhotosLibraryUploadCallable #32

Description

@ylexus

Using version 1.5.0.

One of users of my app have recently reported an issue (ylexus/jiotty-photos-uploader#34 (comment)) which was partially caused by a NPE in the google photos client. Seems like it assumes "X-Goog-Upload-Status" header should always be there but it was not. The API call was "uploadMediaItem".

Caused by: java.lang.RuntimeException: Failed uploading D:\_Pictures\2015-2\20159999_Âø¶µÀH¤â©ç\IMG_1075.JPG
	at net.yudichev.jiotty.connector.google.photos.GooglePhotosClientImpl.lambda$null$1(GooglePhotosClientImpl.java:69) ~[jiotty-connector-google-photos-1.5.0.jar:?]
	at java.util.Optional.ifPresent(Unknown Source) ~[?:?]
	at net.yudichev.jiotty.connector.google.photos.GooglePhotosClientImpl.lambda$null$2(GooglePhotosClientImpl.java:69) ~[jiotty-connector-google-photos-1.5.0.jar:?]
	at net.yudichev.jiotty.common.inject.BaseLifecycleComponent.lambda$whenStartedAndNotLifecycling$5(BaseLifecycleComponent.java:60) ~[jiotty-common-1.5.0.jar:?]
	at net.yudichev.jiotty.common.lang.Locks.inLock(Locks.java:22) ~[jiotty-common-1.5.0.jar:?]
	at net.yudichev.jiotty.common.inject.BaseLifecycleComponent.whenNotLifecycling(BaseLifecycleComponent.java:54) ~[jiotty-common-1.5.0.jar:?]
	at net.yudichev.jiotty.common.inject.BaseLifecycleComponent.whenStartedAndNotLifecycling(BaseLifecycleComponent.java:58) ~[jiotty-common-1.5.0.jar:?]
	at net.yudichev.jiotty.connector.google.photos.GooglePhotosClientImpl.lambda$uploadMediaData$3(GooglePhotosClientImpl.java:56) ~[jiotty-connector-google-photos-1.5.0.jar:?]
	... 4 more
Caused by: com.google.api.gax.rpc.ApiException: java.lang.NullPointerException
	at com.google.photos.library.v1.upload.PhotosLibraryUploadExceptionMappingFn.apply(PhotosLibraryUploadExceptionMappingFn.java:48) ~[google-photos-library-client-1.5.0.jar:1.5.0]
	at com.google.photos.library.v1.upload.PhotosLibraryUploadExceptionMappingFn.apply(PhotosLibraryUploadExceptionMappingFn.java:29) ~[google-photos-library-client-1.5.0.jar:1.5.0]
	at com.google.api.core.ApiFutures$GaxFunctionToGuavaFunction.apply(ApiFutures.java:204) ~[api-common-1.8.1.jar:?]
	at com.google.common.util.concurrent.AbstractCatchingFuture$CatchingFuture.doFallback(AbstractCatchingFuture.java:223) ~[guava-28.2-jre.jar:?]
	at com.google.common.util.concurrent.AbstractCatchingFuture$CatchingFuture.doFallback(AbstractCatchingFuture.java:211) ~[guava-28.2-jre.jar:?]
	at com.google.common.util.concurrent.AbstractCatchingFuture.run(AbstractCatchingFuture.java:124) ~[guava-28.2-jre.jar:?]
	at com.google.common.util.concurrent.DirectExecutor.execute(DirectExecutor.java:30) ~[guava-28.2-jre.jar:?]
	at com.google.common.util.concurrent.ExecutionList.executeListener(ExecutionList.java:141) ~[guava-28.2-jre.jar:?]
	at com.google.common.util.concurrent.ExecutionList.execute(ExecutionList.java:130) ~[guava-28.2-jre.jar:?]
	at com.google.common.util.concurrent.ListenableFutureTask.done(ListenableFutureTask.java:86) ~[guava-28.2-jre.jar:?]
	at java.util.concurrent.FutureTask.finishCompletion(Unknown Source) ~[?:?]
	at java.util.concurrent.FutureTask.setException(Unknown Source) ~[?:?]
	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) ~[?:?]
	... 3 more
Caused by: java.lang.NullPointerException
	at com.google.photos.library.v1.upload.PhotosLibraryUploadCallable.getUploadUrl(PhotosLibraryUploadCallable.java:228) ~[google-photos-library-client-1.5.0.jar:1.5.0]
	at com.google.photos.library.v1.upload.PhotosLibraryUploadCallable.call(PhotosLibraryUploadCallable.java:110) ~[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) ~[?:?]
	... 3 more

Activity

  1. self-assigned this
    on May 14, 2021
  2. jfschmakeit commented on May 14, 2021

    @jfschmakeit
    Contributor

    Yes, there is an assumption that the API always returns the UPLOAD_STATUS_HEADER field. I'm not sure when this could fail, but it makes sense to avoid this NullPointerException at least.

    I'm preparing a change that will throw an IllegalStateException and guard against the NPE, similar to how other unexpected upload statuses are handled.

  3. shreelakshmijoshi commented on Aug 22, 2021

    @shreelakshmijoshi

    Hi @ylexus !
    I am a new open source contributor and would love to solve this issue, could you help me understand the issue better by providing some extra references ?
    Is this is issue open to contribute ?

  4. ylexus commented on Aug 23, 2021

    @ylexus
    Author

    @shreelakshmijoshi seems like @jfschmakeit has already started working on this - can you liaise with them? I am a issue reporter, I am not familiar with the design of the library to help.

    Not sure what you mean by providing extra references.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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