Comments (4)
Thanks! The issue is really in https://github.com/drakeet/retrofit-agera-call-adapter that calls Result.success
with null here:
And possibly also here:
I'll file a bug on retrofit-agera-call-adapter, @drakeet looping you in here for ref.
from agera.
Is this done using the net sample extension? If so, do you have a stack trace you can add here?
In general though, a success
would always have to contain a non-null value. If you have a value that's null it'd have to use absent
or if you have a value that sometimes is null, absentIfNull
. Result
would support containing an empty string though (if it's a Result
of a string that is).
If the sample extension is trying to put a null value in a success, we'll make sure to fix it, but that stack trace would be helpful.
from agera.
@mahmoud-elnaggar do you have any additional input on this?
from agera.
@ernstsson
I'm very sorry for being late
this is my stack trace
java.lang.NullPointerException
at com.google.android.agera.Preconditions.checkNotNull(Preconditions.java:40)
at com.google.android.agera.Result.success(Result.java:71)
at me.drakeet.retrofit2.adapter.agera.CallSupplier.get(CallSupplier.java:47)
at me.drakeet.retrofit2.adapter.agera.CallSupplier.get(CallSupplier.java:32)
at com.google.android.agera.CompiledRepository.runGetFrom(CompiledRepository.java:340)
at com.google.android.agera.CompiledRepository.runFlowFrom(CompiledRepository.java:301)
at com.google.android.agera.CompiledRepository.run(CompiledRepository.java:540)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
03-06 18:52:53.156 3509-6069/? E/android.os.Debug: ro.product_ship = true
03-06 18:52:53.156 3509-6069/? E/android.os.Debug: ro.debug_level = 0x4f4c
03-06 18:52:53.156 3509-6069/? E/android.os.Debug: sys.mobilecare.preload = false
03-06 18:52:55.446 4399-4485/? E/ContactsProvider_EventLog: Flush buffer to file cnt : 15 size : 40Kb duration : 412ms lastUpdatedAfter : 152052ms
and this is how I initialize my Repository
`public <R> Repository<Result<R>> getRepository(Supplier<Result<R>> supplier) {
return Repositories
.repositoryWithInitialValue(Result.<R>absent())
.observe()
.onUpdatesPerLoop()
.goTo(Executors.newSingleThreadExecutor())
.attemptGetFrom(supplier)
.orEnd(Result::failure)
.thenTransform(Result::success)
.compile();
}`
it is a generic method as you see to use it with different datatype and thats why I don't know how to use
absenceIfNull
and this is how I use it with retrofit 2
`private CareemAPI getRetrofitAPI(String baseUrl, Class<CareemAPI> uberAPIClass) throws Exception {
if (baseUrl == null) throw new Exception();
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder()
.connectTimeout(60, TimeUnit.SECONDS)
.addInterceptor(loggingInterceptor)
.addInterceptor(chain -> {
Request request = chain.request();
request = request.newBuilder().addHeader("Authorization", Config.CAREEM_TOKEN).build();
return chain.proceed(request);
})
.build();
Retrofit retrofit = new Retrofit.Builder()
.client(client)
.addCallAdapterFactory(AgeraCallAdapterFactory.create())
.addConverterFactory(GsonConverterFactory.create())
.baseUrl(baseUrl)
.build();
return retrofit.create(uberAPIClass);
}`
the problem when I do a DELETE request which return empty response then Agera throws this exception
thanks for your intention :)
from agera.
Related Issues (20)
- Compilation problems HOT 1
- Crash when trying to remove not added updatable HOT 1
- Add the 1.2.0 release to the GitHub releases screen HOT 1
- [Question] Usages of non main thread to register an Updatable to a BaseObservable? HOT 5
- Wish to support Kotlin language.
- crash bug HOT 3
- About IdentityMultimap query. HOT 3
- Is this library dead? HOT 2
- [question] Push Event on a high speed frequency, Pull Data will too busy to attend to all HOT 2
- Query HOT 3
- [Query]: About switch work-thread HOT 10
- Agera 是否支持线程并发再合并? HOT 1
- #44
- (gradle4.4.1, agera1.4.0) when I run proguard, I got these warnings:
- Could not find dependency "com.google.android.agera:agera:1.4.0" HOT 6
- Sample doesn't build, is this project dead? HOT 7
- Androidx支持
- Deploy the last artifact outside of jcenter HOT 1
- Security Policy violation Binary Artifacts HOT 41
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 agera.