Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion owner/src/main/java/org/aeonbits/owner/util/Util.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URISyntaxException;
import java.nio.file.Files;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
Expand Down Expand Up @@ -200,7 +201,7 @@ public static void save(File target, Properties p) throws IOException {
if (isWindows()) {
store(target, p);
} else {
File tempFile = createTempFile(target.getName(), ".temp", parent);
File tempFile = Files.createTempFile(parent.toPath(), target.getName(), ".temp").toFile();
store(tempFile, p);
rename(tempFile, target);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.nio.file.Files;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.ScheduledExecutorService;
Expand Down Expand Up @@ -88,7 +89,7 @@ public void testListPrintWriter() throws IOException {
@Test
public void testStore() throws IOException {
AccessibleConfig cfg = ConfigFactory.create(AccessibleConfig.class);
File tmp = File.createTempFile("owner-", ".tmp");
File tmp = Files.createTempFile("owner-", ".tmp").toFile();
cfg.store(new FileOutputStream(tmp), "no comments");
assertTrue(tmp.exists());
assertTrue(tmp.length() > 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.io.FileInputStream;
import java.io.FileReader;
import java.io.IOException;
import java.nio.file.Files;
import java.util.Properties;

import static org.junit.Assert.assertEquals;
Expand Down Expand Up @@ -83,7 +84,7 @@ public void testClear() {

@Test
public void testLoadInputStream() throws IOException {
File temp = File.createTempFile("MutableConfigTest", ".properties");
File temp = Files.createTempFile("MutableConfigTest", ".properties").toFile();
UtilTest.save(temp, new Properties() {{
setProperty("minAge", "19");
setProperty("maxAge", "99");
Expand All @@ -97,7 +98,7 @@ public void testLoadInputStream() throws IOException {

@Test
public void testLoadReader() throws IOException {
File temp = File.createTempFile("MutableConfigTest", ".properties");
File temp = Files.createTempFile("MutableConfigTest", ".properties").toFile();
UtilTest.save(temp, new Properties() {{
setProperty("minAge", "19");
setProperty("maxAge", "99");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.Serializable;
import java.nio.file.Files;

import static java.io.File.createTempFile;
import static org.aeonbits.owner.util.Collections.map;
Expand Down Expand Up @@ -56,7 +57,7 @@ public static interface MyConfig extends Mutable {
public void before() throws IOException {
File parent = new File(RESOURCES_DIR);
parent.mkdirs();
target = createTempFile("TestSerialization", ".ser", parent);
target = Files.createTempFile(parent.toPath(), "TestSerialization", ".ser").toFile();
}

@After
Expand Down