Archived
0

Sonar: [squid:S3725] Replace with a call to the "toFile().exists()" method

This commit is contained in:
2019-02-11 15:29:41 +03:00
parent 74f725eec4
commit 63b68c481b
3 changed files with 5 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ import org.apache.commons.io.IOUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.file.Files;
@@ -17,7 +18,7 @@ public class Main {
private static ApplicationContext createContext() {
final String springXml = System.getProperty("springConfig", "./spring.xml");
if (!Files.exists(Paths.get(springXml))) {
if (!(new File(springXml)).exists()) {
log.info("File \"{}\" not found. Get default config.", springXml);
try (FileOutputStream fos = new FileOutputStream(springXml)) {
IOUtils.copy(Main.class.getResourceAsStream("/spring.xml"), fos);