diff --git a/OsmAnd-java/src/main/java/net/osmand/map/MapTileDownloader.java b/OsmAnd-java/src/main/java/net/osmand/map/MapTileDownloader.java index b3d057630e..058942f494 100644 --- a/OsmAnd-java/src/main/java/net/osmand/map/MapTileDownloader.java +++ b/OsmAnd-java/src/main/java/net/osmand/map/MapTileDownloader.java @@ -7,7 +7,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.lang.ref.WeakReference; -import java.net.URL; import java.net.URLConnection; import java.net.UnknownHostException; import java.util.ArrayList; diff --git a/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java b/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java index 925f886a19..b5a466cb8b 100644 --- a/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java +++ b/OsmAnd-java/src/main/java/net/osmand/util/Algorithms.java @@ -484,6 +484,10 @@ public class Algorithms { } public static StringBuilder readFromInputStream(InputStream i) throws IOException { + return readFromInputStream(i, true); + } + + public static StringBuilder readFromInputStream(InputStream i, boolean autoclose) throws IOException { StringBuilder responseBody = new StringBuilder(); responseBody.setLength(0); if (i != null) { @@ -498,7 +502,9 @@ public class Algorithms { } responseBody.append(s); } - i.close(); + if (autoclose) { + i.close(); + } } return responseBody; }