diff --git a/core/src/main/java/io/snabble/sdk/ProductDatabase.java b/core/src/main/java/io/snabble/sdk/ProductDatabase.java index 30cfb4f282..60c346df3d 100644 --- a/core/src/main/java/io/snabble/sdk/ProductDatabase.java +++ b/core/src/main/java/io/snabble/sdk/ProductDatabase.java @@ -354,6 +354,7 @@ synchronized void applyDeltaUpdate(InputStream inputStream) throws IOException { tempDb.beginTransaction(); } catch (SQLiteException e) { project.logErrorEvent("Could not apply delta update: Could not access temp database"); + tempDb.close(); throw new IOException(); } @@ -390,6 +391,7 @@ synchronized void applyDeltaUpdate(InputStream inputStream) throws IOException { tempDb.endTransaction(); } catch (SQLiteException e) { project.logErrorEvent("Could not apply delta update: Could not finish transaction on temp database"); + tempDb.close(); throw new IOException(); } @@ -400,6 +402,7 @@ synchronized void applyDeltaUpdate(InputStream inputStream) throws IOException { tempDb.execSQL("VACUUM"); } catch (SQLiteException e) { project.logErrorEvent("Could not apply delta update: %s", e.getMessage()); + tempDb.close(); deleteDatabase(tempDbFile); throw new IOException(); } @@ -413,6 +416,7 @@ synchronized void applyDeltaUpdate(InputStream inputStream) throws IOException { swap(tempDbFile); } catch (IOException e) { project.logErrorEvent("Could not apply delta update: %s", e.getMessage()); + tempDb.close(); throw new IOException(); }