Skip to content

Commit ede2150

Browse files
committed
Polishing
1 parent 07edf11 commit ede2150

File tree

15 files changed

+76
-90
lines changed

15 files changed

+76
-90
lines changed

spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2593,7 +2593,7 @@ public static class MocksControl {
25932593

25942594
@SuppressWarnings("unchecked")
25952595
public <T> T createMock(Class<T> toMock) {
2596-
return (T) Proxy.newProxyInstance(AutowiredAnnotationBeanPostProcessorTests.class.getClassLoader(), new Class<?>[]{toMock},
2596+
return (T) Proxy.newProxyInstance(AutowiredAnnotationBeanPostProcessorTests.class.getClassLoader(), new Class<?>[] {toMock},
25972597
new InvocationHandler() {
25982598
@Override
25992599
public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
@@ -2620,11 +2620,11 @@ public String doSomethingGeneric(T o) {
26202620
return gi2.doSomethingMoreGeneric(o) + "_somethingGeneric_" + o;
26212621
}
26222622

2623-
public static GenericInterface1<String> create(){
2623+
public static GenericInterface1<String> create() {
26242624
return new StringGenericInterface1Impl();
26252625
}
26262626

2627-
public static GenericInterface1 createPlain(){
2627+
public static GenericInterface1 createPlain() {
26282628
return new GenericInterface1Impl();
26292629
}
26302630
}
@@ -2640,7 +2640,7 @@ public interface GenericInterface2<K> {
26402640
}
26412641

26422642

2643-
public static class GenericInterface2Impl implements GenericInterface2<String>{
2643+
public static class GenericInterface2Impl implements GenericInterface2<String> {
26442644

26452645
@Override
26462646
public String doSomethingMoreGeneric(String o) {
@@ -2658,7 +2658,7 @@ public String doSomethingMoreGeneric(Object o) {
26582658
}
26592659

26602660

2661-
public static class PlainGenericInterface2Impl implements GenericInterface2{
2661+
public static class PlainGenericInterface2Impl implements GenericInterface2 {
26622662

26632663
@Override
26642664
public String doSomethingMoreGeneric(Object o) {

spring-context-support/src/main/java/org/springframework/cache/transaction/TransactionAwareCacheManagerProxy.java

Lines changed: 2 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-2014 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.
@@ -68,7 +68,7 @@ public void setTargetCacheManager(CacheManager targetCacheManager) {
6868
@Override
6969
public void afterPropertiesSet() {
7070
if (this.targetCacheManager == null) {
71-
throw new IllegalStateException("'targetCacheManager' is required");
71+
throw new IllegalArgumentException("Property 'targetCacheManager' is required");
7272
}
7373
}
7474

spring-messaging/src/main/java/org/springframework/messaging/core/DestinationResolver.java

Lines changed: 5 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-2014 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.
@@ -17,7 +17,7 @@
1717
package org.springframework.messaging.core;
1818

1919
/**
20-
* Strategy for resolving a String destination name into an actual destination
20+
* Strategy for resolving a String destination name to an actual destination
2121
* of type {@code <D>}.
2222
*
2323
* @author Mark Fisher
@@ -28,7 +28,9 @@ public interface DestinationResolver<D> {
2828
/**
2929
* Resolve the given destination name.
3030
* @param name the destination name to resolve
31-
* @return the destination, never {@code null}
31+
* @return the resolved destination (never {@code null})
32+
* @throws DestinationResolutionException if the specified destination
33+
* wasn't found or wasn't resolvable for any other reason
3234
*/
3335
D resolveDestination(String name) throws DestinationResolutionException;
3436

spring-web/src/main/java/org/springframework/http/converter/feed/AbstractWireFeedHttpMessageConverter.java

Lines changed: 8 additions & 4 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-2014 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.
@@ -38,7 +38,7 @@
3838

3939
/**
4040
* Abstract base class for Atom and RSS Feed message converters, using the
41-
* <a href="http://rometools.org/">ROME tools</a> project.
41+
* <a href="https://rome.dev.java.net">ROME tools</a> project.
4242
*
4343
* @author Arjen Poutsma
4444
* @since 3.0.2
@@ -49,14 +49,17 @@ public abstract class AbstractWireFeedHttpMessageConverter<T extends WireFeed> e
4949

5050
public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8");
5151

52+
5253
protected AbstractWireFeedHttpMessageConverter(MediaType supportedMediaType) {
5354
super(supportedMediaType);
5455
}
5556

57+
5658
@Override
5759
@SuppressWarnings("unchecked")
5860
protected T readInternal(Class<? extends T> clazz, HttpInputMessage inputMessage)
5961
throws IOException, HttpMessageNotReadableException {
62+
6063
WireFeedInput feedInput = new WireFeedInput();
6164
MediaType contentType = inputMessage.getHeaders().getContentType();
6265
Charset charset;
@@ -77,6 +80,7 @@ protected T readInternal(Class<? extends T> clazz, HttpInputMessage inputMessage
7780
@Override
7881
protected void writeInternal(T wireFeed, HttpOutputMessage outputMessage)
7982
throws IOException, HttpMessageNotWritableException {
83+
8084
String wireFeedEncoding = wireFeed.getEncoding();
8185
if (!StringUtils.hasLength(wireFeedEncoding)) {
8286
wireFeedEncoding = DEFAULT_CHARSET.name();
@@ -89,13 +93,13 @@ protected void writeInternal(T wireFeed, HttpOutputMessage outputMessage)
8993
}
9094

9195
WireFeedOutput feedOutput = new WireFeedOutput();
92-
9396
try {
9497
Writer writer = new OutputStreamWriter(outputMessage.getBody(), wireFeedEncoding);
9598
feedOutput.output(wireFeed, writer);
9699
}
97100
catch (FeedException ex) {
98-
throw new HttpMessageNotWritableException("Could not write WiredFeed: " + ex.getMessage(), ex);
101+
throw new HttpMessageNotWritableException("Could not write WireFeed: " + ex.getMessage(), ex);
99102
}
100103
}
104+
101105
}

spring-web/src/main/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverter.java

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2010 the original author or authors.
2+
* Copyright 2002-2014 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.
@@ -21,16 +21,16 @@
2121
import org.springframework.http.MediaType;
2222

2323
/**
24-
* Implementation of {@link org.springframework.http.converter.HttpMessageConverter} that can read and write Atom feeds.
25-
* Specifically, this converter can handle {@link Feed} objects, from the <a href="https://rome.dev.java.net/">ROME</a>
26-
* project.
24+
* Implementation of {@link org.springframework.http.converter.HttpMessageConverter}
25+
* that can read and write Atom feeds. Specifically, this converter can handle {@link Feed}
26+
* objects from the <a href="https://rome.dev.java.net/">ROME</a> project.
2727
*
28-
* <p>By default, this converter reads and writes the media type ({@code application/atom+xml}). This can
29-
* be overridden by setting the {@link #setSupportedMediaTypes(java.util.List) supportedMediaTypes} property.
28+
* <p>By default, this converter reads and writes the media type ({@code application/atom+xml}).
29+
* This can be overridden through the {@link #setSupportedMediaTypes supportedMediaTypes} property.
3030
*
3131
* @author Arjen Poutsma
32-
* @see Feed
3332
* @since 3.0.2
33+
* @see Feed
3434
*/
3535
public class AtomFeedHttpMessageConverter extends AbstractWireFeedHttpMessageConverter<Feed> {
3636

@@ -43,5 +43,4 @@ protected boolean supports(Class<?> clazz) {
4343
return Feed.class.isAssignableFrom(clazz);
4444
}
4545

46-
4746
}

spring-web/src/main/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverter.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2010 the original author or authors.
2+
* Copyright 2002-2014 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.
@@ -21,16 +21,16 @@
2121
import org.springframework.http.MediaType;
2222

2323
/**
24-
* Implementation of {@link org.springframework.http.converter.HttpMessageConverter} that can read and write RSS feeds.
25-
* Specifically, this converter can handle {@link Channel} objects, from the <a href="https://rome.dev.java.net/">ROME</a>
26-
* project.
24+
* Implementation of {@link org.springframework.http.converter.HttpMessageConverter}
25+
* that can read and write RSS feeds. Specifically, this converter can handle {@link Channel}
26+
* objects from the <a href="https://rome.dev.java.net/">ROME</a> project.
2727
*
28-
* <p>By default, this converter reads and writes the media type ({@code application/rss+xml}). This can
29-
* be overridden by setting the {@link #setSupportedMediaTypes(java.util.List) supportedMediaTypes} property.
28+
* <p>By default, this converter reads and writes the media type ({@code application/rss+xml}).
29+
* This can be overridden through the {@link #setSupportedMediaTypes supportedMediaTypes} property.
3030
*
3131
* @author Arjen Poutsma
32-
* @see Channel
3332
* @since 3.0.2
33+
* @see Channel
3434
*/
3535
public class RssChannelHttpMessageConverter extends AbstractWireFeedHttpMessageConverter<Channel> {
3636

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,8 @@
1-
/*
2-
* Copyright 2002-2010 the original author or authors.
3-
*
4-
* Licensed under the Apache License, Version 2.0 (the "License");
5-
* you may not use this file except in compliance with the License.
6-
* You may obtain a copy of the License at
7-
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
9-
*
10-
* Unless required by applicable law or agreed to in writing, software
11-
* distributed under the License is distributed on an "AS IS" BASIS,
12-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
* See the License for the specific language governing permissions and
14-
* limitations under the License.
15-
*/
161

172
/**
183
*
194
* Provides HttpMessageConverter implementations for handling Atom and RSS feeds.
5+
* Based on the <a href="https://rome.dev.java.net/">ROME tools</a> project.
206
*
217
*/
228
package org.springframework.http.converter.feed;
23-

spring-web/src/test/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverterTests.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2010 the original author or authors.
2+
* Copyright 2002-2014 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.
@@ -24,10 +24,7 @@
2424

2525
import com.sun.syndication.feed.atom.Entry;
2626
import com.sun.syndication.feed.atom.Feed;
27-
import static org.custommonkey.xmlunit.XMLAssert.*;
2827
import org.custommonkey.xmlunit.XMLUnit;
29-
import static org.junit.Assert.assertEquals;
30-
import static org.junit.Assert.assertTrue;
3128
import org.junit.Before;
3229
import org.junit.Test;
3330
import org.xml.sax.SAXException;
@@ -36,7 +33,13 @@
3633
import org.springframework.http.MockHttpInputMessage;
3734
import org.springframework.http.MockHttpOutputMessage;
3835

39-
/** @author Arjen Poutsma */
36+
import static org.custommonkey.xmlunit.XMLAssert.*;
37+
import static org.junit.Assert.assertEquals;
38+
import static org.junit.Assert.assertTrue;
39+
40+
/**
41+
* @author Arjen Poutsma
42+
*/
4043
public class AtomFeedHttpMessageConverterTests {
4144

4245
private AtomFeedHttpMessageConverter converter;
@@ -70,7 +73,7 @@ public void read() throws IOException {
7073
Feed result = converter.read(Feed.class, inputMessage);
7174
assertEquals("title", result.getTitle());
7275
assertEquals("subtitle", result.getSubtitle().getValue());
73-
List entries = result.getEntries();
76+
List<?> entries = result.getEntries();
7477
assertEquals(2, entries.size());
7578

7679
Entry entry1 = (Entry) entries.get(0);
@@ -95,7 +98,7 @@ public void write() throws IOException, SAXException {
9598
entry2.setId("id2");
9699
entry2.setTitle("title2");
97100

98-
List entries = new ArrayList(2);
101+
List<Entry> entries = new ArrayList<Entry>(2);
99102
entries.add(entry1);
100103
entries.add(entry2);
101104
feed.setEntries(entries);
@@ -109,7 +112,6 @@ public void write() throws IOException, SAXException {
109112
"<entry><id>id1</id><title>title1</title></entry>" +
110113
"<entry><id>id2</id><title>title2</title></entry></feed>";
111114
assertXMLEqual(expected, outputMessage.getBodyAsString(utf8));
112-
113115
}
114116

115117
@Test
@@ -126,5 +128,4 @@ public void writeOtherCharset() throws IOException, SAXException {
126128
outputMessage.getHeaders().getContentType());
127129
}
128130

129-
130131
}

spring-web/src/test/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverterTests.java

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2010 the original author or authors.
2+
* Copyright 2002-2014 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.
@@ -24,10 +24,7 @@
2424

2525
import com.sun.syndication.feed.rss.Channel;
2626
import com.sun.syndication.feed.rss.Item;
27-
import static org.custommonkey.xmlunit.XMLAssert.*;
2827
import org.custommonkey.xmlunit.XMLUnit;
29-
import static org.junit.Assert.assertEquals;
30-
import static org.junit.Assert.assertTrue;
3128
import org.junit.Before;
3229
import org.junit.Test;
3330
import org.xml.sax.SAXException;
@@ -36,7 +33,13 @@
3633
import org.springframework.http.MockHttpInputMessage;
3734
import org.springframework.http.MockHttpOutputMessage;
3835

39-
/** @author Arjen Poutsma */
36+
import static org.custommonkey.xmlunit.XMLAssert.*;
37+
import static org.junit.Assert.assertEquals;
38+
import static org.junit.Assert.assertTrue;
39+
40+
/**
41+
* @author Arjen Poutsma
42+
*/
4043
public class RssChannelHttpMessageConverterTests {
4144

4245
private RssChannelHttpMessageConverter converter;
@@ -72,7 +75,7 @@ public void read() throws IOException {
7275
assertEquals("http://example.com", result.getLink());
7376
assertEquals("description", result.getDescription());
7477

75-
List items = result.getItems();
78+
List<?> items = result.getItems();
7679
assertEquals(2, items.size());
7780

7881
Item item1 = (Item) items.get(0);
@@ -95,7 +98,7 @@ public void write() throws IOException, SAXException {
9598
Item item2 = new Item();
9699
item2.setTitle("title2");
97100

98-
List items = new ArrayList(2);
101+
List<Item> items = new ArrayList<Item>(2);
99102
items.add(item1);
100103
items.add(item2);
101104
channel.setItems(items);
@@ -111,7 +114,6 @@ public void write() throws IOException, SAXException {
111114
"<item><title>title2</title></item>" +
112115
"</channel></rss>";
113116
assertXMLEqual(expected, outputMessage.getBodyAsString(utf8));
114-
115117
}
116118

117119
@Test
@@ -134,5 +136,4 @@ public void writeOtherCharset() throws IOException, SAXException {
134136
outputMessage.getHeaders().getContentType());
135137
}
136138

137-
138-
}
139+
}

spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575

7676
/**
7777
* A {@link BeanDefinitionParser} that provides the configuration for the
78-
* {@code <annotation-driven/>} MVC namespace element.
78+
* {@code <annotation-driven/>} MVC namespace element.
7979
*
8080
* <p>This class registers the following {@link HandlerMapping}s:</p>
8181
* <ul>

0 commit comments

Comments
 (0)