BUGFIX 18

git-svn-id: https://osmand.googlecode.com/svn/trunk@460 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-08-17 08:16:33 +00:00
parent 8a4c74f1e2
commit ce4b324108

View file

@ -53,6 +53,7 @@ public class SQLiteBigPlanetIndex {
conn.setAutoCommit(false); conn.setAutoCommit(false);
pStatement = conn.prepareStatement("INSERT INTO tiles VALUES (?, ?, ?, ?, ?)"); pStatement = conn.prepareStatement("INSERT INTO tiles VALUES (?, ?, ?, ?, ?)");
int ch = 0; int ch = 0;
// be attentive to create buf enough for image
int bufSize = 32 * 1024; int bufSize = 32 * 1024;
byte[] buf = new byte[bufSize]; byte[] buf = new byte[bufSize];
int maxZoom = 17; int maxZoom = 17;
@ -81,7 +82,12 @@ public class SQLiteBigPlanetIndex {
} }
FileInputStream is = new FileInputStream(f); FileInputStream is = new FileInputStream(f);
int l = is.read(buf); int l = 0;
try {
l = is.read(buf);
} finally {
is.close();
}
if (l > 0) { if (l > 0) {
pStatement.setInt(1, x); pStatement.setInt(1, x);
pStatement.setInt(2, y); pStatement.setInt(2, y);