Skip to content

Commit d23b033

Browse files
committed
Polishing
1 parent c74bad6 commit d23b033

File tree

7 files changed

+41
-39
lines changed

7 files changed

+41
-39
lines changed

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@
3232
import org.springframework.jmx.support.RegistrationPolicy;
3333
import org.springframework.jmx.support.WebSphereMBeanServerFactoryBean;
3434
import org.springframework.jndi.JndiLocatorDelegate;
35-
import org.springframework.util.Assert;
3635
import org.springframework.util.ClassUtils;
3736
import org.springframework.util.StringUtils;
3837

@@ -63,8 +62,10 @@ public class MBeanExportConfiguration implements ImportAware, EnvironmentAware,
6362
public void setImportMetadata(AnnotationMetadata importMetadata) {
6463
Map<String, Object> map = importMetadata.getAnnotationAttributes(EnableMBeanExport.class.getName());
6564
this.attributes = AnnotationAttributes.fromMap(map);
66-
Assert.notNull(this.attributes,
67-
"@EnableMBeanExport is not present on importing class " + importMetadata.getClassName());
65+
if (this.attributes == null) {
66+
throw new IllegalArgumentException(
67+
"@EnableMBeanExport is not present on importing class " + importMetadata.getClassName());
68+
}
6869
}
6970

7071
@Override
@@ -78,7 +79,7 @@ public void setBeanFactory(BeanFactory beanFactory) {
7879
}
7980

8081

