From ede2150544e91b8a19e053e914d00e0e722d6116 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 2 Jul 2014 17:32:43 +0200 Subject: [PATCH] Polishing --- ...wiredAnnotationBeanPostProcessorTests.java | 10 ++++----- .../TransactionAwareCacheManagerProxy.java | 4 ++-- .../messaging/core/DestinationResolver.java | 8 ++++--- .../AbstractWireFeedHttpMessageConverter.java | 12 +++++++---- .../feed/AtomFeedHttpMessageConverter.java | 15 +++++++------ .../feed/RssChannelHttpMessageConverter.java | 14 ++++++------- .../http/converter/feed/package-info.java | 17 +-------------- .../AtomFeedHttpMessageConverterTests.java | 19 +++++++++-------- .../RssChannelHttpMessageConverterTests.java | 21 ++++++++++--------- .../AnnotationDrivenBeanDefinitionParser.java | 2 +- .../view/feed/AbstractAtomFeedView.java | 13 +++++------- .../view/feed/AbstractRssFeedView.java | 11 ++++------ .../web/servlet/view/feed/package-info.java | 4 ++-- .../servlet/view/feed/AtomFeedViewTests.java | 4 +++- .../servlet/view/feed/RssFeedViewTests.java | 12 +++++------ 15 files changed, 76 insertions(+), 90 deletions(-) diff --git a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java index 8953633dff9..3307bc944e6 100644 --- a/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java +++ b/spring-beans/src/test/java/org/springframework/beans/factory/annotation/AutowiredAnnotationBeanPostProcessorTests.java @@ -2593,7 +2593,7 @@ public class AutowiredAnnotationBeanPostProcessorTests { @SuppressWarnings("unchecked") public T createMock(Class toMock) { - return (T) Proxy.newProxyInstance(AutowiredAnnotationBeanPostProcessorTests.class.getClassLoader(), new Class[]{toMock}, + return (T) Proxy.newProxyInstance(AutowiredAnnotationBeanPostProcessorTests.class.getClassLoader(), new Class[] {toMock}, new InvocationHandler() { @Override public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { @@ -2620,11 +2620,11 @@ public class AutowiredAnnotationBeanPostProcessorTests { return gi2.doSomethingMoreGeneric(o) + "_somethingGeneric_" + o; } - public static GenericInterface1 create(){ + public static GenericInterface1 create() { return new StringGenericInterface1Impl(); } - public static GenericInterface1 createPlain(){ + public static GenericInterface1 createPlain() { return new GenericInterface1Impl(); } } @@ -2640,7 +2640,7 @@ public class AutowiredAnnotationBeanPostProcessorTests { } - public static class GenericInterface2Impl implements GenericInterface2{ + public static class GenericInterface2Impl implements GenericInterface2 { @Override public String doSomethingMoreGeneric(String o) { @@ -2658,7 +2658,7 @@ public class AutowiredAnnotationBeanPostProcessorTests { } - public static class PlainGenericInterface2Impl implements GenericInterface2{ + public static class PlainGenericInterface2Impl implements GenericInterface2 { @Override public String doSomethingMoreGeneric(Object o) { diff --git a/spring-context-support/src/main/java/org/springframework/cache/transaction/TransactionAwareCacheManagerProxy.java b/spring-context-support/src/main/java/org/springframework/cache/transaction/TransactionAwareCacheManagerProxy.java index 2813c0d334a..c5250af744b 100644 --- a/spring-context-support/src/main/java/org/springframework/cache/transaction/TransactionAwareCacheManagerProxy.java +++ b/spring-context-support/src/main/java/org/springframework/cache/transaction/TransactionAwareCacheManagerProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -68,7 +68,7 @@ public class TransactionAwareCacheManagerProxy implements CacheManager, Initiali @Override public void afterPropertiesSet() { if (this.targetCacheManager == null) { - throw new IllegalStateException("'targetCacheManager' is required"); + throw new IllegalArgumentException("Property 'targetCacheManager' is required"); } } diff --git a/spring-messaging/src/main/java/org/springframework/messaging/core/DestinationResolver.java b/spring-messaging/src/main/java/org/springframework/messaging/core/DestinationResolver.java index 908906e3abe..2521c05f6cc 100644 --- a/spring-messaging/src/main/java/org/springframework/messaging/core/DestinationResolver.java +++ b/spring-messaging/src/main/java/org/springframework/messaging/core/DestinationResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ package org.springframework.messaging.core; /** - * Strategy for resolving a String destination name into an actual destination + * Strategy for resolving a String destination name to an actual destination * of type {@code }. * * @author Mark Fisher @@ -28,7 +28,9 @@ public interface DestinationResolver { /** * Resolve the given destination name. * @param name the destination name to resolve - * @return the destination, never {@code null} + * @return the resolved destination (never {@code null}) + * @throws DestinationResolutionException if the specified destination + * wasn't found or wasn't resolvable for any other reason */ D resolveDestination(String name) throws DestinationResolutionException; diff --git a/spring-web/src/main/java/org/springframework/http/converter/feed/AbstractWireFeedHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/feed/AbstractWireFeedHttpMessageConverter.java index afd98288ada..d8151cf58b3 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/feed/AbstractWireFeedHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/feed/AbstractWireFeedHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ import org.springframework.util.StringUtils; /** * Abstract base class for Atom and RSS Feed message converters, using the - * ROME tools project. + * ROME tools project. * * @author Arjen Poutsma * @since 3.0.2 @@ -49,14 +49,17 @@ public abstract class AbstractWireFeedHttpMessageConverter e public static final Charset DEFAULT_CHARSET = Charset.forName("UTF-8"); + protected AbstractWireFeedHttpMessageConverter(MediaType supportedMediaType) { super(supportedMediaType); } + @Override @SuppressWarnings("unchecked") protected T readInternal(Class clazz, HttpInputMessage inputMessage) throws IOException, HttpMessageNotReadableException { + WireFeedInput feedInput = new WireFeedInput(); MediaType contentType = inputMessage.getHeaders().getContentType(); Charset charset; @@ -77,6 +80,7 @@ public abstract class AbstractWireFeedHttpMessageConverter e @Override protected void writeInternal(T wireFeed, HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException { + String wireFeedEncoding = wireFeed.getEncoding(); if (!StringUtils.hasLength(wireFeedEncoding)) { wireFeedEncoding = DEFAULT_CHARSET.name(); @@ -89,13 +93,13 @@ public abstract class AbstractWireFeedHttpMessageConverter e } WireFeedOutput feedOutput = new WireFeedOutput(); - try { Writer writer = new OutputStreamWriter(outputMessage.getBody(), wireFeedEncoding); feedOutput.output(wireFeed, writer); } catch (FeedException ex) { - throw new HttpMessageNotWritableException("Could not write WiredFeed: " + ex.getMessage(), ex); + throw new HttpMessageNotWritableException("Could not write WireFeed: " + ex.getMessage(), ex); } } + } diff --git a/spring-web/src/main/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverter.java index e8a4e43c7bf..adfbfc8dca4 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,16 +21,16 @@ import com.sun.syndication.feed.atom.Feed; import org.springframework.http.MediaType; /** - * Implementation of {@link org.springframework.http.converter.HttpMessageConverter} that can read and write Atom feeds. - * Specifically, this converter can handle {@link Feed} objects, from the ROME - * project. + * Implementation of {@link org.springframework.http.converter.HttpMessageConverter} + * that can read and write Atom feeds. Specifically, this converter can handle {@link Feed} + * objects from the ROME project. * - *

By default, this converter reads and writes the media type ({@code application/atom+xml}). This can - * be overridden by setting the {@link #setSupportedMediaTypes(java.util.List) supportedMediaTypes} property. + *

By default, this converter reads and writes the media type ({@code application/atom+xml}). + * This can be overridden through the {@link #setSupportedMediaTypes supportedMediaTypes} property. * * @author Arjen Poutsma - * @see Feed * @since 3.0.2 + * @see Feed */ public class AtomFeedHttpMessageConverter extends AbstractWireFeedHttpMessageConverter { @@ -43,5 +43,4 @@ public class AtomFeedHttpMessageConverter extends AbstractWireFeedHttpMessageCon return Feed.class.isAssignableFrom(clazz); } - } diff --git a/spring-web/src/main/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverter.java b/spring-web/src/main/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverter.java index 08091984d9f..b318c017465 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverter.java +++ b/spring-web/src/main/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,16 +21,16 @@ import com.sun.syndication.feed.rss.Channel; import org.springframework.http.MediaType; /** - * Implementation of {@link org.springframework.http.converter.HttpMessageConverter} that can read and write RSS feeds. - * Specifically, this converter can handle {@link Channel} objects, from the ROME - * project. + * Implementation of {@link org.springframework.http.converter.HttpMessageConverter} + * that can read and write RSS feeds. Specifically, this converter can handle {@link Channel} + * objects from the ROME project. * - *

By default, this converter reads and writes the media type ({@code application/rss+xml}). This can - * be overridden by setting the {@link #setSupportedMediaTypes(java.util.List) supportedMediaTypes} property. + *

By default, this converter reads and writes the media type ({@code application/rss+xml}). + * This can be overridden through the {@link #setSupportedMediaTypes supportedMediaTypes} property. * * @author Arjen Poutsma - * @see Channel * @since 3.0.2 + * @see Channel */ public class RssChannelHttpMessageConverter extends AbstractWireFeedHttpMessageConverter { diff --git a/spring-web/src/main/java/org/springframework/http/converter/feed/package-info.java b/spring-web/src/main/java/org/springframework/http/converter/feed/package-info.java index 919e6eaf1ee..fd1393e424a 100644 --- a/spring-web/src/main/java/org/springframework/http/converter/feed/package-info.java +++ b/spring-web/src/main/java/org/springframework/http/converter/feed/package-info.java @@ -1,23 +1,8 @@ -/* - * Copyright 2002-2010 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ /** * * Provides HttpMessageConverter implementations for handling Atom and RSS feeds. + * Based on the ROME tools project. * */ package org.springframework.http.converter.feed; - diff --git a/spring-web/src/test/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverterTests.java index 57ffc51f356..59d12895ad7 100644 --- a/spring-web/src/test/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverterTests.java +++ b/spring-web/src/test/java/org/springframework/http/converter/feed/AtomFeedHttpMessageConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,10 +24,7 @@ import java.util.List; import com.sun.syndication.feed.atom.Entry; import com.sun.syndication.feed.atom.Feed; -import static org.custommonkey.xmlunit.XMLAssert.*; import org.custommonkey.xmlunit.XMLUnit; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; import org.xml.sax.SAXException; @@ -36,7 +33,13 @@ import org.springframework.http.MediaType; import org.springframework.http.MockHttpInputMessage; import org.springframework.http.MockHttpOutputMessage; -/** @author Arjen Poutsma */ +import static org.custommonkey.xmlunit.XMLAssert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +/** + * @author Arjen Poutsma + */ public class AtomFeedHttpMessageConverterTests { private AtomFeedHttpMessageConverter converter; @@ -70,7 +73,7 @@ public class AtomFeedHttpMessageConverterTests { Feed result = converter.read(Feed.class, inputMessage); assertEquals("title", result.getTitle()); assertEquals("subtitle", result.getSubtitle().getValue()); - List entries = result.getEntries(); + List entries = result.getEntries(); assertEquals(2, entries.size()); Entry entry1 = (Entry) entries.get(0); @@ -95,7 +98,7 @@ public class AtomFeedHttpMessageConverterTests { entry2.setId("id2"); entry2.setTitle("title2"); - List entries = new ArrayList(2); + List entries = new ArrayList(2); entries.add(entry1); entries.add(entry2); feed.setEntries(entries); @@ -109,7 +112,6 @@ public class AtomFeedHttpMessageConverterTests { "id1title1" + "id2title2"; assertXMLEqual(expected, outputMessage.getBodyAsString(utf8)); - } @Test @@ -126,5 +128,4 @@ public class AtomFeedHttpMessageConverterTests { outputMessage.getHeaders().getContentType()); } - } diff --git a/spring-web/src/test/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverterTests.java b/spring-web/src/test/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverterTests.java index 6f7cf78cd31..d29991a6851 100644 --- a/spring-web/src/test/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverterTests.java +++ b/spring-web/src/test/java/org/springframework/http/converter/feed/RssChannelHttpMessageConverterTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2010 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,10 +24,7 @@ import java.util.List; import com.sun.syndication.feed.rss.Channel; import com.sun.syndication.feed.rss.Item; -import static org.custommonkey.xmlunit.XMLAssert.*; import org.custommonkey.xmlunit.XMLUnit; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; import org.junit.Before; import org.junit.Test; import org.xml.sax.SAXException; @@ -36,7 +33,13 @@ import org.springframework.http.MediaType; import org.springframework.http.MockHttpInputMessage; import org.springframework.http.MockHttpOutputMessage; -/** @author Arjen Poutsma */ +import static org.custommonkey.xmlunit.XMLAssert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + +/** + * @author Arjen Poutsma + */ public class RssChannelHttpMessageConverterTests { private RssChannelHttpMessageConverter converter; @@ -72,7 +75,7 @@ public class RssChannelHttpMessageConverterTests { assertEquals("http://example.com", result.getLink()); assertEquals("description", result.getDescription()); - List items = result.getItems(); + List items = result.getItems(); assertEquals(2, items.size()); Item item1 = (Item) items.get(0); @@ -95,7 +98,7 @@ public class RssChannelHttpMessageConverterTests { Item item2 = new Item(); item2.setTitle("title2"); - List items = new ArrayList(2); + List items = new ArrayList(2); items.add(item1); items.add(item2); channel.setItems(items); @@ -111,7 +114,6 @@ public class RssChannelHttpMessageConverterTests { "title2" + ""; assertXMLEqual(expected, outputMessage.getBodyAsString(utf8)); - } @Test @@ -134,5 +136,4 @@ public class RssChannelHttpMessageConverterTests { outputMessage.getHeaders().getContentType()); } - -} \ No newline at end of file +} diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java index 80dcf322bf4..127302d06e1 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/config/AnnotationDrivenBeanDefinitionParser.java @@ -75,7 +75,7 @@ import org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolv /** * A {@link BeanDefinitionParser} that provides the configuration for the - * {@code } MVC namespace element. + * {@code } MVC namespace element. * *

This class registers the following {@link HandlerMapping}s:

*
    diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractAtomFeedView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractAtomFeedView.java index 7e48d1b38dc..9c7e39f1f74 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractAtomFeedView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractAtomFeedView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2008 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import com.sun.syndication.feed.WireFeed; import com.sun.syndication.feed.atom.Entry; import com.sun.syndication.feed.atom.Feed; @@ -31,17 +30,15 @@ import com.sun.syndication.feed.atom.Feed; * *

    Application-specific view classes will extend this class. * The view will be held in the subclass itself, not in a template. - * - *

    Main entry points are the {@link #buildFeedMetadata(Map, WireFeed, HttpServletRequest)} and - * {@link #buildFeedEntries(Map, HttpServletRequest, HttpServletResponse)}. + * Main entry points are the {@link #buildFeedMetadata} and {@link #buildFeedEntries}. * *

    Thanks to Jettro Coenradie and Sergio Bossa for the original feed view prototype! * * @author Arjen Poutsma * @author Juergen Hoeller * @since 3.0 - * @see #buildFeedMetadata(Map, WireFeed, HttpServletRequest) - * @see #buildFeedEntries(Map, HttpServletRequest, HttpServletResponse) + * @see #buildFeedMetadata + * @see #buildFeedEntries * @see Atom Syndication Format */ public abstract class AbstractAtomFeedView extends AbstractFeedView { @@ -56,7 +53,7 @@ public abstract class AbstractAtomFeedView extends AbstractFeedView { } /** - * Sets the Rome feed type to use. + * Set the Rome feed type to use. *

    Defaults to Atom 1.0. * @see Feed#setFeedType(String) * @see #DEFAULT_FEED_TYPE diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractRssFeedView.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractRssFeedView.java index 46d80376db2..3516c983223 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractRssFeedView.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/AbstractRssFeedView.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,7 +21,6 @@ import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import com.sun.syndication.feed.WireFeed; import com.sun.syndication.feed.rss.Channel; import com.sun.syndication.feed.rss.Item; @@ -31,17 +30,15 @@ import com.sun.syndication.feed.rss.Item; * *

    Application-specific view classes will extend this class. * The view will be held in the subclass itself, not in a template. - * - *

    Main entry points are the {@link #buildFeedMetadata(Map, WireFeed , HttpServletRequest)} - * and {@link #buildFeedItems(Map, HttpServletRequest, HttpServletResponse)}. + * Main entry points are the {@link #buildFeedMetadata} and {@link #buildFeedItems}. * *

    Thanks to Jettro Coenradie and Sergio Bossa for the original feed view prototype! * * @author Arjen Poutsma * @author Juergen Hoeller * @since 3.0 - * @see #buildFeedMetadata(Map, WireFeed , HttpServletRequest) - * @see #buildFeedItems(Map, HttpServletRequest, HttpServletResponse) + * @see #buildFeedMetadata + * @see #buildFeedItems */ public abstract class AbstractRssFeedView extends AbstractFeedView { diff --git a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/package-info.java b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/package-info.java index 099a6bbe9b9..ed22ecbaf43 100644 --- a/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/package-info.java +++ b/spring-webmvc/src/main/java/org/springframework/web/servlet/view/feed/package-info.java @@ -1,8 +1,8 @@ /** * - * Support classes for feed generation, providing View implementations for Atom and RSS + * Support classes for feed generation, providing View implementations for Atom and RSS. + * Based on the ROME tools project. * */ package org.springframework.web.servlet.view.feed; - diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/AtomFeedViewTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/AtomFeedViewTests.java index e2236eb281d..015bf52eeae 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/AtomFeedViewTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/AtomFeedViewTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -67,6 +67,7 @@ public class AtomFeedViewTests { assertXMLEqual(expected, response.getContentAsString()); } + private static class MyAtomFeedView extends AbstractAtomFeedView { @Override @@ -90,4 +91,5 @@ public class AtomFeedViewTests { return entries; } } + } diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/RssFeedViewTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/RssFeedViewTests.java index 6569263f0ac..0f15bcacef8 100644 --- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/RssFeedViewTests.java +++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/feed/RssFeedViewTests.java @@ -1,5 +1,5 @@ /* - * Copyright ${YEAR} the original author or authors. + * Copyright 2002-2014 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ package org.springframework.web.servlet.view.feed; import java.util.ArrayList; -import java.util.Iterator; import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -48,7 +47,6 @@ public class RssFeedViewTests { public void createView() throws Exception { view = new MyRssFeedView(); setIgnoreWhitespace(true); - } @Test @@ -69,6 +67,7 @@ public class RssFeedViewTests { assertXMLEqual(expected, response.getContentAsString()); } + private static class MyRssFeedView extends AbstractRssFeedView { @Override @@ -79,11 +78,9 @@ public class RssFeedViewTests { } @Override - protected List buildFeedItems(Map model, HttpServletRequest request, HttpServletResponse response) - throws Exception { + protected List buildFeedItems(Map model, HttpServletRequest request, HttpServletResponse response) throws Exception { List items = new ArrayList(); - for (Iterator iterator = model.keySet().iterator(); iterator.hasNext();) { - String name = (String) iterator.next(); + for (String name : model.keySet()) { Item item = new Item(); item.setTitle(name); Description description = new Description(); @@ -94,4 +91,5 @@ public class RssFeedViewTests { return items; } } + }