Sonar: [squid:S3725] Replace with a call to the "toFile().exists()" method
This commit is contained in:
@@ -7,6 +7,7 @@ import mc.core.world.chunk.Chunk;
|
||||
import mc.core.world.chunk.ChunkProvider;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
@@ -20,7 +21,7 @@ public class AnvilChunkProvider implements ChunkProvider {
|
||||
|
||||
public AnvilChunkProvider(String mapPath) {
|
||||
Path pathMap = Paths.get(mapPath);
|
||||
if (Files.exists(pathMap)) {
|
||||
if (pathMap.toFile().exists()) {
|
||||
log.info("Use Anvil map from \"{}\"", pathMap);
|
||||
this.setRegionManager(new RegionManager(pathMap.resolve("region")));
|
||||
} else {
|
||||
|
||||
@@ -32,7 +32,7 @@ public class RegionManager {
|
||||
return regions.get(xz);
|
||||
} else {
|
||||
Path regionFilePath = regionFilesPath.resolve("r." + x + "." + z + ".mca");
|
||||
if (Files.exists(regionFilePath)) {
|
||||
if (regionFilePath.toFile().exists()) {
|
||||
try {
|
||||
Region region = new Region(regionFilePath.toFile());
|
||||
regions.put(xz, region);
|
||||
|
||||
@@ -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