Skip to content

Commit 86b8112

Browse files
committed
Polishing
1 parent 6f2de28 commit 86b8112

File tree

6 files changed

+27
-23
lines changed

6 files changed

+27
-23
lines changed

spring-aop/src/main/java/org/springframework/aop/scope/ScopedProxyUtils.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-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.
@@ -100,9 +100,10 @@ public static String getTargetBeanName(String originalBeanName) {
100100
/**
101101
* Specify if the {@code beanName} is the name of a bean that references the target
102102
* bean within a scoped proxy.
103+
* @since 4.1.4
103104
*/
104105
public static boolean isScopedTarget(String beanName) {
105-
return beanName.startsWith(TARGET_NAME_PREFIX);
106+
return (beanName != null && beanName.startsWith(TARGET_NAME_PREFIX));
106107
}
107108

108109
}

spring-core/src/main/java/org/springframework/core/CollectionFactory.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,13 +288,12 @@ else if (EnumMap.class.equals(mapType)) {
288288
* @param enumType the enum type, never {@code null}
289289
* @return the given type as subtype of {@link Enum}
290290
* @throws IllegalArgumentException if the given type is not a subtype of {@link Enum}
291-
* @since 4.1.4
292291
*/
293292
@SuppressWarnings("rawtypes")
294293
private static Class<? extends Enum> asEnumType(Class<?> enumType) {
295294
Assert.notNull(enumType, "Enum type must not be null");
296295
if (!Enum.class.isAssignableFrom(enumType)) {
297-
throw new IllegalArgumentException(String.format("The supplied type '%s' is not an enum.", enumType.getName()));
296+
throw new IllegalArgumentException("Supplied type is not an enum: " + enumType.getName());
298297
}
299298
return enumType.asSubclass(Enum.class);
300299
}

spring-web/src/main/java/org/springframework/http/client/ClientHttpRequest.java

Lines changed: 5 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.
@@ -23,10 +23,11 @@
2323
import org.springframework.http.HttpRequest;
2424

2525
/**
26-
* Represents a client-side HTTP request. Created via an implementation of the {@link ClientHttpRequestFactory}.
26+
* Represents a client-side HTTP request.
27+
* Created via an implementation of the {@link ClientHttpRequestFactory}.
2728
*
28-
* <p>A {@code ClientHttpRequest} can be {@linkplain #execute() executed}, getting a
29-
* {@link ClientHttpResponse} which can be read from.
29+
* <p>A {@code ClientHttpRequest} can be {@linkplain #execute() executed},
30+
* receiving a {@link ClientHttpResponse} which can be read from.
3031
*
3132
* @author Arjen Poutsma
3233
* @since 3.0

spring-web/src/main/java/org/springframework/http/client/ClientHttpResponse.java

Lines changed: 6 additions & 5 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.
@@ -23,10 +23,11 @@
2323
import org.springframework.http.HttpStatus;
2424

2525
/**
26-
* Represents a client-side HTTP response. Obtained via an calling of the {@link ClientHttpRequest#execute()}.
26+
* Represents a client-side HTTP response.
27+
* Obtained via an calling of the {@link ClientHttpRequest#execute()}.
2728
*
28-
* <p>A {@code ClientHttpResponse} must be {@linkplain #close() closed}, typically in a
29-
* {@code finally} block.
29+
* <p>A {@code ClientHttpResponse} must be {@linkplain #close() closed},
30+
* typically in a {@code finally} block.
3031
*
3132
* @author Arjen Poutsma
3233
* @since 3.0
@@ -55,7 +56,7 @@ public interface ClientHttpResponse extends HttpInputMessage, Closeable {
5556
String getStatusText() throws IOException;
5657

5758
/**
58-
* Closes this response, freeing any resources created.
59+
* Close this response, freeing any resources created.
5960
*/
6061
@Override
6162
void close();

spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerMacroTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public void setUp() throws Exception {
7373

7474
// final Template expectedTemplate = new Template();
7575
fc = new FreeMarkerConfigurer();
76-
fc.setTemplateLoaderPaths(new String[] { "classpath:/", "file://" + System.getProperty("java.io.tmpdir") });
76+
fc.setTemplateLoaderPaths("classpath:/", "file://" + System.getProperty("java.io.tmpdir"));
7777
fc.afterPropertiesSet();
7878

7979
wac.getDefaultListableBeanFactory().registerSingleton("freeMarkerConfigurer", fc);
@@ -86,6 +86,7 @@ public void setUp() throws Exception {
8686
response = new MockHttpServletResponse();
8787
}
8888

89+
8990
@Test
9091
public void testExposeSpringMacroHelpers() throws Exception {
9192
FreeMarkerView fv = new FreeMarkerView() {
@@ -128,7 +129,8 @@ protected void processTemplate(Template template, SimpleHash model, HttpServletR
128129

129130
try {
130131
fv.render(model, request, response);
131-
} catch (Exception ex) {
132+
}
133+
catch (Exception ex) {
132134
assertTrue(ex instanceof ServletException);
133135
assertTrue(ex.getMessage().contains(FreeMarkerView.SPRING_MACRO_REQUEST_CONTEXT_ATTRIBUTE));
134136
}

spring-webmvc/src/test/java/org/springframework/web/servlet/view/freemarker/FreeMarkerViewTests.java

Lines changed: 8 additions & 8 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.
@@ -69,7 +69,7 @@ public void testNoFreeMarkerConfig() throws Exception {
6969
}
7070
catch (ApplicationContextException ex) {
7171
// Check there's a helpful error message
72-
assertTrue(ex.getMessage().indexOf("FreeMarkerConfig") != -1);
72+
assertTrue(ex.getMessage().contains("FreeMarkerConfig"));
7373
}
7474
}
7575

@@ -82,7 +82,7 @@ public void testNoTemplateName() throws Exception {
8282
}
8383
catch (IllegalArgumentException ex) {
8484
// Check there's a helpful error message
85-
assertTrue(ex.getMessage().indexOf("url") != -1);
85+
assertTrue(ex.getMessage().contains("url"));
8686
}
8787
}
8888

@@ -93,7 +93,7 @@ public void testValidTemplateName() throws Exception {
9393
WebApplicationContext wac = mock(WebApplicationContext.class);
9494
MockServletContext sc = new MockServletContext();
9595

96-
Map configs = new HashMap();
96+
Map<String, FreeMarkerConfig> configs = new HashMap<String, FreeMarkerConfig>();
9797
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
9898
configurer.setConfiguration(new TestConfiguration());
9999
configs.put("configurer", configurer);
@@ -109,7 +109,7 @@ public void testValidTemplateName() throws Exception {
109109
request.setAttribute(DispatcherServlet.LOCALE_RESOLVER_ATTRIBUTE, new AcceptHeaderLocaleResolver());
110110
HttpServletResponse response = new MockHttpServletResponse();
111111

112-
Map model = new HashMap();
112+
Map<String, Object> model = new HashMap<String, Object>();
113113
model.put("myattr", "myvalue");
114114
fv.render(model, request, response);
115115

@@ -123,7 +123,7 @@ public void testKeepExistingContentType() throws Exception {
123123
WebApplicationContext wac = mock(WebApplicationContext.class);
124124
MockServletContext sc = new MockServletContext();
125125

126-
Map configs = new HashMap();
126+
Map<String, FreeMarkerConfig> configs = new HashMap<String, FreeMarkerConfig>();
127127
FreeMarkerConfigurer configurer = new FreeMarkerConfigurer();
128128
configurer.setConfiguration(new TestConfiguration());
129129
configs.put("configurer", configurer);
@@ -140,7 +140,7 @@ public void testKeepExistingContentType() throws Exception {
140140
HttpServletResponse response = new MockHttpServletResponse();
141141
response.setContentType("myContentType");
142142

143-
Map model = new HashMap();
143+
Map<String, Object> model = new HashMap<String, Object>();
144144
model.put("myattr", "myvalue");
145145
fv.render(model, request, response);
146146

@@ -184,7 +184,7 @@ private class TestConfiguration extends Configuration {
184184
@Override
185185
public Template getTemplate(String name, final Locale locale) throws IOException {
186186
if (name.equals("templateName") || name.equals("prefix_test_suffix")) {
187-
return new Template(name, new StringReader("test")) {
187+
return new Template(name, new StringReader("test"), this) {
188188
@Override
189189
public void process(Object model, Writer writer) throws TemplateException, IOException {
190190
assertEquals(Locale.US, locale);

0 commit comments

Comments
 (0)