我在代码上遇到问题非常正常。 我正在运行一个异步任务来从android中的web服务器获取数据,问题是当控件进入异步任务中的readLine时我得到一个异常,详情如下:
library(ggplot2)
dtf <- data.frame(year = rep(1961:2010,2),
consumption = cumsum(rnorm(100)),
item = rep(c("Tea~bags","Coffee~beans"),each=50),
unit = rep(c("T","m^3"),each=50))
ggplot(data=dtf)+
geom_line(aes(x=year, y=consumption),size=1) +
ylab(expression(paste("Consumption in T or ",m^3))) +
scale_x_continuous(breaks = seq(1960,2010,10)) +
theme_bw() + facet_wrap(item~unit, scales = "free_y",labeller = label_parsed)
堆栈跟踪:
BufferedReader reader = new BufferedReader(new
InputStreamReader(conn.getInputStream()));
StringBuffer sb = new StringBuffer("");
String line = "";
while ((line = reader.readLine()) != null) {
sb.append(line);
break;
}
我知道php中的数据没有损坏,我可以看到它正确地返回了对象。
05-24 21:10:41.261 11232-11476/com.fiesta W/System.err: java.io.IOException: java.util.zip.DataFormatException: invalid distance too far back
05-24 21:10:41.263 11232-11476/com.fiesta W/System.err: at com.android.okhttp.okio.InflaterSource.read(InflaterSource.java:84)
05-24 21:10:41.263 11232-11476/com.fiesta W/System.err: at com.android.okhttp.okio.GzipSource.read(GzipSource.java:80)
05-24 21:10:41.264 11232-11476/com.fiesta W/System.err: at com.android.okhttp.okio.RealBufferedSource$1.read(RealBufferedSource.java:349)
05-24 21:10:41.265 11232-11476/com.fiesta W/System.err: at java.io.InputStreamReader.read(InputStreamReader.java:233)
05-24 21:10:41.266 11232-11476/com.fiesta W/System.err: at java.io.BufferedReader.fillBuf(BufferedReader.java:145)
05-24 21:10:41.268 11232-11476/com.fiesta W/System.err: at java.io.BufferedReader.readLine(BufferedReader.java:397)
05-24 21:10:41.270 11232-11476/com.fiesta W/System.err: at com.fiesta.SearchPeople$1GetPeople.doInBackground(SearchPeople.java:131)
05-24 21:10:41.271 11232-11476/com.fiesta W/System.err: at com.fiesta.SearchPeople$1GetPeople.doInBackground(SearchPeople.java:96)
05-24 21:10:41.272 11232-11476/com.fiesta W/System.err: at android.os.AsyncTask$2.call(AsyncTask.java:295)
05-24 21:10:41.273 11232-11476/com.fiesta W/System.err: at java.util.concurrent.FutureTask.run(FutureTask.java:237)
05-24 21:10:41.275 11232-11476/com.fiesta W/System.err: at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
05-24 21:10:41.276 11232-11476/com.fiesta W/System.err: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
05-24 21:10:41.277 11232-11476/com.fiesta W/System.err: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
05-24 21:10:41.279 11232-11476/com.fiesta W/System.err: at java.lang.Thread.run(Thread.java:818)
05-24 21:10:41.280 11232-11476/com.fiesta W/System.err: Caused by: java.util.zip.DataFormatException: invalid distance too far back
05-24 21:10:41.282 11232-11476/com.fiesta W/System.err: at java.util.zip.Inflater.inflateImpl(Native Method)
05-24 21:10:41.283 11232-11476/com.fiesta W/System.err: at java.util.zip.Inflater.inflate(Inflater.java:237)
05-24 21:10:41.284 11232-11476/com.fiesta W/System.err: at com.android.okhttp.okio.InflaterSource.read(InflaterSource.java:67)
05-24 21:10:41.285 11232-11476/com.fiesta W/System.err: ... 13 more
&GT;
这个问题突然出现,我知道这不是代码问题,因为没有进行代码更改,而且这个问题开始了。 请建议。
答案 0 :(得分:0)
错误地解析数据时可能会引发错误。