Skip to content

Scribe throws "java.lang.IllegalArgumentException: Cannot get String from a null object" - needs simple retry logic #64

@dermoritz

Description

@dermoritz

i created a little upload app to upload folder structures to flickr. The process took many hours.
But after several minutes or hours (it is completely different) i got an exception:
"
Exception in thread "main" java.lang.IllegalArgumentException: Cannot get String from a null object
at org.scribe.utils.Preconditions.check(Preconditions.java:84)
at org.scribe.utils.Preconditions.checkNotNull(Preconditions.java:31)
at org.scribe.utils.StreamUtils.getStreamContents(StreamUtils.java:22)
at org.scribe.model.Response.parseBodyContents(Response.java:43)
at org.scribe.model.Response.getBody(Response.java:69)
at com.flickr4java.flickr.REST.post(REST.java:292)
at com.flickr4java.flickr.uploader.Uploader.postPhoto(Uploader.java:195)
at com.flickr4java.flickr.uploader.Uploader.upload(Uploader.java:124)
at com.flickr4java.flickr.uploader.Uploader.upload(Uploader.java:104)
"
If i repeat the upload on same file (restarting my app) it works fine.

So i created a retry logic that simply reties all calls (i think it could happen on every flickr api call) i used from your api. This is working fine. But i think a retry logic should be part of the flickr api?! What do you think?

There are many variants to implemnt such a logic. i found mine here:
http://stackoverflow.com/questions/9539845/java-how-to-handle-retries-without-copy-paste-code or here:
http://stackoverflow.com/questions/13239972/how-do-you-implement-a-re-try-catch

Metadata

Metadata

Assignees

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions