Skip to content

Commit 6c9c8ef

Browse files
committed
Polishing
1 parent b53995b commit 6c9c8ef

File tree

3 files changed

+10
-11
lines changed

3 files changed

+10
-11
lines changed

spring-core/src/main/java/org/springframework/core/io/AbstractFileResolvingResource.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@
1919
import java.io.File;
2020
import java.io.FileNotFoundException;
2121
import java.io.IOException;
22-
import java.io.InputStream;
2322
import java.net.HttpURLConnection;
2423
import java.net.URI;
2524
import java.net.URL;
@@ -112,14 +111,13 @@ else if (code == HttpURLConnection.HTTP_NOT_FOUND) {
112111
return true;
113112
}
114113
if (httpCon != null) {
115-
// no HTTP OK status, and no content-length header: give up
114+
// No HTTP OK status, and no content-length header: give up
116115
httpCon.disconnect();
117116
return false;
118117
}
119118
else {
120119
// Fall back to stream existence: can we open the stream?
121-
InputStream is = getInputStream();
122-
is.close();
120+
getInputStream().close();
123121
return true;
124122
}
125123
}
@@ -180,7 +178,6 @@ public long lastModified() throws IOException {
180178
return con.getLastModified();
181179
}
182180

183-
184181
/**
185182
* Customize the given {@link URLConnection}, obtained in the course of an
186183
* {@link #exists()}, {@link #contentLength()} or {@link #lastModified()} call.

spring-core/src/main/java/org/springframework/core/io/PathResource.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2017 the original author or authors.
2+
* Copyright 2002-2018 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -40,6 +40,8 @@
4040
* @author Juergen Hoeller
4141
* @since 4.0
4242
* @see java.nio.file.Path
43+
* @see java.nio.file.Files
44+
* @see FileSystemResource
4345
*/
4446
@UsesJava7
4547
public class PathResource extends AbstractResource implements WritableResource {
@@ -77,8 +79,8 @@ public PathResource(String path) {
7779
* <p>Note: Unlike {@link FileSystemResource}, when building relative resources
7880
* via {@link #createRelative}, the relative path will be built <i>underneath</i>
7981
* the given root: e.g. Paths.get("C:/dir1/"), relative path "dir2" -> "C:/dir1/dir2"!
80-
* @see java.nio.file.Paths#get(URI)
8182
* @param uri a path URI
83+
* @see java.nio.file.Paths#get(URI)
8284
*/
8385
public PathResource(URI uri) {
8486
Assert.notNull(uri, "URI must not be null");
@@ -95,7 +97,7 @@ public final String getPath() {
9597

9698
/**
9799
* This implementation returns whether the underlying file exists.
98-
* @see org.springframework.core.io.PathResource#exists()
100+
* @see java.nio.file.Files#exists(Path, java.nio.file.LinkOption...)
99101
*/
100102
@Override
101103
public boolean exists() {
@@ -186,7 +188,7 @@ public File getFile() throws IOException {
186188
}
187189

188190
/**
189-
* This implementation returns the underlying File's length.
191+
* This implementation returns the underlying file's length.
190192
*/
191193
@Override
192194
public long contentLength() throws IOException {

spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public MethodVisitor visitMethod(int access, String name, String desc, String si
8282
}
8383

8484
@Override
85-
public AnnotationVisitor visitAnnotation(final String desc, boolean visible) {
85+
public AnnotationVisitor visitAnnotation(String desc, boolean visible) {
8686
String className = Type.getType(desc).getClassName();
8787
this.annotationSet.add(className);
8888
return new AnnotationAttributesReadingVisitor(

0 commit comments

Comments
 (0)