diff --git a/spring-core/src/main/java/org/springframework/core/io/AbstractFileResolvingResource.java b/spring-core/src/main/java/org/springframework/core/io/AbstractFileResolvingResource.java index 7d1ef88e52..d6251427b1 100644 --- a/spring-core/src/main/java/org/springframework/core/io/AbstractFileResolvingResource.java +++ b/spring-core/src/main/java/org/springframework/core/io/AbstractFileResolvingResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,7 +19,6 @@ package org.springframework.core.io; import java.io.File; import java.io.FileNotFoundException; import java.io.IOException; -import java.io.InputStream; import java.net.HttpURLConnection; import java.net.URI; import java.net.URL; @@ -112,14 +111,13 @@ public abstract class AbstractFileResolvingResource extends AbstractResource { return true; } if (httpCon != null) { - // no HTTP OK status, and no content-length header: give up + // No HTTP OK status, and no content-length header: give up httpCon.disconnect(); return false; } else { // Fall back to stream existence: can we open the stream? - InputStream is = getInputStream(); - is.close(); + getInputStream().close(); return true; } } @@ -180,7 +178,6 @@ public abstract class AbstractFileResolvingResource extends AbstractResource { return con.getLastModified(); } - /** * Customize the given {@link URLConnection}, obtained in the course of an * {@link #exists()}, {@link #contentLength()} or {@link #lastModified()} call. diff --git a/spring-core/src/main/java/org/springframework/core/io/PathResource.java b/spring-core/src/main/java/org/springframework/core/io/PathResource.java index f046275136..c578c39bda 100644 --- a/spring-core/src/main/java/org/springframework/core/io/PathResource.java +++ b/spring-core/src/main/java/org/springframework/core/io/PathResource.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,6 +40,8 @@ import org.springframework.util.Assert; * @author Juergen Hoeller * @since 4.0 * @see java.nio.file.Path + * @see java.nio.file.Files + * @see FileSystemResource */ @UsesJava7 public class PathResource extends AbstractResource implements WritableResource { @@ -77,8 +79,8 @@ public class PathResource extends AbstractResource implements WritableResource { *
Note: Unlike {@link FileSystemResource}, when building relative resources * via {@link #createRelative}, the relative path will be built underneath * the given root: e.g. Paths.get("C:/dir1/"), relative path "dir2" -> "C:/dir1/dir2"! - * @see java.nio.file.Paths#get(URI) * @param uri a path URI + * @see java.nio.file.Paths#get(URI) */ public PathResource(URI uri) { Assert.notNull(uri, "URI must not be null"); @@ -95,7 +97,7 @@ public class PathResource extends AbstractResource implements WritableResource { /** * This implementation returns whether the underlying file exists. - * @see org.springframework.core.io.PathResource#exists() + * @see java.nio.file.Files#exists(Path, java.nio.file.LinkOption...) */ @Override public boolean exists() { @@ -186,7 +188,7 @@ public class PathResource extends AbstractResource implements WritableResource { } /** - * This implementation returns the underlying File's length. + * This implementation returns the underlying file's length. */ @Override public long contentLength() throws IOException { diff --git a/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor.java b/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor.java index 3b3a17dd60..341172fb18 100644 --- a/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor.java +++ b/spring-core/src/main/java/org/springframework/core/type/classreading/AnnotationMetadataReadingVisitor.java @@ -82,7 +82,7 @@ public class AnnotationMetadataReadingVisitor extends ClassMetadataReadingVisito } @Override - public AnnotationVisitor visitAnnotation(final String desc, boolean visible) { + public AnnotationVisitor visitAnnotation(String desc, boolean visible) { String className = Type.getType(desc).getClassName(); this.annotationSet.add(className); return new AnnotationAttributesReadingVisitor(