代码:
@Override
public void fetchMyRides(final ArrayList<RideModel> listOfRides) {
ParseUser currentUser = ParseUser.getCurrentUser();
ParseQuery<RideModel> query = ParseQuery.getQuery(RideModel.class);
query.whereEqualTo("userObjectId", currentUser.getObjectId());
query.findInBackground(new FindCallback<RideModel>() {
@Override
public void done(List<RideModel> objects, ParseException e) {
if (e == null)
{
if (objects.size() > 0)
{
listOfRides.addAll(objects);
mListener.onFindRideSucess();
}
else
{
mListener.onFindRideNoResults();
}
}
else
{
Log.d(RoadPalApplication.TAG, "Find in background error : " + e.getLocalizedMessage());
Log.d(RoadPalApplication.TAG, "getCause: ", e.getCause());
mListener.onFindRideFailure(e);
}
}
});
}
Logcat错误:
01-02 19:11:44.453 1968-1968/? D/Road pal app: Find in background error : i/o failure
01-02 19:11:44.453 1968-1968/? D/Road pal app: getCause:
java.io.IOException: unknown format (magic number 227b)
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:101)
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:81)
at com.parse.ParseDecompressInterceptor.intercept(ParseDecompressInterceptor.java:40)
at com.parse.ParseHttpClient$ParseNetworkInterceptorChain.proceed(ParseHttpClient.java:147)
at com.parse.ParsePlugins$1.intercept(ParsePlugins.java:115)
at com.parse.ParseHttpClient$ParseNetworkInterceptorChain.proceed(ParseHttpClient.java:147)
at com.parse.ParseHttpClient.execute(ParseHttpClient.java:122)
at com.parse.ParseRequest$3.then(ParseRequest.java:135)
at com.parse.ParseRequest$3.then(ParseRequest.java:132)
at bolts.Task$15.run(Task.java:839)
at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
at bolts.Task.completeAfterTask(Task.java:830)
at bolts.Task.continueWithTask(Task.java:642)
at bolts.Task.continueWithTask(Task.java:653)
at bolts.Task$13.then(Task.java:745)
at bolts.Task$13.then(Task.java:733)
at bolts.Task$15.run(Task.java:839)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
at java.lang.Thread.run(Thread.java:856)
如果当前用户有超过2个RideModel结果,并且仿真器的api低于21,则会发生此错误。 如果我在模拟器5.0.0 v21上尝试它没有错误,并且成功检索所有对象。 发生了什么事?
答案 0 :(得分:0)
我遇到了同样的问题,“java.io.IOException:未知格式(幻数227b)”。
它将在我的4.2.2设备上抛出异常,但在4.4.2和6.0设备上没问题。
现在解析的最新版本是1.12.0。似乎回退到1.11.0并重新安装应用程序将停止异常抛出,虽然我不知道异常的根本原因
编译'com.parse:parse-android:1.11.0'