diff --git a/bindings/java/src/org/sleuthkit/datamodel/EncodedFileOutputStream.java b/bindings/java/src/org/sleuthkit/datamodel/EncodedFileOutputStream.java index 7c0183e1dd..3fcf544d35 100644 --- a/bindings/java/src/org/sleuthkit/datamodel/EncodedFileOutputStream.java +++ b/bindings/java/src/org/sleuthkit/datamodel/EncodedFileOutputStream.java @@ -71,13 +71,13 @@ private void writeHeader() throws IOException { } @Override - public void write(int b) throws IOException { + public synchronized void write(int b) throws IOException { super.write((int) EncodedFileUtil.encodeByte((byte) b, type)); encodedDataLength++; } @Override - public void write(byte[] b, + public synchronized void write(byte[] b, int off, int len) throws IOException { diff --git a/bindings/java/src/org/sleuthkit/datamodel/OsAccountManager.java b/bindings/java/src/org/sleuthkit/datamodel/OsAccountManager.java index 35fb27bacc..9566ea174e 100755 --- a/bindings/java/src/org/sleuthkit/datamodel/OsAccountManager.java +++ b/bindings/java/src/org/sleuthkit/datamodel/OsAccountManager.java @@ -1386,6 +1386,7 @@ public Optional getLocalLinuxOsAccount(String uid, String loginName, } } + private final Object osAccountLockObj = new Object(); /** * Adds a rows to the tsk_os_account_attributes table for the given set of * attribute. @@ -1397,7 +1398,7 @@ public Optional getLocalLinuxOsAccount(String uid, String loginName, */ public void addExtendedOsAccountAttributes(OsAccount account, List accountAttributes) throws TskCoreException { - synchronized (account) { // synchronized to prevent multiple threads trying to add osAccount attributes concurrently to the same osAccount. + synchronized (osAccountLockObj) { // synchronized to prevent multiple threads trying to add osAccount attributes concurrently to the same osAccount. db.acquireSingleUserCaseWriteLock(); try (CaseDbConnection connection = db.getConnection()) { diff --git a/bindings/java/test/org/sleuthkit/datamodel/HashDbTest.java b/bindings/java/test/org/sleuthkit/datamodel/HashDbTest.java index 37868f875d..e79c6d4c15 100644 --- a/bindings/java/test/org/sleuthkit/datamodel/HashDbTest.java +++ b/bindings/java/test/org/sleuthkit/datamodel/HashDbTest.java @@ -61,7 +61,6 @@ public static Collection testImageData() { for (Object imagePaths : DataModelTestSuite.getImagePaths()) { data.add(new Object[]{imagePaths}); - break; } return data; }