Skip to content

Commit 9e12a20

Browse files
committed
Polishing
1 parent c4326cb commit 9e12a20

File tree

6 files changed

+26
-21
lines changed

6 files changed

+26
-21
lines changed

spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/AbstractInterfaceDrivenDependencyInjectionAspect.aj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2020 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.
@@ -67,6 +67,7 @@ import java.io.Serializable;
6767
* @since 2.5.2
6868
*/
6969
public abstract aspect AbstractInterfaceDrivenDependencyInjectionAspect extends AbstractDependencyInjectionAspect {
70+
7071
/**
7172
* Select initialization join point as object construction
7273
*/

spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/AnnotationBeanConfigurerAspect.aj

Lines changed: 6 additions & 2 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-2020 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.
@@ -47,22 +47,26 @@ import org.springframework.beans.factory.wiring.BeanConfigurerSupport;
4747
public aspect AnnotationBeanConfigurerAspect extends AbstractInterfaceDrivenDependencyInjectionAspect
4848
implements BeanFactoryAware, InitializingBean, DisposableBean {
4949

50-
private BeanConfigurerSupport beanConfigurerSupport = new BeanConfigurerSupport();
50+
private final BeanConfigurerSupport beanConfigurerSupport = new BeanConfigurerSupport();
5151

5252

53+
@Override
5354
public void setBeanFactory(BeanFactory beanFactory) {
5455
this.beanConfigurerSupport.setBeanWiringInfoResolver(new AnnotationBeanWiringInfoResolver());
5556
this.beanConfigurerSupport.setBeanFactory(beanFactory);
5657
}
5758

59+
@Override
5860
public void afterPropertiesSet() {
5961
this.beanConfigurerSupport.afterPropertiesSet();
6062
}
6163

64+
@Override
6265
public void configureBean(Object bean) {
6366
this.beanConfigurerSupport.configureBean(bean);
6467
}
6568

69+
@Override
6670
public void destroy() {
6771
this.beanConfigurerSupport.destroy();
6872
}

spring-core/src/main/java/org/springframework/util/FileCopyUtils.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -171,15 +171,15 @@ public static int copy(Reader in, Writer out) throws IOException {
171171
Assert.notNull(out, "No Writer specified");
172172

173173
try {
174-
int byteCount = 0;
174+
int charCount = 0;
175175
char[] buffer = new char[BUFFER_SIZE];
176-
int bytesRead = -1;
177-
while ((bytesRead = in.read(buffer)) != -1) {
178-
out.write(buffer, 0, bytesRead);
179-
byteCount += bytesRead;
176+
int charsRead;
177+
while ((charsRead = in.read(buffer)) != -1) {
178+
out.write(buffer, 0, charsRead);
179+
charCount += charsRead;
180180
}
181181
out.flush();
182-
return byteCount;
182+
return charCount;
183183
}
184184
finally {
185185
close(in);
@@ -188,7 +188,7 @@ public static int copy(Reader in, Writer out) throws IOException {
188188
}
189189

190190
/**
191-
* Copy the contents of the given String to the given output Writer.
191+
* Copy the contents of the given String to the given Writer.
192192
* Closes the writer when done.
193193
* @param in the String to copy from
194194
* @param out the Writer to copy to

spring-core/src/main/java/org/springframework/util/StreamUtils.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ public static String copyToString(@Nullable InputStream in, Charset charset) thr
8787
StringBuilder out = new StringBuilder();
8888
InputStreamReader reader = new InputStreamReader(in, charset);
8989
char[] buffer = new char[BUFFER_SIZE];
90-
int bytesRead = -1;
91-
while ((bytesRead = reader.read(buffer)) != -1) {
92-
out.append(buffer, 0, bytesRead);
90+
int charsRead;
91+
while ((charsRead = reader.read(buffer)) != -1) {
92+
out.append(buffer, 0, charsRead);
9393
}
9494
return out.toString();
9595
}
@@ -130,7 +130,7 @@ public static void copy(byte[] in, OutputStream out) throws IOException {
130130
}
131131

132132
/**
133-
* Copy the contents of the given String to the given output OutputStream.
133+
* Copy the contents of the given String to the given OutputStream.
134134
* <p>Leaves the stream open when done.
135135
* @param in the String to copy from
136136
* @param charset the Charset
@@ -161,7 +161,7 @@ public static int copy(InputStream in, OutputStream out) throws IOException {
161161

162162
int byteCount = 0;
163163
byte[] buffer = new byte[BUFFER_SIZE];
164-
int bytesRead = -1;
164+
int bytesRead;
165165
while ((bytesRead = in.read(buffer)) != -1) {
166166
out.write(buffer, 0, bytesRead);
167167
byteCount += bytesRead;

spring-web/src/main/java/org/springframework/web/context/request/WebRequest.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2020 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.
@@ -140,7 +140,7 @@ public interface WebRequest extends RequestAttributes {
140140
* and HTTP status when applicable.
141141
* <p>Typical usage:
142142
* <pre class="code">
143-
* public String myHandleMethod(WebRequest webRequest, Model model) {
143+
* public String myHandleMethod(WebRequest request, Model model) {
144144
* long lastModified = // application-specific calculation
145145
* if (request.checkNotModified(lastModified)) {
146146
* // shortcut exit - no further processing necessary
@@ -177,7 +177,7 @@ public interface WebRequest extends RequestAttributes {
177177
* and HTTP status when applicable.
178178
* <p>Typical usage:
179179
* <pre class="code">
180-
* public String myHandleMethod(WebRequest webRequest, Model model) {
180+
* public String myHandleMethod(WebRequest request, Model model) {
181181
* String eTag = // application-specific calculation
182182
* if (request.checkNotModified(eTag)) {
183183
* // shortcut exit - no further processing necessary
@@ -208,7 +208,7 @@ public interface WebRequest extends RequestAttributes {
208208
* response headers, and HTTP status when applicable.
209209
* <p>Typical usage:
210210
* <pre class="code">
211-
* public String myHandleMethod(WebRequest webRequest, Model model) {
211+
* public String myHandleMethod(WebRequest request, Model model) {
212212
* String eTag = // application-specific calculation
213213
* long lastModified = // application-specific calculation
214214
* if (request.checkNotModified(eTag, lastModified)) {

src/docs/asciidoc/web/webmvc.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4835,7 +4835,7 @@ as the following example shows:
48354835
.Java
48364836
----
48374837
@RequestMapping
4838-
public String myHandleMethod(WebRequest webRequest, Model model) {
4838+
public String myHandleMethod(WebRequest request, Model model) {
48394839
48404840
long eTag = ... // <1>
48414841
@@ -4855,7 +4855,7 @@ as the following example shows:
48554855
.Kotlin
48564856
----
48574857
@RequestMapping
4858-
fun myHandleMethod(webRequest: WebRequest, model: Model): String? {
4858+
fun myHandleMethod(request: WebRequest, model: Model): String? {
48594859
48604860
val eTag: Long = ... // <1>
48614861

0 commit comments

Comments
 (0)