Skip to content

Commit 3d4a9dd

Browse files
committed
Polish StandardConfigDataResource
1 parent e7c26b9 commit 3d4a9dd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataResource.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ private boolean isSameUnderlyingResource(Resource ours, Resource other) {
106106
}
107107

108108
private boolean isSameFile(File ours, File other) {
109-
return (ours != null) && (other != null) && ours.equals(other);
109+
return (ours != null) && ours.equals(other);
110110
}
111111

112112
@Override
@@ -119,9 +119,10 @@ public int hashCode() {
119119
public String toString() {
120120
if (this.resource instanceof FileSystemResource || this.resource instanceof FileUrlResource) {
121121
try {
122-
return "file [" + this.resource.getFile().toString() + "]";
122+
return "file [" + this.resource.getFile() + "]";
123123
}
124124
catch (IOException ex) {
125+
// Ignore
125126
}
126127
}
127128
return this.resource.toString();
@@ -131,11 +132,11 @@ private File getUnderlyingFile(Resource resource) {
131132
try {
132133
if (resource instanceof ClassPathResource || resource instanceof FileSystemResource
133134
|| resource instanceof FileUrlResource) {
134-
File file = resource.getFile();
135-
return (file != null) ? file.getAbsoluteFile() : null;
135+
return resource.getFile().getAbsoluteFile();
136136
}
137137
}
138138
catch (IOException ex) {
139+
// Ignore
139140
}
140141
return null;
141142
}

0 commit comments

Comments
 (0)