File tree Expand file tree Collapse file tree 11 files changed +33
-36
lines changed
spring-core/src/main/java/org/springframework/core/io Expand file tree Collapse file tree 11 files changed +33
-36
lines changed Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2022 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -56,8 +56,7 @@ public boolean exists() {
56
56
// Try a URL connection content-length header
57
57
URLConnection con = url .openConnection ();
58
58
customizeConnection (con );
59
- HttpURLConnection httpCon =
60
- (con instanceof HttpURLConnection ? (HttpURLConnection ) con : null );
59
+ HttpURLConnection httpCon = (con instanceof HttpURLConnection huc ? huc : null );
61
60
if (httpCon != null ) {
62
61
httpCon .setRequestMethod ("HEAD" );
63
62
int code = httpCon .getResponseCode ();
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2022 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -226,9 +226,9 @@ public String getFilename() {
226
226
* @see #getDescription()
227
227
*/
228
228
@ Override
229
- public boolean equals (@ Nullable Object other ) {
230
- return (this == other || (other instanceof Resource &&
231
- (( Resource ) other ). getDescription ().equals (getDescription ())));
229
+ public boolean equals (@ Nullable Object obj ) {
230
+ return (this == obj || (obj instanceof Resource that &&
231
+ getDescription ().equals (that . getDescription ())));
232
232
}
233
233
234
234
/**
Original file line number Diff line number Diff line change @@ -129,9 +129,9 @@ public String getDescription() {
129
129
* @see java.util.Arrays#equals(byte[], byte[])
130
130
*/
131
131
@ Override
132
- public boolean equals (@ Nullable Object other ) {
133
- return (this == other || (other instanceof ByteArrayResource &&
134
- Arrays .equals ((( ByteArrayResource ) other ) .byteArray , this .byteArray )));
132
+ public boolean equals (@ Nullable Object obj ) {
133
+ return (this == obj || (obj instanceof ByteArrayResource that &&
134
+ Arrays .equals (this .byteArray , that .byteArray )));
135
135
}
136
136
137
137
/**
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2022 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -272,9 +272,9 @@ public boolean equals(@Nullable Object obj) {
272
272
if (this == obj ) {
273
273
return true ;
274
274
}
275
- return ((obj instanceof ClassPathResource other ) &&
276
- this .absolutePath .equals (other .absolutePath ) &&
277
- ObjectUtils .nullSafeEquals (getClassLoader (), other .getClassLoader ()));
275
+ return ((obj instanceof ClassPathResource that ) &&
276
+ this .absolutePath .equals (that .absolutePath ) &&
277
+ ObjectUtils .nullSafeEquals (getClassLoader (), that .getClassLoader ()));
278
278
}
279
279
280
280
/**
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2018 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -72,9 +72,9 @@ public String getDescription() {
72
72
* This implementation compares the underlying description String.
73
73
*/
74
74
@ Override
75
- public boolean equals (@ Nullable Object other ) {
76
- return (this == other || (other instanceof DescriptiveResource &&
77
- (( DescriptiveResource ) other ) .description .equals (this .description )));
75
+ public boolean equals (@ Nullable Object obj ) {
76
+ return (this == obj || (obj instanceof DescriptiveResource that &&
77
+ this .description .equals (that .description )));
78
78
}
79
79
80
80
/**
Original file line number Diff line number Diff line change @@ -396,8 +396,7 @@ public String getDescription() {
396
396
*/
397
397
@ Override
398
398
public boolean equals (@ Nullable Object obj ) {
399
- return (this == obj || (obj instanceof FileSystemResource other &&
400
- this .path .equals (other .path )));
399
+ return (this == obj || (obj instanceof FileSystemResource that && this .path .equals (that .path )));
401
400
}
402
401
403
402
/**
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2018 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -115,9 +115,9 @@ public String getDescription() {
115
115
* This implementation compares the underlying InputStream.
116
116
*/
117
117
@ Override
118
- public boolean equals (@ Nullable Object other ) {
119
- return (this == other || (other instanceof InputStreamResource &&
120
- (( InputStreamResource ) other ) .inputStream .equals (this .inputStream )));
118
+ public boolean equals (@ Nullable Object obj ) {
119
+ return (this == obj || (obj instanceof InputStreamResource that &&
120
+ this .inputStream .equals (that .inputStream )));
121
121
}
122
122
123
123
/**
Original file line number Diff line number Diff line change @@ -298,9 +298,8 @@ public String getDescription() {
298
298
* This implementation compares the underlying Path references.
299
299
*/
300
300
@ Override
301
- public boolean equals (@ Nullable Object other ) {
302
- return (this == other || (other instanceof PathResource &&
303
- this .path .equals (((PathResource ) other ).path )));
301
+ public boolean equals (@ Nullable Object obj ) {
302
+ return (this == obj || (obj instanceof PathResource that && this .path .equals (that .path )));
304
303
}
305
304
306
305
/**
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2022 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -343,9 +343,9 @@ public String getDescription() {
343
343
* This implementation compares the underlying URL references.
344
344
*/
345
345
@ Override
346
- public boolean equals (@ Nullable Object other ) {
347
- return (this == other || (other instanceof UrlResource resource &&
348
- getCleanedUrl ().equals (resource .getCleanedUrl ())));
346
+ public boolean equals (@ Nullable Object obj ) {
347
+ return (this == obj || (obj instanceof UrlResource that &&
348
+ getCleanedUrl ().equals (that .getCleanedUrl ())));
349
349
}
350
350
351
351
/**
Original file line number Diff line number Diff line change 1
1
/*
2
- * Copyright 2002-2022 the original author or authors.
2
+ * Copyright 2002-2023 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
@@ -130,9 +130,9 @@ public String getDescription() {
130
130
}
131
131
132
132
@ Override
133
- public boolean equals (@ Nullable Object other ) {
134
- return (this == other || (other instanceof VfsResource &&
135
- this .resource .equals ((( VfsResource ) other ) .resource )));
133
+ public boolean equals (@ Nullable Object obj ) {
134
+ return (this == obj || (obj instanceof VfsResource that &&
135
+ this .resource .equals (that .resource )));
136
136
}
137
137
138
138
@ Override
Original file line number Diff line number Diff line change @@ -808,7 +808,7 @@ protected Set<Resource> doFindPathMatchingFileResources(Resource rootDirResource
808
808
809
809
Set <Resource > result = new LinkedHashSet <>();
810
810
try (Stream <Path > files = Files .walk (rootPath )) {
811
- files .filter (isMatchingFile ).sorted ().forEach (file -> result . add ( new FileSystemResource ( file )) );
811
+ files .filter (isMatchingFile ).sorted ().map ( FileSystemResource :: new ). forEach (result :: add );
812
812
}
813
813
catch (Exception ex ) {
814
814
if (logger .isWarnEnabled ()) {
You can’t perform that action at this time.
0 commit comments