Comments (9)
public abstract class BaseRequest {
protected Call createCall() {
for (Field field : fields) {
// 前提是这个字段值不能为空(基本数据类型有默认的值,而对象默认的值为 null)
if (EasyUtils.isEmpty(value)) {
// 遍历下一个字段
continue;
}
}
}
}
from easyhttp.
小伙子,你的假设不成立,value 值永远不可能为空
from easyhttp.
如果你这边在实际开发中有遇到报错的话,麻烦发一下报错的堆栈给我。
from easyhttp.
是不是我没说清楚呢,我的意思不是private Map<String, Object> params = null;
而是
private Map<String, Object> params = new HashMap();
params.put("name", null);
这种情况下,会报空指针异常
params.put("name", "张三");
这种情况不会
from easyhttp.
AndroidRuntime: FATAL EXCEPTION: main
Process: com.xxx.sss, PID: 4633
java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.Class java.lang.Object.getClass()' on a null object reference
at com.hjq.http.EasyUtils.beanToHashMap(EasyUtils.java:259)
at com.hjq.http.EasyUtils.mapToJsonObject(EasyUtils.java:241)
at com.hjq.http.request.BaseRequest.createCall(BaseRequest.java:273)
at com.hjq.http.request.BaseRequest.lambda$request$0$BaseRequest(BaseRequest.java:314)
at com.hjq.http.request.-$$Lambda$BaseRequest$FJCESaX9RFKrH0DJLNTxr4jKczA.run(Unknown Source:6)
at android.os.Handler.handleCallback(Handler.java:938)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:236)
at android.app.ActivityThread.main(ActivityThread.java:7876)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:656)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:967)
from easyhttp.
from easyhttp.
@Skqing 经过核实,确实存在这个问题,问题已经纠正,多谢小伙子的提醒。
from easyhttp.
由于问题影响范围比较小,会在下个版本更新上去,小伙子你如果着急用的话,可以先用这个包作为本地依赖。
from easyhttp.
好的,多谢!
from easyhttp.
Related Issues (20)
- [疑惑]:请求数据接口加密和接口返回数据解密在哪进行拦截? HOT 3
- [疑惑]:异步HTTP请求完成后如何渲染数据 HOT 2
- [疑惑]:其实不用传入setLifecycleOwner对象的 HOT 4
- [疑惑]:我在APP里面集成了easyHttp,然后集成了一个第三方库,也集成了easyHttp 应该怎么分别调用 HOT 2
- [疑惑]:后端需要一个参数值为 null,但是设置为 null 后参数不会提交给后台 HOT 3
- [疑惑]:看文档介绍该框架是支持Android API 14及以上即可,我的设备是API 19的(Android4.4.2),但是使用此框架访问接口报了这个错误 HOT 5
- [Bug]:请求头参数的字母被转成小写了 HOT 2
- [建议]:是否支持文件上传断点续传 HOT 2
- [Bug]:下载txt文件 进度是-1,其他文件正常,跟文件有关系吗
- [疑惑]:Get请求能否实现 https://ebook/note/delete/{id} 将id传入进去?路径传参好像一时半会儿还没找到解决办法 HOT 1
- [疑惑]:get请求,如何把接收的参数回调成string HOT 1
- [疑惑]:是否考虑支持viewModle HOT 1
- 接口直接返回了一个音频文件,这个框架该怎么处理呢? HOT 14
- [Bug]:java.lang.NoSuchMethodError: No direct method <init>(Ljava/util/Map;)V in class Lcom/google/gson/internal/ConstructorConstructor; or its super classes (declaration of 'com.google.gson.internal.ConstructorConstructor' HOT 1
- [疑惑]:发起get请求请求头的问题 HOT 2
- [疑惑]:USE_CACHE_FIRST缓存的问题 HOT 6
- [Bug]:调用接口报错,debug正常,release包存在错误 HOT 6
- [Bug]:java.lang.ClassCastException: java.lang.Void cannot be cast to com.hjq.easy.demo.http.model.HttpData HOT 15
- 数据解析出错 HOT 2
- [Bug]:偶现接口请求发不出去,无反应 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 easyhttp.