最近几天以来,我在 logcart 中遇到了一个异常,该异常是由凌空lib生成的,但最有趣的是它不会损害执行。
任何人,请帮助为什么会发生这种情况。
我正在将volley lib 1.1与android Target SDK版本27一起使用。
minSdkVersion 16
targetSdkVersion 27
/* Volley dependency */
compile 'com.android.volley:volley:1.1.0'
这些我得到的日志
E/Volley: [538] HttpHeaderParser.parseDateAsEpoch: Unable to parse dateStr: Thu, 01 Jan 1970 05:30:00 IST, falling back to 0
java.text.ParseException: Unparseable date: "Thu, 01 Jan 1970 05:30:00 IST"
at java.text.DateFormat.parse(DateFormat.java:362)
at com.android.volley.toolbox.HttpHeaderParser.parseDateAsEpoch(HttpHeaderParser.java:142)
at com.android.volley.toolbox.HttpHeaderParser.parseCacheHeaders(HttpHeaderParser.java:100)
at com.android.volley.toolbox.JsonObjectRequest.parseNetworkResponse(JsonObjectRequest.java:69)
at com.android.volley.NetworkDispatcher.processRequest(NetworkDispatcher.java:132)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:87)
排球执行代码:
public void executeRequest(String url) {
try {
JsonObjectRequest jsonObjReq = new JsonObjectRequest(method, url, paramObject, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject jsonObject) {
try {
Log.d(Constants.DEBUG_TAG, "** Result ***: " + jsonObject);
if (jsonObject != null) {
listener.onSuccess(jsonObject, someFlag);
} else {
// If response is NULL or some error in format then show server error
listener.onServerError(context.getResources().getString(R.string.oops_error));
}
} catch (Exception e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError e) {
e.printStackTrace();
listener.onServerError(context.getResources().getString(R.string.oops_error));
}
}) {
/**
* Passing some request headers
* */
@Override
public Map<String, String> getHeaders() throws AuthFailureError {
return headersParam;
}
};
jsonObjReq.setRetryPolicy(new DefaultRetryPolicy(90000,
DefaultRetryPolicy.DEFAULT_MAX_RETRIES,
DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
// Adding request to request queue
NSApplication.getInstance().addToRequestQueue(jsonObjReq);
} catch (Exception e) {
e.printStackTrace();
listener.onServerError(context.getString(R.string.oops_error));
}
}
调用排球方法
HashMap<String, String> headerMap = new HashMap<>();
headerMap.put("Content-Type", "application/json");
VolleyConnection connection = new VolleyConnection(this, this, LOAD_ADDRESS, headerMap);
connection.executeRequest(WebApi.GET_ADDRESS + preference.getUserId());