81-
@Bean(name=MBEAN_EXPORTER_BEAN_NAME)
82+
@Bean(name = MBEAN_EXPORTER_BEAN_NAME)
8283
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
8384
public AnnotationMBeanExporter mbeanExporter() {
8485
AnnotationMBeanExporter exporter = new AnnotationMBeanExporter();

spring-context/src/main/java/org/springframework/context/support/LiveBeansView.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ public class LiveBeansView implements LiveBeansViewMBean, ApplicationContextAwar
5757
private static final Set<ConfigurableApplicationContext> applicationContexts =
5858
new LinkedHashSet<ConfigurableApplicationContext>();
5959

60+
6061
static void registerApplicationContext(ConfigurableApplicationContext applicationContext) {
6162
String mbeanDomain = applicationContext.getEnvironment().getProperty(MBEAN_DOMAIN_PROPERTY_NAME);
6263
if (mbeanDomain != null) {
@@ -94,6 +95,7 @@ static void unregisterApplicationContext(ConfigurableApplicationContext applicat
9495

9596
private ConfigurableApplicationContext applicationContext;
9697

98+
9799
@Override
98100
public void setApplicationContext(ApplicationContext applicationContext) {
99101
Assert.isTrue(applicationContext instanceof ConfigurableApplicationContext,

spring-context/src/main/java/org/springframework/jmx/support/WebSphereMBeanServerFactoryBean.java

Lines changed: 4 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.
@@ -18,7 +18,6 @@
1818

1919
import java.lang.reflect.InvocationTargetException;
2020
import java.lang.reflect.Method;
21-
2221
import javax.management.MBeanServer;
2322

2423
import org.springframework.beans.factory.FactoryBean;
@@ -34,8 +33,9 @@
3433
* This FactoryBean is a direct alternative to {@link MBeanServerFactoryBean},
3534
* which uses standard JMX 1.2 API to access the platform's MBeanServer.
3635
*
37-
* <p>See Javadoc for WebSphere's <a href="http://bit.ly/UzccDt">{@code
38-
* AdminServiceFactory}</a> and <a href="http://bit.ly/TRlX2r">{@code MBeanFactory}</a>.
36+
* <p>See the javadocs for WebSphere's
37+
* <a href="http://bit.ly/UzccDt">{@code AdminServiceFactory}</a>
38+
* and <a href="http://bit.ly/TRlX2r">{@code MBeanFactory}</a>.
3939
*
4040
* @author Juergen Hoeller
4141
* @author Rob Harrop

spring-web/src/main/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBean.java

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,12 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper
128128

129129
private DateFormat dateFormat;
130130

131-
private JsonInclude.Include serializationInclusion;
132-
133131
private AnnotationIntrospector annotationIntrospector;
134132

133+
private PropertyNamingStrategy propertyNamingStrategy;
134+
135+
private JsonInclude.Include serializationInclusion;
136+
135137
private final Map<Class<?>, JsonSerializer<?>> serializers = new LinkedHashMap<Class<?>, JsonSerializer<?>>();
136138

137139
private final Map<Class<?>, JsonDeserializer<?>> deserializers = new LinkedHashMap<Class<?>, JsonDeserializer<?>>();
@@ -144,8 +146,6 @@ public class Jackson2ObjectMapperFactoryBean implements FactoryBean<ObjectMapper
144146

145147
private boolean findModulesViaServiceLoader;
146148

147-
private PropertyNamingStrategy propertyNamingStrategy;
148-
149149
private ClassLoader beanClassLoader;
150150

151151

@@ -184,6 +184,15 @@ public void setAnnotationIntrospector(AnnotationIntrospector annotationIntrospec
184184
this.annotationIntrospector = annotationIntrospector;
185185
}
186186

187+
/**
188+
* Specify a {@link com.fasterxml.jackson.databind.PropertyNamingStrategy} to
189+
* configure the {@link ObjectMapper} with.
190+
* @since 4.0.2
191+
*/
192+
public void setPropertyNamingStrategy(PropertyNamingStrategy propertyNamingStrategy) {
193+
this.propertyNamingStrategy = propertyNamingStrategy;
194+
}
195+
187196
/**
188197
* Set a custom inclusion strategy for serialization.
189198
* @see com.fasterxml.jackson.annotation.JsonInclude.Include
@@ -331,15 +340,6 @@ public void setFindModulesViaServiceLoader(boolean findModules) {
331340
this.findModulesViaServiceLoader = findModules;
332341
}
333342

334-
/**
335-
* Specify a {@link com.fasterxml.jackson.databind.PropertyNamingStrategy} to
336-
* configure the {@link ObjectMapper} with.
337-
* @since 4.0.2
338-
*/
339-
public void setPropertyNamingStrategy(PropertyNamingStrategy propertyNamingStrategy) {
340-
this.propertyNamingStrategy = propertyNamingStrategy;
341-
}
342-
343343
@Override
344344
public void setBeanClassLoader(ClassLoader beanClassLoader) {
345345
this.beanClassLoader = beanClassLoader;

spring-web/src/main/java/org/springframework/web/context/request/async/WebAsyncManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ public void clearConcurrentResult() {
249249
* @see #getConcurrentResult()
250250
* @see #getConcurrentResultContext()
251251
*/
252-
@SuppressWarnings({"unchecked", "rawtypes" })
253-
public void startCallableProcessing(final Callable<?> callable, Object... processingContext) throws Exception {
252+
@SuppressWarnings({"unchecked", "rawtypes"})
253+
public void startCallableProcessing(Callable<?> callable, Object... processingContext) throws Exception {
254254
Assert.notNull(callable, "Callable must not be null");
255255
startCallableProcessing(new WebAsyncTask(callable), processingContext);
256256
}

spring-web/src/test/java/org/springframework/http/converter/json/Jackson2ObjectMapperFactoryBeanTests.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,6 @@
2323
import java.util.HashMap;
2424
import java.util.Map;
2525

26-
import org.junit.Before;
27-
import org.junit.Test;
28-
29-
import org.springframework.beans.FatalBeanException;
30-
3126
import com.fasterxml.jackson.annotation.JsonInclude;
3227
import com.fasterxml.jackson.core.JsonGenerator;
3328
import com.fasterxml.jackson.core.JsonParser;
@@ -50,6 +45,10 @@
5045
import com.fasterxml.jackson.databind.ser.std.ClassSerializer;
5146
import com.fasterxml.jackson.databind.ser.std.NumberSerializers.NumberSerializer;
5247
import com.fasterxml.jackson.databind.type.SimpleType;
48+
import org.junit.Before;
49+
import org.junit.Test;
50+
51+
import org.springframework.beans.FatalBeanException;
5352

5453
import static org.junit.Assert.*;
5554

@@ -65,11 +64,13 @@ public class Jackson2ObjectMapperFactoryBeanTests {
6564

6665
private Jackson2ObjectMapperFactoryBean factory;
6766

67+
6868
@Before
6969
public void setUp() {
7070
factory = new Jackson2ObjectMapperFactoryBean();
7171
}
7272

73+
7374
@Test
7475
public void testSettersWithNullValues() {
7576
// Should not crash:

spring-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketMessageBrokerConfigurer.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* you may not use this file except in compliance with the License.
66
* You may obtain a copy of the License at
77
*
8-
* http://www.apache.org/licenses/LICENSE-2.0
8+
* http://www.apache.org/licenses/LICENSE-2.0
99
*
1010
* Unless required by applicable law or agreed to in writing, software
1111
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,18 +16,18 @@
1616

1717
package org.springframework.web.socket.config.annotation;
1818

19+
import java.util.List;
1920

2021
import org.springframework.messaging.converter.MessageConverter;
2122
import org.springframework.messaging.simp.config.ChannelRegistration;
2223
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
2324

24-
import java.util.List;
25-
2625
/**
2726
* Defines methods for configuring message handling with simple messaging
28-
* protocols (e.g. STOMP) from WebSocket clients. Typically used to customize
29-
* the configuration provided via
30-
* {@link org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker @EnableWebSocketMessageBroker}.
27+
* protocols (e.g. STOMP) from WebSocket clients.
28+
*
29+
* <p>Typically used to customize the configuration provided via
30+
* {@link EnableWebSocketMessageBroker @EnableWebSocketMessageBroker}.
3131
*
3232
* @author Rossen Stoyanchev
3333
* @since 4.0
@@ -56,7 +56,7 @@ public interface WebSocketMessageBrokerConfigurer {
5656

5757
/**
5858
* Configure the {@link org.springframework.messaging.MessageChannel} used for
59-
* incoming messages from WebSocket clients. By default the channel is backed
59+
* outbound messages to WebSocket clients. By default the channel is backed
6060
* by a thread pool of size 1. It is recommended to customize thread pool
6161
* settings for production use.
6262
*/
@@ -66,12 +66,10 @@ public interface WebSocketMessageBrokerConfigurer {
6666
* Configure the message converters to use when extracting the payload of
6767
* messages in annotated methods and when sending messages (e.g. through the
6868
* "broker" SimpMessagingTemplate).
69-
* <p>
70-
* The provided list, initially empty, can be used to add message converters
69+
* <p>The provided list, initially empty, can be used to add message converters
7170
* while the boolean return value is used to determine if default message should
7271
* be added as well.
73-
*
74-
* @param messageConverters initially an empty list of converters
72+
* @param messageConverters the converters to configure (initially an empty list)
7573
* @return whether to also add default converter or not
7674
*/
7775
boolean configureMessageConverters(List<MessageConverter> messageConverters);

0 commit comments

Comments
 (0)