Skip to content

Commit fe3357d

Browse files
committed
Polishing (backported)
1 parent 11c51d8 commit fe3357d

File tree

7 files changed

+22
-18
lines changed

7 files changed

+22
-18
lines changed

spring-aop/src/main/java/org/springframework/aop/support/DefaultIntroductionAdvisor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -71,7 +71,8 @@ public DefaultIntroductionAdvisor(Advice advice, @Nullable IntroductionInfo intr
7171
if (introductionInfo != null) {
7272
Class<?>[] introducedInterfaces = introductionInfo.getInterfaces();
7373
if (introducedInterfaces.length == 0) {
74-
throw new IllegalArgumentException("IntroductionAdviceSupport implements no interfaces");
74+
throw new IllegalArgumentException(
75+
"IntroductionInfo defines no interfaces to introduce: " + introductionInfo);
7576
}
7677
for (Class<?> ifc : introducedInterfaces) {
7778
addInterface(ifc);

spring-aop/src/test/java/org/springframework/aop/framework/ProxyFactoryTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -183,7 +183,7 @@ public void testAddRepeatedInterface() {
183183
}
184184

185185
@Test
186-
public void testGetsAllInterfaces() throws Exception {
186+
public void testGetsAllInterfaces() {
187187
// Extend to get new interface
188188
class TestBeanSubclass extends TestBean implements Comparable<Object> {
189189
@Override

spring-beans/src/test/java/org/springframework/beans/factory/support/QualifierAnnotationAutowireBeanFactoryTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -244,7 +244,7 @@ public String getName() {
244244
@Target({ElementType.FIELD, ElementType.PARAMETER})
245245
@Retention(RetentionPolicy.RUNTIME)
246246
@Qualifier
247-
private static @interface TestQualifier {
247+
private @interface TestQualifier {
248248
}
249249

250250
}

spring-context/src/test/java/org/springframework/beans/factory/xml/QualifierAnnotationTests.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 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,8 +47,9 @@
4747
public class QualifierAnnotationTests {
4848

4949
private static final String CLASSNAME = QualifierAnnotationTests.class.getName();
50+
5051
private static final String CONFIG_LOCATION =
51-
format("classpath:%s-context.xml", convertClassNameToResourcePath(CLASSNAME));
52+
format("classpath:%s-context.xml", convertClassNameToResourcePath(CLASSNAME));
5253

5354

5455
@Test

spring-jdbc/src/main/java/org/springframework/jdbc/core/BeanPropertyRowMapper.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -223,10 +223,11 @@ protected void initialize(Class<T> mappedClass) {
223223

224224
for (PropertyDescriptor pd : BeanUtils.getPropertyDescriptors(mappedClass)) {
225225
if (pd.getWriteMethod() != null) {
226-
this.mappedFields.put(lowerCaseName(pd.getName()), pd);
227-
String underscoredName = underscoreName(pd.getName());
228-
if (!lowerCaseName(pd.getName()).equals(underscoredName)) {
229-
this.mappedFields.put(underscoredName, pd);
226+
String lowerCaseName = lowerCaseName(pd.getName());
227+
this.mappedFields.put(lowerCaseName, pd);
228+
String underscoreName = underscoreName(pd.getName());
229+
if (!lowerCaseName.equals(underscoreName)) {
230+
this.mappedFields.put(underscoreName, pd);
230231
}
231232
this.mappedProperties.add(pd.getName());
232233
}

spring-web/src/main/java/org/springframework/http/server/reactive/JettyHeadersAdapter.java

Lines changed: 2 additions & 2 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-2021 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.
@@ -185,7 +185,7 @@ public String toString() {
185185

186186
private class EntryIterator implements Iterator<Entry<String, List<String>>> {
187187

188-
private Enumeration<String> names = headers.getFieldNames();
188+
private final Enumeration<String> names = headers.getFieldNames();
189189

190190
@Override
191191
public boolean hasNext() {

spring-web/src/main/java/org/springframework/web/bind/support/WebRequestDataBinder.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 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.
@@ -110,12 +110,13 @@ public WebRequestDataBinder(@Nullable Object target, String objectName) {
110110
public void bind(WebRequest request) {
111111
MutablePropertyValues mpvs = new MutablePropertyValues(request.getParameterMap());
112112
if (request instanceof NativeWebRequest) {
113-
MultipartRequest multipartRequest = ((NativeWebRequest) request).getNativeRequest(MultipartRequest.class);
113+
NativeWebRequest nativeRequest = (NativeWebRequest) request;
114+
MultipartRequest multipartRequest = nativeRequest.getNativeRequest(MultipartRequest.class);
114115
if (multipartRequest != null) {
115116
bindMultipart(multipartRequest.getMultiFileMap(), mpvs);
116117
}
117118
else if (isMultipartRequest(request)) {
118-
HttpServletRequest servletRequest = ((NativeWebRequest) request).getNativeRequest(HttpServletRequest.class);
119+
HttpServletRequest servletRequest = nativeRequest.getNativeRequest(HttpServletRequest.class);
119120
if (servletRequest != null) {
120121
bindParts(servletRequest, mpvs);
121122
}

0 commit comments

Comments
 (0)