diff --git a/briar-api/src/org/briarproject/api/forum/ForumManager.java b/briar-api/src/org/briarproject/api/forum/ForumManager.java index bd5657b01bb8f6d262c036ffa676ce6f919c6f83..7c619294bea1b0777b355ab1f93af06433154190 100644 --- a/briar-api/src/org/briarproject/api/forum/ForumManager.java +++ b/briar-api/src/org/briarproject/api/forum/ForumManager.java @@ -31,6 +31,9 @@ public interface ForumManager { /** Returns the forum with the given ID. */ Forum getForum(GroupId g) throws DbException; + /** Returns the forum with the given ID. */ + Forum getForum(Transaction txn, GroupId g) throws DbException; + /** Returns all forums to which the user subscribes. */ Collection<Forum> getForums() throws DbException; diff --git a/briar-core/src/org/briarproject/forum/ForumManagerImpl.java b/briar-core/src/org/briarproject/forum/ForumManagerImpl.java index 63d4a2db832a983d99f774c43edf5127d161603c..d2a2b14d8a98f20f97fee4c14680b7c82e1adb56 100644 --- a/briar-core/src/org/briarproject/forum/ForumManagerImpl.java +++ b/briar-core/src/org/briarproject/forum/ForumManagerImpl.java @@ -141,15 +141,21 @@ class ForumManagerImpl implements ForumManager { @Override public Forum getForum(GroupId g) throws DbException { + Forum forum; + Transaction txn = db.startTransaction(true); try { - Group group; - Transaction txn = db.startTransaction(true); - try { - group = db.getGroup(txn, g); - txn.setComplete(); - } finally { - db.endTransaction(txn); - } + forum = getForum(txn, g); + txn.setComplete(); + } finally { + db.endTransaction(txn); + } + return forum; + } + + @Override + public Forum getForum(Transaction txn, GroupId g) throws DbException { + try { + Group group = db.getGroup(txn, g); return parseForum(group); } catch (FormatException e) { throw new DbException(e);