Skip to content

Commit 2bf8c0b

Browse files
committed
Polishing
1 parent cdf6eb9 commit 2bf8c0b

File tree

4 files changed

+24
-25
lines changed

4 files changed

+24
-25
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/config/BeanPostProcessor.java

Lines changed: 5 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-2015 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.
@@ -48,8 +48,8 @@ public interface BeanPostProcessor {
4848
* The returned bean instance may be a wrapper around the original.
4949
* @param bean the new bean instance
5050
* @param beanName the name of the bean
51-
* @return the bean instance to use, either the original or a wrapped one; if
52-
* {@code null}, no subsequent BeanPostProcessors will be invoked
51+
* @return the bean instance to use, either the original or a wrapped one;
52+
* if {@code null}, no subsequent BeanPostProcessors will be invoked
5353
* @throws org.springframework.beans.BeansException in case of errors
5454
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet
5555
*/
@@ -69,8 +69,8 @@ public interface BeanPostProcessor {
6969
* in contrast to all other BeanPostProcessor callbacks.
7070
* @param bean the new bean instance
7171
* @param beanName the name of the bean
72-
* @return the bean instance to use, either the original or a wrapped one; if
73-
* {@code null}, no subsequent BeanPostProcessors will be invoked
72+
* @return the bean instance to use, either the original or a wrapped one;
73+
* if {@code null}, no subsequent BeanPostProcessors will be invoked
7474
* @throws org.springframework.beans.BeansException in case of errors
7575
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet
7676
* @see org.springframework.beans.factory.FactoryBean

spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@
3737
import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor;
3838
import org.springframework.util.Assert;
3939
import org.springframework.util.ClassUtils;
40+
import org.springframework.util.CollectionUtils;
4041
import org.springframework.util.ReflectionUtils;
4142
import org.springframework.util.StringUtils;
4243

4344
/**
44-
* Adapter that implements the {@link DisposableBean} and {@link Runnable} interfaces
45-
* performing various destruction steps on a given bean instance:
45+
* Adapter that implements the {@link DisposableBean} and {@link Runnable}
46+
* interfaces performing various destruction steps on a given bean instance:
4647
* <ul>
4748
* <li>DestructionAwareBeanPostProcessors;
4849
* <li>the bean implementing DisposableBean itself;
@@ -218,7 +219,7 @@ private String inferDestroyMethodIfNecessary(Object bean, RootBeanDefinition bea
218219
*/
219220
private List<DestructionAwareBeanPostProcessor> filterPostProcessors(List<BeanPostProcessor> postProcessors) {
220221
List<DestructionAwareBeanPostProcessor> filteredPostProcessors = null;
221-
if (postProcessors != null && !postProcessors.isEmpty()) {
222+
if (!CollectionUtils.isEmpty(postProcessors)) {
222223
filteredPostProcessors = new ArrayList<DestructionAwareBeanPostProcessor>(postProcessors.size());
223224
for (BeanPostProcessor postProcessor : postProcessors) {
224225
if (postProcessor instanceof DestructionAwareBeanPostProcessor) {
@@ -237,7 +238,7 @@ public void run() {
237238

238239
@Override
239240
public void destroy() {
240-
if (this.beanPostProcessors != null && !this.beanPostProcessors.isEmpty()) {
241+
if (!CollectionUtils.isEmpty(this.beanPostProcessors)) {
241242
for (DestructionAwareBeanPostProcessor processor : this.beanPostProcessors) {
242243
processor.postProcessBeforeDestruction(this.bean, this.beanName);
243244
}

spring-core/src/main/java/org/springframework/util/ReflectionUtils.java

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ public abstract class ReflectionUtils {
5555

5656
private static final Field[] NO_FIELDS = {};
5757

58+
5859
/**
5960
* Cache for {@link Class#getDeclaredMethods()} plus equivalent default methods
6061
* from Java 8 based interfaces, allowing for fast iteration.
@@ -114,7 +115,7 @@ public static Field findField(Class<?> clazz, String name, Class<?> type) {
114115
* <p>Thrown exceptions are handled via a call to {@link #handleReflectionException(Exception)}.
115116
* @param field the field to set
116117
* @param target the target object on which to set the field
117-
* @param value the value to set; may be {@code null}
118+
* @param value the value to set (may be {@code null})
118119
*/
119120
public static void setField(Field field, Object target, Object value) {
120121
try {
@@ -296,12 +297,11 @@ public static void handleInvocationTargetException(InvocationTargetException ex)
296297

297298
/**
298299
* Rethrow the given {@link Throwable exception}, which is presumably the
299-
* <em>target exception</em> of an {@link InvocationTargetException}. Should
300-
* only be called if no checked exception is expected to be thrown by the
301-
* target method.
300+
* <em>target exception</em> of an {@link InvocationTargetException}.
301+
* Should only be called if no checked exception is expected to be thrown
302+
* by the target method.
302303
* <p>Rethrows the underlying exception cast to an {@link RuntimeException} or
303-
* {@link Error} if appropriate; otherwise, throws an
304-
* {@link IllegalStateException}.
304+
* {@link Error} if appropriate; otherwise, throws an {@link IllegalStateException}.
305305
* @param ex the exception to rethrow
306306
* @throws RuntimeException the rethrown exception
307307
*/
@@ -317,12 +317,11 @@ public static void rethrowRuntimeException(Throwable ex) {
317317

318318
/**
319319
* Rethrow the given {@link Throwable exception}, which is presumably the
320-
* <em>target exception</em> of an {@link InvocationTargetException}. Should
321-
* only be called if no checked exception is expected to be thrown by the
322-
* target method.
320+
* <em>target exception</em> of an {@link InvocationTargetException}.
321+
* Should only be called if no checked exception is expected to be thrown
322+
* by the target method.
323323
* <p>Rethrows the underlying exception cast to an {@link Exception} or
324-
* {@link Error} if appropriate; otherwise, throws an
325-
* {@link IllegalStateException}.
324+
* {@link Error} if appropriate; otherwise, throws an {@link IllegalStateException}.
326325
* @param ex the exception to rethrow
327326
* @throws Exception the rethrown exception (in case of a checked exception)
328327
*/
@@ -338,8 +337,8 @@ public static void rethrowException(Throwable ex) throws Exception {
338337

339338
/**
340339
* Determine whether the given method explicitly declares the given
341-
* exception or one of its superclasses, which means that an exception of
342-
* that type can be propagated as-is within a reflective invocation.
340+
* exception or one of its superclasses, which means that an exception
341+
* of that type can be propagated as-is within a reflective invocation.
343342
* @param method the declaring method
344343
* @param exceptionType the exception to throw
345344
* @return {@code true} if the exception can be thrown as-is;

spring-websocket/src/main/java/org/springframework/web/socket/handler/ConcurrentWebSocketSessionDecorator.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2014 the original author or authors.
2+
* Copyright 2002-2015 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.
@@ -30,7 +30,6 @@
3030
import org.springframework.web.socket.WebSocketMessage;
3131
import org.springframework.web.socket.WebSocketSession;
3232

33-
3433
/**
3534
* Wraps a {@link org.springframework.web.socket.WebSocketSession} and guarantees
3635
* only one thread can send messages at a time.
@@ -45,7 +44,7 @@
4544
*/
4645
public class ConcurrentWebSocketSessionDecorator extends WebSocketSessionDecorator {
4746

48-
private static final Log logger = LogFactory.getLog("_" + ConcurrentWebSocketSessionDecorator.class.getName());
47+
private static final Log logger = LogFactory.getLog(ConcurrentWebSocketSessionDecorator.class);
4948

5049

5150
private final Queue<WebSocketMessage<?>> buffer = new LinkedBlockingQueue<WebSocketMessage<?>>();

0 commit comments

Comments
 (0)