diff --git a/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.java b/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.java index adc0b67a906..f6213a7d3c5 100644 --- a/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.java +++ b/spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.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. @@ -100,9 +100,10 @@ public abstract class ScopedProxyUtils { /** * Specify if the {@code beanName} is the name of a bean that references the target * bean within a scoped proxy. + * @since 4.1.4 */ public static boolean isScopedTarget(String beanName) { - return beanName.startsWith(TARGET_NAME_PREFIX); + return (beanName != null && beanName.startsWith(TARGET_NAME_PREFIX)); } } diff --git a/spring-core/src/main/java/org/springframework/core/CollectionFactory.java b/spring-core/src/main/java/org/springframework/core/CollectionFactory.java index c51e7132cd0..b1c1cac38a7 100644 --- a/spring-core/src/main/java/org/springframework/core/CollectionFactory.java +++ b/spring-core/src/main/java/org/springframework/core/CollectionFactory.java @@ -288,13 +288,12 @@ public abstract class CollectionFactory { * @param enumType the enum type, never {@code null} * @return the given type as subtype of {@link Enum} * @throws IllegalArgumentException if the given type is not a subtype of {@link Enum} - * @since 4.1.4 */ @SuppressWarnings("rawtypes") private static Class extends Enum> asEnumType(Class> enumType) { Assert.notNull(enumType, "Enum type must not be null"); if (!Enum.class.isAssignableFrom(enumType)) { - throw new IllegalArgumentException(String.format("The supplied type '%s' is not an enum.", enumType.getName())); + throw new IllegalArgumentException("Supplied type is not an enum: " + enumType.getName()); } return enumType.asSubclass(Enum.class); } diff --git a/spring-web/src/main/java/org/springframework/http/client/ClientHttpRequest.java b/spring-web/src/main/java/org/springframework/http/client/ClientHttpRequest.java index 5532359bbc6..66319033b22 100644 --- a/spring-web/src/main/java/org/springframework/http/client/ClientHttpRequest.java +++ b/spring-web/src/main/java/org/springframework/http/client/ClientHttpRequest.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. @@ -23,10 +23,11 @@ import org.springframework.http.HttpOutputMessage; import org.springframework.http.HttpRequest; /** - * Represents a client-side HTTP request. Created via an implementation of the {@link ClientHttpRequestFactory}. + * Represents a client-side HTTP request. + * Created via an implementation of the {@link ClientHttpRequestFactory}. * - *
A {@code ClientHttpRequest} can be {@linkplain #execute() executed}, getting a - * {@link ClientHttpResponse} which can be read from. + *
A {@code ClientHttpRequest} can be {@linkplain #execute() executed}, + * receiving a {@link ClientHttpResponse} which can be read from. * * @author Arjen Poutsma * @since 3.0 diff --git a/spring-web/src/main/java/org/springframework/http/client/ClientHttpResponse.java b/spring-web/src/main/java/org/springframework/http/client/ClientHttpResponse.java index 26fa24a44cb..05fa7ddd58f 100644 --- a/spring-web/src/main/java/org/springframework/http/client/ClientHttpResponse.java +++ b/spring-web/src/main/java/org/springframework/http/client/ClientHttpResponse.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. @@ -23,10 +23,11 @@ import org.springframework.http.HttpInputMessage; import org.springframework.http.HttpStatus; /** - * Represents a client-side HTTP response. Obtained via an calling of the {@link ClientHttpRequest#execute()}. + * Represents a client-side HTTP response. + * Obtained via an calling of the {@link ClientHttpRequest#execute()}. * - *
A {@code ClientHttpResponse} must be {@linkplain #close() closed}, typically in a - * {@code finally} block. + *
A {@code ClientHttpResponse} must be {@linkplain #close() closed},
+ * typically in a {@code finally} block.
*
* @author Arjen Poutsma
* @since 3.0
@@ -55,7 +56,7 @@ public interface ClientHttpResponse extends HttpInputMessage, Closeable {
String getStatusText() throws IOException;
/**
- * Closes this response, freeing any resources created.
+ * Close this response, freeing any resources created.
*/
@Override
void close();
diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java
index afb6cfc87ae..7c4b635afe0 100644
--- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java
+++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java
@@ -73,7 +73,7 @@ public class FreeMarkerMacroTests {
// final Template expectedTemplate = new Template();
fc = new FreeMarkerConfigurer();
- fc.setTemplateLoaderPaths(new String[] { "classpath:/", "file://" + System.getProperty("java.io.tmpdir") });
+ fc.setTemplateLoaderPaths("classpath:/", "file://" + System.getProperty("java.io.tmpdir"));
fc.afterPropertiesSet();
wac.getDefaultListableBeanFactory().registerSingleton("freeMarkerConfigurer", fc);
@@ -86,6 +86,7 @@ public class FreeMarkerMacroTests {
response = new MockHttpServletResponse();
}
+
@Test
public void testExposeSpringMacroHelpers() throws Exception {
FreeMarkerView fv = new FreeMarkerView() {
@@ -128,7 +129,8 @@ public class FreeMarkerMacroTests {
try {
fv.render(model, request, response);
- } catch (Exception ex) {
+ }
+ catch (Exception ex) {
assertTrue(ex instanceof ServletException);
assertTrue(ex.getMessage().contains(FreeMarkerView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE));
}
diff --git a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerViewTests.java b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerViewTests.java
index 98346c83eef..330399afcb9 100644
--- a/spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerViewTests.java
+++ b/spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerViewTests.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.
@@ -69,7 +69,7 @@ public class FreeMarkerViewTests {
}
catch (ApplicationContextException ex) {
// Check there's a helpful error message
- assertTrue(ex.getMessage().indexOf("FreeMarkerConfig") != -1);
+ assertTrue(ex.getMessage().contains("FreeMarkerConfig"));
}
}
@@ -82,7 +82,7 @@ public class FreeMarkerViewTests {
}
catch (IllegalArgumentException ex) {
// Check there's a helpful error message
- assertTrue(ex.getMessage().indexOf("url") != -1);
+ assertTrue(ex.getMessage().contains("url"));
}
}
@@ -93,7 +93,7 @@ public class FreeMarkerViewTests {
WebApplicationContext wac = mock(WebApplicationContext.class);
MockServletContext sc = new MockServletContext();
- Map configs = new HashMap();
+ Map