Skip to content

Commit b541fc9

Browse files
committed
Polishing
1 parent 1e26d17 commit b541fc9

10 files changed

Lines changed: 65 additions & 63 deletions

File tree

spring-beans/src/main/java/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -219,8 +219,7 @@ protected void processProperties(ConfigurableListableBeanFactory beanFactoryToPr
219219
throws BeansException {
220220

221221
StringValueResolver valueResolver = new PlaceholderResolvingStringValueResolver(props);
222-
223-
this.doProcessProperties(beanFactoryToProcess, valueResolver);
222+
doProcessProperties(beanFactoryToProcess, valueResolver);
224223
}
225224

226225
/**

spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionBuilder.java

Lines changed: 2 additions & 2 deletions
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-2015 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.
@@ -269,7 +269,7 @@ public BeanDefinitionBuilder setDependencyCheck(int dependencyCheck) {
269269
*/
270270
public BeanDefinitionBuilder addDependsOn(String beanName) {
271271
if (this.beanDefinition.getDependsOn() == null) {
272-
this.beanDefinition.setDependsOn(new String[] {beanName});
272+
this.beanDefinition.setDependsOn(beanName);
273273
}
274274
else {
275275
String[] added = ObjectUtils.addObjectToArray(this.beanDefinition.getDependsOn(), beanName);

spring-context/src/main/java/org/springframework/context/annotation/Role.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2011 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -28,16 +28,16 @@
2828
* Indicates the 'role' hint for a given bean.
2929
*
3030
* <p>May be used on any class directly or indirectly annotated with
31-
* {@link org.springframework.stereotype.Component} or on methods annotated with
32-
* {@link Bean}.
31+
* {@link org.springframework.stereotype.Component} or on methods
32+
* annotated with {@link Bean}.
3333
*
34-
* <p>If this annotation is not present on a Component or Bean definition, the
35-
* default value of {@link BeanDefinition#ROLE_APPLICATION} will apply.
34+
* <p>If this annotation is not present on a Component or Bean definition,
35+
* the default value of {@link BeanDefinition#ROLE_APPLICATION} will apply.
3636
*
37-
* <p>If Role is present on a {@link Configuration @Configuration} class, this
38-
* indicates the role of the configuration class bean definition and does not
39-
* cascade to all @{@code Bean} methods defined within. This behavior is
40-
* different than that of the @{@link Lazy} annotation, for example.
37+
* <p>If Role is present on a {@link Configuration @Configuration} class,
38+
* this indicates the role of the configuration class bean definition and
39+
* does not cascade to all @{@code Bean} methods defined within. This behavior
40+
* is different than that of the @{@link Lazy} annotation, for example.
4141
*
4242
* @author Chris Beams
4343
* @since 3.1

spring-context/src/main/java/org/springframework/scheduling/annotation/ProxyAsyncConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class ProxyAsyncConfiguration extends AbstractAsyncConfiguration {
4545
public AsyncAnnotationBeanPostProcessor asyncAdvisor() {
4646
Assert.notNull(this.enableAsync, "@EnableAsync annotation metadata was not injected");
4747
AsyncAnnotationBeanPostProcessor bpp = new AsyncAnnotationBeanPostProcessor();
48-
Class<? extends Annotation> customAsyncAnnotation = enableAsync.getClass("annotation");
48+
Class<? extends Annotation> customAsyncAnnotation = this.enableAsync.getClass("annotation");
4949
if (customAsyncAnnotation != AnnotationUtils.getDefaultValue(EnableAsync.class, "annotation")) {
5050
bpp.setAsyncAnnotationType(customAsyncAnnotation);
5151
}

spring-core/src/test/java/org/springframework/core/convert/support/ByteBufferConverterTests.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -35,6 +35,7 @@ public class ByteBufferConverterTests {
3535

3636
private GenericConversionService conversionService;
3737

38+
3839
@Before
3940
public void setup() {
4041
this.conversionService = new GenericConversionService();
@@ -43,6 +44,7 @@ public void setup() {
4344
this.conversionService.addConverter(new OtherTypeToByteArrayConverter());
4445
}
4546

47+
4648
@Test
4749
public void byteArrayToByteBuffer() throws Exception {
4850
byte[] bytes = new byte[] { 1, 2, 3 };
@@ -78,6 +80,7 @@ public void otherTypeToByteBuffer() throws Exception {
7880
assertThat(bytes, equalTo(convert.array()));
7981
}
8082

83+
8184
private static class OtherType {
8285

8386
private byte[] bytes;
@@ -88,17 +91,17 @@ public OtherType(byte[] bytes) {
8891

8992
}
9093

91-
private static class ByteArrayToOtherTypeConverter implements
92-
Converter<byte[], OtherType> {
94+
95+
private static class ByteArrayToOtherTypeConverter implements Converter<byte[], OtherType> {
9396

9497
@Override
9598
public OtherType convert(byte[] source) {
9699
return new OtherType(source);
97100
}
98101
}
99102

100-
private static class OtherTypeToByteArrayConverter implements
101-
Converter<OtherType, byte[]> {
103+
104+
private static class OtherTypeToByteArrayConverter implements Converter<OtherType, byte[]> {
102105

103106
@Override
104107
public byte[] convert(OtherType source) {

spring-core/src/test/java/org/springframework/tests/TestGroup.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -34,7 +34,6 @@
3434
*/
3535
public enum TestGroup {
3636

37-
3837
/**
3938
* Tests that take a considerable amount of time to run. Any test lasting longer than
4039
* 500ms should be considered a candidate in order to avoid making the overall test
@@ -68,6 +67,7 @@ public enum TestGroup {
6867
*/
6968
CUSTOM_COMPILATION;
7069

70+
7171
/**
7272
* Parse the specified comma separated string of groups.
7373
* @param value the comma separated string of groups
@@ -102,4 +102,5 @@ private static Set<TestGroup> parseGroups(String value) {
102102
}
103103
return groups;
104104
}
105+
105106
}

spring-jms/src/main/java/org/springframework/jms/annotation/JmsBootstrapConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
* a default {@link JmsListenerEndpointRegistry}.
3030
*
3131
* <p>This configuration class is automatically imported when using the @{@link EnableJms}
32-
* annotation. See {@link EnableJms} Javadoc for complete usage.
32+
* annotation. See the {@link EnableJms} javadocs for complete usage details.
3333
*
3434
* @author Stephane Nicoll
3535
* @since 4.1

spring-oxm/src/test/java/org/springframework/oxm/castor/CastorMarshallerTests.java

Lines changed: 31 additions & 31 deletions
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-2015 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.
@@ -55,55 +55,56 @@ public class CastorMarshallerTests extends AbstractMarshallerTests {
5555
/**
5656
* Represents the expected result that doesn't contain the xml declaration.
5757
*/
58-
private static final String DOCUMENT_EXPECTED_STRING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
59-
+ "<tns:flights xmlns:tns=\"http://samples.springframework.org/flight\">"
60-
+ "<tns:flight><tns:number>42</tns:number></tns:flight></tns:flights>";
58+
private static final String DOCUMENT_EXPECTED_STRING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
59+
"<tns:flights xmlns:tns=\"http://samples.springframework.org/flight\">" +
60+
"<tns:flight><tns:number>42</tns:number></tns:flight></tns:flights>";
6161

6262
/**
6363
* Represents the expected result that doesn't contain the xml namespaces.
6464
*/
65-
private static final String SUPPRESSED_NAMESPACE_EXPECTED_STRING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><flights><flight><number>42</number></flight></flights>";
65+
private static final String SUPPRESSED_NAMESPACE_EXPECTED_STRING =
66+
"<?xml version=\"1.0\" encoding=\"UTF-8\"?><flights><flight><number>42</number></flight></flights>";
6667

6768
/**
6869
* Represents the expected result with modified root element name.
6970
*/
70-
private static final String ROOT_ELEMENT_EXPECTED_STRING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
71-
+ "<tns:canceledFlights xmlns:tns=\"http://samples.springframework.org/flight\">"
72-
+ "<tns:flight><tns:number>42</tns:number></tns:flight></tns:canceledFlights>";
71+
private static final String ROOT_ELEMENT_EXPECTED_STRING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
72+
"<tns:canceledFlights xmlns:tns=\"http://samples.springframework.org/flight\">" +
73+
"<tns:flight><tns:number>42</tns:number></tns:flight></tns:canceledFlights>";
7374

7475
/**
7576
* Represents the expected result with 'xsi:type' attribute.
7677
*/
77-
private static final String XSI_EXPECTED_STRING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
78-
+ "<objects><castor-object xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
79-
+ " xmlns:java=\"http://java.sun.com\""
80-
+ " xsi:type=\"java:org.springframework.oxm.castor.CastorObject\">"
81-
+ "<name>test</name><value>8</value></castor-object></objects>";
78+
private static final String XSI_EXPECTED_STRING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
79+
"<objects><castor-object xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" +
80+
" xmlns:java=\"http://java.sun.com\"" +
81+
" xsi:type=\"java:org.springframework.oxm.castor.CastorObject\">" +
82+
"<name>test</name><value>8</value></castor-object></objects>";
8283

8384
/**
8485
* Represents the expected result with suppressed 'xsi:type' attribute.
8586
*/
86-
private static final String SUPPRESSED_XSI_EXPECTED_STRING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
87-
+ "<objects><castor-object><name>test</name><value>8</value></castor-object></objects>";
87+
private static final String SUPPRESSED_XSI_EXPECTED_STRING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
88+
"<objects><castor-object><name>test</name><value>8</value></castor-object></objects>";
8889

8990
/**
9091
* Represents the expected result with 'xsi:type' attribute for root element.
9192
*/
92-
private static final String ROOT_WITH_XSI_EXPECTED_STRING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
93-
+ "<objects xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
94-
+ " xmlns:java=\"http://java.sun.com\""
95-
+ " xsi:type=\"java:java.util.Arrays$ArrayList\">"
96-
+ "<castor-object xsi:type=\"java:org.springframework.oxm.castor.CastorObject\">"
97-
+ "<name>test</name><value>8</value></castor-object></objects>";
93+
private static final String ROOT_WITH_XSI_EXPECTED_STRING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
94+
"<objects xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" +
95+
" xmlns:java=\"http://java.sun.com\"" +
96+
" xsi:type=\"java:java.util.Arrays$ArrayList\">" +
97+
"<castor-object xsi:type=\"java:org.springframework.oxm.castor.CastorObject\">" +
98+
"<name>test</name><value>8</value></castor-object></objects>";
9899

99100
/**
100101
* Represents the expected result without 'xsi:type' attribute for root element.
101102
*/
102-
private static final String ROOT_WITHOUT_XSI_EXPECTED_STRING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
103-
+ "<objects><castor-object xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
104-
+ " xmlns:java=\"http://java.sun.com\""
105-
+ " xsi:type=\"java:org.springframework.oxm.castor.CastorObject\">"
106-
+ "<name>test</name><value>8</value></castor-object></objects>";
103+
private static final String ROOT_WITHOUT_XSI_EXPECTED_STRING = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
104+
"<objects><castor-object xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" +
105+
" xmlns:java=\"http://java.sun.com\"" +
106+
" xsi:type=\"java:org.springframework.oxm.castor.CastorObject\">" +
107+
"<name>test</name><value>8</value></castor-object></objects>";
107108

108109

109110
@Override
@@ -277,9 +278,9 @@ private String marshalFlights() throws Exception {
277278
}
278279

279280
/**
280-
* Asserts the values of xpath expression evaluation is exactly the same as expected value. </p> The xpath may contain
281-
* the xml namespace prefixes, since namespaces from flight example are being registered.
282-
*
281+
* Asserts the values of xpath expression evaluation is exactly the same as expected value.
282+
* <p>The xpath may contain the xml namespace prefixes, since namespaces from flight example
283+
* are being registered.
283284
* @param msg the error message that will be used in case of test failure
284285
* @param expected the expected value
285286
* @param xpath the xpath to evaluate
@@ -302,13 +303,12 @@ private void assertXpathEvaluatesTo(String msg, String expected, String xpath, S
302303

303304
/**
304305
* Creates a instance of {@link CastorObject} for testing.
305-
*
306-
* @return a instance of {@link CastorObject}
307306
*/
308307
private CastorObject createCastorObject() {
309308
CastorObject castorObject = new CastorObject();
310309
castorObject.setName("test");
311310
castorObject.setValue(8);
312311
return castorObject;
313312
}
313+
314314
}

spring-oxm/src/test/java/org/springframework/oxm/castor/CastorUnmarshallerTests.java

Lines changed: 5 additions & 7 deletions
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-2015 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,15 +47,16 @@ public class CastorUnmarshallerTests extends AbstractUnmarshallerTests {
4747
*/
4848
protected static final String EXTRA_ATTRIBUTES_STRING =
4949
"<tns:flights xmlns:tns=\"http://samples.springframework.org/flight\">" +
50-
"<tns:flight status=\"canceled\"><tns:number>42</tns:number></tns:flight></tns:flights>";
50+
"<tns:flight status=\"canceled\"><tns:number>42</tns:number></tns:flight></tns:flights>";
5151

5252
/**
5353
* Represents the xml with additional element that is not mapped in Castor config.
5454
*/
5555
protected static final String EXTRA_ELEMENTS_STRING =
5656
"<tns:flights xmlns:tns=\"http://samples.springframework.org/flight\">" +
57-
"<tns:flight><tns:number>42</tns:number><tns:date>2011-06-14</tns:date>" +
58-
"</tns:flight></tns:flights>";
57+
"<tns:flight><tns:number>42</tns:number><tns:date>2011-06-14</tns:date>" +
58+
"</tns:flight></tns:flights>";
59+
5960

6061
@Override
6162
protected void testFlights(Object o) {
@@ -237,7 +238,6 @@ protected Object unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource
237238

238239
@Test
239240
public void unmarshalSaxSourceExternalEntities() throws Exception {
240-
241241
final AtomicReference<XMLReader> result = new AtomicReference<XMLReader>();
242242
CastorMarshaller marshaller = new CastorMarshaller() {
243243
@Override
@@ -248,13 +248,11 @@ protected Object unmarshalSaxReader(XMLReader xmlReader, InputSource inputSource
248248
};
249249

250250
// 1. external-general-entities disabled (default)
251-
252251
marshaller.unmarshal(new SAXSource(new InputSource("1")));
253252
assertNotNull(result.get());
254253
assertEquals(false, result.get().getFeature("http://xml.org/sax/features/external-general-entities"));
255254

256255
// 2. external-general-entities disabled (default)
257-
258256
result.set(null);
259257
marshaller.setProcessExternalEntities(true);
260258
marshaller.unmarshal(new SAXSource(new InputSource("1")));

spring-web/src/main/java/org/springframework/web/bind/annotation/RequestBody.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -33,11 +33,11 @@
3333
* <p>Supported for annotated handler methods in Servlet environments.
3434
*
3535
* @author Arjen Poutsma
36+
* @since 3.0
3637
* @see RequestHeader
3738
* @see ResponseBody
3839
* @see org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter
3940
* @see org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter
40-
* @since 3.0
4141
*/
4242
@Target(ElementType.PARAMETER)
4343
@Retention(RetentionPolicy.RUNTIME)
@@ -49,6 +49,7 @@
4949
* <p>Default is {@code true}, leading to an exception thrown in case
5050
* there is no body content. Switch this to {@code false} if you prefer
5151
* {@code null} to be passed when the body content is {@code null}.
52+
* @since 3.2
5253
*/
5354
boolean required() default true;
5455

0 commit comments

Comments
 (0)