Skip to content
Snippets Groups Projects
Commit dd2d758a authored by Raman's avatar Raman
Browse files

3488: missing write lock in CommunicationsManager

parent a0249850
No related branches found
No related tags found
No related merge requests found
...@@ -77,6 +77,7 @@ public class CommunicationsManager { ...@@ -77,6 +77,7 @@ public class CommunicationsManager {
*/ */
private void initAccountTypes() throws TskCoreException { private void initAccountTypes() throws TskCoreException {
CaseDbConnection connection = db.getConnection(); CaseDbConnection connection = db.getConnection();
db.acquireSingleUserCaseWriteLock();
Statement statement = null; Statement statement = null;
ResultSet resultSet = null; ResultSet resultSet = null;
...@@ -115,6 +116,7 @@ private void initAccountTypes() throws TskCoreException { ...@@ -115,6 +116,7 @@ private void initAccountTypes() throws TskCoreException {
closeResultSet(resultSet); closeResultSet(resultSet);
closeStatement(statement); closeStatement(statement);
connection.close(); connection.close();
db.releaseSingleUserCaseWriteLock();
} }
} }
...@@ -130,6 +132,7 @@ private void initAccountTypes() throws TskCoreException { ...@@ -130,6 +132,7 @@ private void initAccountTypes() throws TskCoreException {
*/ */
private int readAccountTypes() throws SQLException, TskCoreException { private int readAccountTypes() throws SQLException, TskCoreException {
CaseDbConnection connection = db.getConnection(); CaseDbConnection connection = db.getConnection();
db.acquireSingleUserCaseReadLock();
Statement statement = null; Statement statement = null;
ResultSet resultSet = null; ResultSet resultSet = null;
int count = 0; int count = 0;
...@@ -158,6 +161,7 @@ private int readAccountTypes() throws SQLException, TskCoreException { ...@@ -158,6 +161,7 @@ private int readAccountTypes() throws SQLException, TskCoreException {
closeResultSet(resultSet); closeResultSet(resultSet);
closeStatement(statement); closeStatement(statement);
connection.close(); connection.close();
db.releaseSingleUserCaseReadLock();
} }
return count; return count;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment