From 3d4a9dd059b72deac1868d3e08a13480cc66936a Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Tue, 31 Oct 2023 09:39:05 +0100 Subject: [PATCH] Polish StandardConfigDataResource --- .../boot/context/config/StandardConfigDataResource.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataResource.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataResource.java index ccf175f555..aac0897413 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataResource.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataResource.java @@ -106,7 +106,7 @@ public class StandardConfigDataResource extends ConfigDataResource { } private boolean isSameFile(File ours, File other) { - return (ours != null) && (other != null) && ours.equals(other); + return (ours != null) && ours.equals(other); } @Override @@ -119,9 +119,10 @@ public class StandardConfigDataResource extends ConfigDataResource { public String toString() { if (this.resource instanceof FileSystemResource || this.resource instanceof FileUrlResource) { try { - return "file [" + this.resource.getFile().toString() + "]"; + return "file [" + this.resource.getFile() + "]"; } catch (IOException ex) { + // Ignore } } return this.resource.toString(); @@ -131,11 +132,11 @@ public class StandardConfigDataResource extends ConfigDataResource { try { if (resource instanceof ClassPathResource || resource instanceof FileSystemResource || resource instanceof FileUrlResource) { - File file = resource.getFile(); - return (file != null) ? file.getAbsoluteFile() : null; + return resource.getFile().getAbsoluteFile(); } } catch (IOException ex) { + // Ignore } return null; }