aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-11-16 00:34:44 +0100
committeriNPUTmice <daniel@gultsch.de>2014-11-16 00:34:44 +0100
commit2b21bc13fcd9bb942798bc8f05603a512c1ffa3a (patch)
tree21f95dbf8214bbf68ce147874c415d4cda679c36 /src/main/java/eu
parent88c3537b6869996098da25954985fcb0c6971635 (diff)
parentac4eabbd2257217eebddfc33840a618e78a97cad (diff)
Merge branch 'master' into development
Diffstat (limited to 'src/main/java/eu')
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java23
1 files changed, 18 insertions, 5 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
index 38f4fdf1..6879a068 100644
--- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
@@ -150,7 +150,9 @@ public class DatabaseBackend extends SQLiteOpenHelper {
+ Conversation.TABLENAME + " where " + Conversation.STATUS
+ "=" + Conversation.STATUS_AVAILABLE, null);
cursor.moveToFirst();
- return cursor.getInt(0);
+ int count = cursor.getInt(0);
+ cursor.close();
+ return count;
}
public CopyOnWriteArrayList<Conversation> getConversations(int status) {
@@ -163,6 +165,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
while (cursor.moveToNext()) {
list.add(Conversation.fromCursor(cursor));
}
+ cursor.close();
return list;
}
@@ -196,6 +199,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
list.add(message);
} while (cursor.moveToPrevious());
}
+ cursor.close();
return list;
}
@@ -208,7 +212,9 @@ public class DatabaseBackend extends SQLiteOpenHelper {
if (cursor.getCount() == 0)
return null;
cursor.moveToFirst();
- return Conversation.fromCursor(cursor);
+ Conversation conversation = Conversation.fromCursor(cursor);
+ cursor.close();
+ return conversation;
}
public void updateConversation(Conversation conversation) {
@@ -320,7 +326,9 @@ public class DatabaseBackend extends SQLiteOpenHelper {
return null;
}
cursor.moveToFirst();
- return Conversation.fromCursor(cursor);
+ Conversation conversation = Conversation.fromCursor(cursor);
+ cursor.close();
+ return conversation;
}
public Message findMessageByUuid(String messageUuid) {
@@ -332,7 +340,9 @@ public class DatabaseBackend extends SQLiteOpenHelper {
return null;
}
cursor.moveToFirst();
- return Message.fromCursor(cursor);
+ Message message = Message.fromCursor(cursor);
+ cursor.close();
+ return message;
}
public Account findAccountByUuid(String accountUuid) {
@@ -344,7 +354,9 @@ public class DatabaseBackend extends SQLiteOpenHelper {
return null;
}
cursor.moveToFirst();
- return Account.fromCursor(cursor);
+ Account account = Account.fromCursor(cursor);
+ cursor.close();
+ return account;
}
public List<Message> getImageMessages(Conversation conversation) {
@@ -362,6 +374,7 @@ public class DatabaseBackend extends SQLiteOpenHelper {
list.add(message);
} while (cursor.moveToPrevious());
}
+ cursor.close();
return list;
}
}