Androidプログラミング質問スレ Part24
■ このスレッドは過去ログ倉庫に格納されています
0830デフォルトの名無しさん
2012/08/27(月) 21:24:13.39remoetInputStream = connection.getInputStream();
cacheOutputStream = new BufferedOutputStream(new FileOutputStream(
mCacheFile));
byte[] buf = new byte[BUF_SIZE];
int readSize;
while ((readSize = remoetInputStream.read(buf)) != -1 && !bStop) {
if (cacheOutputStream != null) {
try {
cacheOutputStream.write(buf, 0, readSize);
} catch (IOException e) {
Log.e("write cachefile", e);
try {
cacheOutputStream.close();
} catch (IOException ex) {
}
cacheOutputStream = null;
}
}
client.getOutputStream().write(buf, 0, readSize);
}
☆の位置でNullPointerExceptionが発生します
似たようなソースも見てみましたがNullPointerExceptionの対策がされてないようでした
本来はNullPointerExceptionが発生しない箇所なのでしょうか?
もしそうなら原因は何でしょうか?
URLはちゃんと接続できます
■ このスレッドは過去ログ倉庫に格納されています