Skip to content

Commit 3a3c52d

Browse files
committed
Polishing
1 parent 44e2921 commit 3a3c52d

File tree

6 files changed

+24
-23
lines changed

6 files changed

+24
-23
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-tx/src/main/java/org/springframework/transaction/config/JtaTransactionManagerFactoryBean.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public JtaTransactionManagerFactoryBean() {
5858
String className = resolveJtaTransactionManagerClassName();
5959
try {
6060
Class<? extends JtaTransactionManager> clazz = (Class<? extends JtaTransactionManager>)
61-
JtaTransactionManagerFactoryBean.class.getClassLoader().loadClass(className);
61+
ClassUtils.forName(className, JtaTransactionManagerFactoryBean.class.getClassLoader());
6262
this.transactionManager = BeanUtils.instantiate(clazz);
6363
}
6464
catch (ClassNotFoundException ex) {

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-websocket/src/main/java/org/springframework/web/socket/config/annotation/WebSocketMessageBrokerConfigurer.java

Lines changed: 10 additions & 12 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,20 +16,20 @@
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.handler.invocation.HandlerMethodArgumentResolver;
2223
import org.springframework.messaging.handler.invocation.HandlerMethodReturnValueHandler;
2324
import org.springframework.messaging.simp.config.ChannelRegistration;
2425
import org.springframework.messaging.simp.config.MessageBrokerRegistry;
2526

26-
import java.util.List;
27-
2827
/**
2928
* Defines methods for configuring message handling with simple messaging
30-
* protocols (e.g. STOMP) from WebSocket clients. Typically used to customize
31-
* the configuration provided via
32-
* {@link org.springframework.web.socket.config.annotation.EnableWebSocketMessageBroker @EnableWebSocketMessageBroker}.
29+
* protocols (e.g. STOMP) from WebSocket clients.
30+
*
31+
* <p>Typically used to customize the configuration provided via
32+
* {@link EnableWebSocketMessageBroker @EnableWebSocketMessageBroker}.
3333
*
3434
* @author Rossen Stoyanchev
3535
* @since 4.0
@@ -69,7 +69,7 @@ public interface WebSocketMessageBrokerConfigurer {
6969
* <p>This does not override the built-in support for resolving handler
7070
* method arguments. To customize the built-in support for argument
7171
* resolution, configure {@code SimpAnnotationMethodMessageHandler} directly.
72-
* @param argumentResolvers initially an empty list
72+
* @param argumentResolvers the resolvers to register (initially an empty list)
7373
* @since 4.1.1
7474
*/
7575
void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers);
@@ -79,7 +79,7 @@ public interface WebSocketMessageBrokerConfigurer {
7979
* <p>Using this option does not override the built-in support for handling
8080
* return values. To customize the built-in support for handling return
8181
* values, configure {@code SimpAnnotationMethodMessageHandler} directly.
82-
* @param returnValueHandlers initially an empty list
82+
* @param returnValueHandlers the handlers to register (initially an empty list)
8383
* @since 4.1.1
8484
*/
8585
void addReturnValueHandlers(List<HandlerMethodReturnValueHandler> returnValueHandlers);
@@ -88,12 +88,10 @@ public interface WebSocketMessageBrokerConfigurer {
8888
* Configure the message converters to use when extracting the payload of
8989
* messages in annotated methods and when sending messages (e.g. through the
9090
* "broker" SimpMessagingTemplate).
91-
* <p>
92-
* The provided list, initially empty, can be used to add message converters
91+
* <p>The provided list, initially empty, can be used to add message converters
9392
* while the boolean return value is used to determine if default message should
9493
* be added as well.
95-
*
96-
* @param messageConverters initially an empty list of converters
94+
* @param messageConverters the converters to configure (initially an empty list)
9795
* @return whether to also add default converter or not
9896
*/
9997
boolean configureMessageConverters(List<MessageConverter> messageConverters);

0 commit comments

Comments
 (0)