Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 4525d38

Browse files
committedSep 14, 2020
Polishing
1 parent 3de1f76 commit 4525d38

File tree

6 files changed

+22
-19
lines changed

6 files changed

+22
-19
lines changed
 

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

Lines changed: 5 additions & 4 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,10 +46,11 @@ 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();
52-
if ("".equals(value)) {
53+
if (value.isEmpty()) {
5354
return null;
5455
}
5556
value = value.toLowerCase();

‎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: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,11 +149,11 @@ Let's consider some static pointcut implementations included with Spring.
149149
One obvious way to specify static pointcuts is regular expressions. Several AOP
150150
frameworks besides Spring make this possible.
151151
`org.springframework.aop.support.JdkRegexpMethodPointcut` is a generic regular
152-
expression pointcut, using the regular expression support in the JDK.
152+
expression pointcut that uses the regular expression support in the JDK.
153153

154-
Using the `JdkRegexpMethodPointcut` class, you can provide a list of pattern Strings. If
155-
any of these is a match, the pointcut will evaluate to true. (So the result is
156-
effectively the union of these pointcuts.)
154+
With the `JdkRegexpMethodPointcut` class, you can provide a list of pattern strings.
155+
If any of these is a match, the pointcut evaluates to `true`. (As a consequence,
156+
the resulting pointcut is effectively the union of the specified patterns.)
157157

158158
The usage is shown below:
159159

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ join point, unless you specify otherwise the order of execution is undefined. Yo
13591359
control the order of execution by specifying precedence. This is done in the normal
13601360
Spring way by either implementing the `org.springframework.core.Ordered` interface in
13611361
the aspect class or annotating it with the `Order` annotation. Given two aspects, the
1362-
aspect returning the lower value from `Ordered.getValue()` (or the annotation value) has
1362+
aspect returning the lower value from `Ordered.getOrder()` (or the annotation value) has
13631363
the higher precedence.
13641364

13651365
When two pieces of advice defined in __the same__ aspect both need to run at the same

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ information on using the `BeanFactory` instead of the `ApplicationContext,` refe
3939

4040
In Spring, the objects that form the backbone of your application and that are managed
4141
by the Spring IoC __container__ are called __beans__. A bean is an object that is
42-
instantiated, assembled, and otherwise managed by a Spring IoC container. Otherwise, a
42+
instantiated, assembled, and managed by a Spring IoC container. Otherwise, a
4343
bean is simply one of many objects in your application. Beans, and the __dependencies__
4444
among them, are reflected in the __configuration metadata__ used by a container.
4545

0 commit comments

Comments
 (0)
Please sign in to comment.