Skip to content

Commit ec87fdb

Browse files
committed
Polishing
1 parent c1f5345 commit ec87fdb

File tree

6 files changed

+24
-20
lines changed

6 files changed

+24
-20
lines changed

spring-core/src/main/java/org/springframework/core/convert/support/StringToBooleanConverter.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2016 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.
@@ -30,9 +30,9 @@
3030
*/
3131
final class StringToBooleanConverter implements Converter<String, Boolean> {
3232

33-
private static final Set<String> trueValues = new HashSet<>(4);
33+
private static final Set<String> trueValues = new HashSet<>(8);
3434

35-
private static final Set<String> falseValues = new HashSet<>(4);
35+
private static final Set<String> falseValues = new HashSet<>(8);
3636

3737
static {
3838
trueValues.add("true");
@@ -46,6 +46,7 @@ final class StringToBooleanConverter implements Converter<String, Boolean> {
4646
falseValues.add("0");
4747
}
4848

49+
4950
@Override
5051
public Boolean convert(String source) {
5152
String value = source.trim();

spring-core/src/main/java/org/springframework/core/convert/support/StringToUUIDConverter.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 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.
@@ -19,6 +19,7 @@
1919
import java.util.UUID;
2020

2121
import org.springframework.core.convert.converter.Converter;
22+
import org.springframework.lang.Nullable;
2223
import org.springframework.util.StringUtils;
2324

2425
/**
@@ -31,6 +32,7 @@
3132
final class StringToUUIDConverter implements Converter<String, UUID> {
3233

3334
@Override
35+
@Nullable
3436
public UUID convert(String source) {
3537
return (StringUtils.hasLength(source) ? UUID.fromString(source.trim()) : null);
3638
}

spring-web/src/main/java/org/springframework/http/ContentDisposition.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -369,29 +369,29 @@ else if (!escaped && ch == '"') {
369369
}
370370

371371
/**
372-
* Decode the given header field param as describe in RFC 5987.
372+
* Decode the given header field param as described in RFC 5987.
373373
* <p>Only the US-ASCII, UTF-8 and ISO-8859-1 charsets are supported.
374-
* @param filename the header field param
375-
* @param charset the charset to use
374+
* @param filename the filename
375+
* @param charset the charset for the filename
376376
* @return the encoded header field param
377377
* @see <a href="https://tools.ietf.org/html/rfc5987">RFC 5987</a>
378378
*/
379379
private static String decodeFilename(String filename, Charset charset) {
380380
Assert.notNull(filename, "'input' String` should not be null");
381381
Assert.notNull(charset, "'charset' should not be null");
382382
byte[] value = filename.getBytes(charset);
383-
ByteArrayOutputStream bos = new ByteArrayOutputStream();
383+
ByteArrayOutputStream baos = new ByteArrayOutputStream();
384384
int index = 0;
385385
while (index < value.length) {
386386
byte b = value[index];
387387
if (isRFC5987AttrChar(b)) {
388-
bos.write((char) b);
388+
baos.write((char) b);
389389
index++;
390390
}
391391
else if (b == '%' && index < value.length - 2) {
392392
char[] array = new char[]{(char) value[index + 1], (char) value[index + 2]};
393393
try {
394-
bos.write(Integer.parseInt(String.valueOf(array), 16));
394+
baos.write(Integer.parseInt(String.valueOf(array), 16));
395395
}
396396
catch (NumberFormatException ex) {
397397
throw new IllegalArgumentException(INVALID_HEADER_FIELD_PARAMETER_FORMAT, ex);
@@ -402,7 +402,7 @@ else if (b == '%' && index < value.length - 2) {
402402
throw new IllegalArgumentException(INVALID_HEADER_FIELD_PARAMETER_FORMAT);
403403
}
404404
}
405-
return new String(bos.toByteArray(), charset);
405+
return new String(baos.toByteArray(), charset);
406406
}
407407

408408
private static boolean isRFC5987AttrChar(byte c) {
@@ -522,7 +522,7 @@ public interface Builder {
522522

523523
private static class BuilderImpl implements Builder {
524524

525-
private String type;
525+
private final String type;
526526

527527
@Nullable
528528
private String name;

src/docs/asciidoc/core/core-aop-api.adoc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,9 @@ frameworks besides Spring make this possible.
143143
`org.springframework.aop.support.JdkRegexpMethodPointcut` is a generic regular
144144
expression pointcut that uses the regular expression support in the JDK.
145145

146-
With the `JdkRegexpMethodPointcut` class, you can provide a list of pattern strings. If
147-
any of these is a match, the pointcut evaluates to `true`. (So, the result is
148-
effectively the union of these pointcuts.)
146+
With the `JdkRegexpMethodPointcut` class, you can provide a list of pattern strings.
147+
If any of these is a match, the pointcut evaluates to `true`. (As a consequence,
148+
the resulting pointcut is effectively the union of the specified patterns.)
149149

150150
The following example shows how to use `JdkRegexpMethodPointcut`:
151151

src/docs/asciidoc/core/core-aop.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1413,7 +1413,7 @@ join point, unless you specify otherwise, the order of execution is undefined. Y
14131413
control the order of execution by specifying precedence. This is done in the normal
14141414
Spring way by either implementing the `org.springframework.core.Ordered` interface in
14151415
the aspect class or annotating it with the `@Order` annotation. Given two aspects, the
1416-
aspect returning the lower value from `Ordered.getValue()` (or the annotation value) has
1416+
aspect returning the lower value from `Ordered.getOrder()` (or the annotation value) has
14171417
the higher precedence.
14181418

14191419
When two pieces of advice defined in the same aspect both need to run at the same
@@ -2531,7 +2531,7 @@ an aspect weaving phase to your build script.
25312531
If you have chosen to use Spring AOP, you have a choice of @AspectJ or XML style.
25322532
There are various tradeoffs to consider.
25332533

2534-
The XML style may most familiar to existing Spring users, and it is backed by genuine
2534+
The XML style may be most familiar to existing Spring users, and it is backed by genuine
25352535
POJOs. When using AOP as a tool to configure enterprise services, XML can be a good
25362536
choice (a good test is whether you consider the pointcut expression to be a part of your
25372537
configuration that you might want to change independently). With the XML style, it is

src/docs/asciidoc/core/core-beans.adoc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ information on using the `BeanFactory` instead of the `ApplicationContext,` see
4242

4343
In Spring, the objects that form the backbone of your application and that are managed
4444
by the Spring IoC container are called beans. A bean is an object that is
45-
instantiated, assembled, and otherwise managed by a Spring IoC container. Otherwise, a
45+
instantiated, assembled, and managed by a Spring IoC container. Otherwise, a
4646
bean is simply one of many objects in your application. Beans, and the dependencies
4747
among them, are reflected in the configuration metadata used by a container.
4848

@@ -2089,7 +2089,7 @@ startup, because it must satisfy the singleton's dependencies. The lazy-initiali
20892089
is injected into a singleton bean elsewhere that is not lazy-initialized.
20902090

20912091
You can also control lazy-initialization at the container level by using the
2092-
`default-lazy-init` attribute on the `<beans/>` element, a the following example shows:
2092+
`default-lazy-init` attribute on the `<beans/>` element, as the following example shows:
20932093

20942094
====
20952095
[source,xml,indent=0]
@@ -4190,7 +4190,8 @@ which these `BeanFactoryPostProcessor` instances run by setting the `order` prop
41904190
However, you can only set this property if the `BeanFactoryPostProcessor` implements the
41914191
`Ordered` interface. If you write your own `BeanFactoryPostProcessor`, you should
41924192
consider implementing the `Ordered` interface, too. See the javadoc of the
4193-
{api-spring-framework}/beans/factory/config/BeanFactoryPostProcessor.html[`BeanFactoryPostProcessor`] and {api-spring-framework}/core/Ordered.html[`Ordered`] interfaces for more details.
4193+
{api-spring-framework}/beans/factory/config/BeanFactoryPostProcessor.html[`BeanFactoryPostProcessor`]
4194+
and {api-spring-framework}/core/Ordered.html[`Ordered`] interfaces for more details.
41944195

41954196
[NOTE]
41964197
====

0 commit comments

Comments
 (0)