Comments (10)
I have the same exact issue, I am using okhttp + retrofit with Picasso to cache images. when I save objects it Success but when retrieve it with getAsync
it fail. following is the stack trace :
11-16 09:15:57.436 1292-1292/com.myapp W/System.err﹕ java.lang.NullPointerException
11-16 09:15:57.436 1292-1292/com.myapp W/System.err﹕ at com.anupcowkur.reservoir.Reservoir$GetTask.doInBackground(Reservoir.java:180)
11-16 09:15:57.436 1292-1292/com.myapp W/System.err﹕ at com.anupcowkur.reservoir.Reservoir$GetTask.doInBackground(Reservoir.java:163)
11-16 09:15:57.436 1292-1292/com.myapp W/System.err﹕ at android.os.AsyncTask$2.call(AsyncTask.java:287)
11-16 09:15:57.436 1292-1292/com.myapp W/System.err﹕ at java.util.concurrent.FutureTask.run(FutureTask.java:234)
11-16 09:15:57.436 1292-1292/com.myapp W/System.err﹕ at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
11-16 09:15:57.436 1292-1292/com.myapp W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
11-16 09:15:57.436 1292-1292/com.myapp W/System.err﹕ at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
11-16 09:15:57.436 1292-1292/com.myapp W/System.err﹕ at java.lang.Thread.run(Thread.java:841)
from reservoir.
I used it just as documented.
Reservoir.putAsync(key, apiResponse, new ReservoirPutCallback() {
@Override
public void onSuccess() {
Log.i("RestCache", "[PUT] Success: " + key);
}
@Override
public void onFailure(Exception e) {
Log.i("RestCache", "[PUT] Failed: " + key);
}
});
Reservoir.getAsync(this.key, ApiResponse.class, new ReservoirGetCallback<ApiResponse>() {
@Override
public void onSuccess(ApiResponse apiResponse) {
Log.i("RestCache", "[GET] Success: " + key);
try {
Log.i("RestCache", "Using cached data...");
callback.apiSuccess(tag, apiResponse, null, null);
} catch (JSONException e) {
Log.i("RestCache", "Using cached data failed!");
e.printStackTrace();
}
}
@Override
public void onFailure(Exception e) {
Log.i("RestCache", "[GET] Failed: " + key);
Log.i("RestCache", "Requesting new data...");
//some process here...
}
});
from reservoir.
Seeing this as well.
from reservoir.
Strange. The data is stored in the application's internal storage.
from reservoir.
I'm also having that problem. I don't have to setup any path for cache right? So what's the issue?
from reservoir.
@xarlotie no, you don't have to set up a path. Can you make a sample that reproduces this?
from reservoir.
Can you please give me the API response JSON that you receive and the ApiResponse
class code as well?
from reservoir.
I already simplified it. I tried String instead of my complicated ApiResponse class. Still doesnt work.
I get the very same stacktrace posted by @mohamedmenasy
from reservoir.
The stack trace is fine but I need to see the exact server response and the model class if I am to fix this.
from reservoir.
Here's a sample data:
{
"data":
[
{
"movieid": 14920,
"title": "Everly"
"rating": "R-16",
"poster": "http://ia.media-imdb.com/images/M/MV5BMjEyNTU4NTE5NV5BMl5BanBnXkFtZTgwNzY4NzIxNDE@._V1_SX214_AL_.jpg",
"url": "http://www.imdb.com/title/tt1945084/",
"release_date": "2015-02-11",
"genre": "Action, Thriller",
"critics_rating":
{
"title": "‘Everly’ Lacks the Imagination to Make Up for its Minor Ambitions",
"articleid": 25056,
"rating": 1.5,
"rating_img": "http://icons.iconarchive.com/icons/oxygen-icons.org/oxygen/32/Actions-rating-icon.png"
}
}
],
"message": "",
"status": true,
"total": 22
}
But i already tried to treat that as a String and not a custom class. It still does not work.
from reservoir.
Related Issues (20)
- RxAndroid as a provided dependency HOT 1
- Failed to invoke protected java.text.DateFormat() with no args HOT 1
- Is there any way to set expiry date for a cached object? HOT 1
- cannot access Observable class file for rx.Observable not found HOT 10
- this project support multiprocess operation ? HOT 1
- Proguard Rules HOT 2
- GSON Error HOT 1
- A/libc: Fatal signal 11 (SIGSEGV) HOT 2
- Declares multiple JSON fields named id HOT 3
- bytesUsed not working HOT 1
- Add more specific exceptions in README HOT 1
- null object reference! HOT 3
- Any chance for iOS ? HOT 1
- Invalidate Cache when app updates HOT 1
- ability to cancel asynctask HOT 1
- Would be support of RxJava2? HOT 2
- rx.java seems not optionable - `Failed resolution of rx/Observable$onSubscribe` error HOT 1
- Can we put multiple keys into cache? HOT 3
- Replace RxJava 1 with RxJava 2 HOT 4
- What can be the causes for faliure for storing HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reservoir.