From 5c05b81dfa0ee3851526be4ca67b141c33228d17 Mon Sep 17 00:00:00 2001 From: Hannes Janetzek Date: Mon, 24 Feb 2014 16:29:54 +0100 Subject: [PATCH] LwHttp, ignore readers that try to close InputStream. --- vtm/src/org/oscim/tiling/source/LwHttp.java | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/vtm/src/org/oscim/tiling/source/LwHttp.java b/vtm/src/org/oscim/tiling/source/LwHttp.java index 228f7ac4..66f959d9 100644 --- a/vtm/src/org/oscim/tiling/source/LwHttp.java +++ b/vtm/src/org/oscim/tiling/source/LwHttp.java @@ -148,6 +148,12 @@ public class LwHttp { return bytesRead == contentLength; } + @Override + public void close() throws IOException { + if (dbg) + log.debug("close()... ignored"); + } + @Override public synchronized void mark(int readlimit) { if (dbg) @@ -205,8 +211,8 @@ public class LwHttp { if (data >= 0) bytesRead += 1; - if (dbg) - log.debug("read {} {}", bytesRead, contentLength); + //if (dbg) + // log.debug("read {} {}", bytesRead, contentLength); if (cache != null && bytesRead > bytesWrote) { bytesWrote = bytesRead; @@ -332,8 +338,15 @@ public class LwHttp { close(); else if (System.nanoTime() - mLastRequest > RESPONSE_TIMEOUT) close(); - else if (mResponseStream.available() > 0) - close(); + else { + try { + if (mResponseStream.available() > 0) + close(); + } catch (IOException e) { + log.debug(e.getMessage()); + close(); + } + } } if (mSocket == null) {