diff --git a/bindings/java/test/org/sleuthkit/datamodel/CommunicationsManagerTest.java b/bindings/java/test/org/sleuthkit/datamodel/CommunicationsManagerTest.java index 73b000e75b6abdafdf38c41e7ca1bb11c28b2b5e..a1c60a251ceffce30b9903dd899e13e18039f8b3 100644 --- a/bindings/java/test/org/sleuthkit/datamodel/CommunicationsManagerTest.java +++ b/bindings/java/test/org/sleuthkit/datamodel/CommunicationsManagerTest.java @@ -18,6 +18,7 @@ */ package org.sleuthkit.datamodel; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.Collection; @@ -238,9 +239,8 @@ public CommunicationsManagerTest() { @BeforeClass public static void setUpClass() { String tempDirPath = System.getProperty("java.io.tmpdir"); - tempDirPath = tempDirPath.substring(0, tempDirPath.length() - 1); try { - dbPath = tempDirPath + java.io.File.separator + TEST_DB; + dbPath = Paths.get(tempDirPath, TEST_DB).toString(); // Delete the DB file, in case java.io.File dbFile = new java.io.File(dbPath); diff --git a/bindings/java/test/org/sleuthkit/datamodel/DataModelTestSuite.java b/bindings/java/test/org/sleuthkit/datamodel/DataModelTestSuite.java index 6d52315e53bc92ce29c457279043cb6ed91c0c9f..2ec2da48f63072d83262cf107fb7c1375888d298 100644 --- a/bindings/java/test/org/sleuthkit/datamodel/DataModelTestSuite.java +++ b/bindings/java/test/org/sleuthkit/datamodel/DataModelTestSuite.java @@ -24,6 +24,7 @@ import java.io.FileWriter; import java.io.IOException; import java.io.OutputStreamWriter; +import java.nio.file.Paths; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; import java.util.ArrayList; @@ -232,7 +233,7 @@ private static String stripExtension(String title) { * @return the path for an output file */ public static String buildPath(String path, String name, String type, String Ext) { - return path + java.io.File.separator + name + type + Ext; + return Paths.get(path, name + type + Ext).toString(); } /**