DBZ-1621 Remove useless null check

This commit is contained in:
pan3793 2019-11-19 09:04:04 +08:00 committed by Gunnar Morling
parent 91f0c2a520
commit 33384098fd

View File

@ -250,22 +250,20 @@ public static InputStream getResourceAsStream(String resourcePath,
resourceDesc = resourcePath;
}
InputStream result = null;
if (result == null) {
try {
// Try absolute path ...
Path filePath = FileSystems.getDefault().getPath(resourcePath).toAbsolutePath();
File f = filePath.toFile();
if (f.exists() && f.isFile() && f.canRead()) {
result = new BufferedInputStream(new FileInputStream(f));
}
logMessage(result, logger, resourceDesc, "on filesystem at " + filePath);
}
catch (InvalidPathException e) {
// just continue ...
}
catch (FileNotFoundException e) {
// just continue ...
try {
// Try absolute path ...
Path filePath = FileSystems.getDefault().getPath(resourcePath).toAbsolutePath();
File f = filePath.toFile();
if (f.exists() && f.isFile() && f.canRead()) {
result = new BufferedInputStream(new FileInputStream(f));
}
logMessage(result, logger, resourceDesc, "on filesystem at " + filePath);
}
catch (InvalidPathException e) {
// just continue ...
}
catch (FileNotFoundException e) {
// just continue ...
}
if (result == null) {
try {