Sonar: [squid:S3725] Replace with a call to the "toFile().exists()" method
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user