Skip to content

Commit 0ac7660

Browse files
artembilangaryrussell
authored andcommitted
Fix a couple new Sonar smells
1 parent 7da77f7 commit 0ac7660

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

spring-integration-core/src/main/java/org/springframework/integration/aop/PublisherAnnotationBeanPostProcessor.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
package org.springframework.integration.aop;
1818

1919
import org.springframework.aop.framework.autoproxy.AbstractBeanFactoryAwareAdvisingPostProcessor;
20-
import org.springframework.beans.factory.BeanCreationNotAllowedException;
20+
import org.springframework.beans.factory.BeanCreationException;
2121
import org.springframework.beans.factory.BeanFactory;
2222
import org.springframework.beans.factory.BeanNameAware;
2323
import org.springframework.beans.factory.InitializingBean;
@@ -44,7 +44,7 @@ public class PublisherAnnotationBeanPostProcessor extends AbstractBeanFactoryAwa
4444

4545
private String defaultChannelName;
4646

47-
private String name;
47+
private String beanName;
4848

4949
private BeanFactory beanFactory;
5050

@@ -60,7 +60,7 @@ public void setDefaultChannelName(String defaultChannelName) {
6060

6161
@Override
6262
public void setBeanName(String name) {
63-
this.name = name;
63+
this.beanName = name;
6464
}
6565

6666
@Override
@@ -74,16 +74,15 @@ public void setBeanFactory(BeanFactory beanFactory) {
7474
}
7575

7676
@Override
77-
public void afterPropertiesSet() throws Exception {
77+
public void afterPropertiesSet() {
7878
try {
7979
this.beanFactory.getBean(PublisherAnnotationBeanPostProcessor.class);
8080
}
8181
catch (NoUniqueBeanDefinitionException ex) {
82-
throw new BeanCreationNotAllowedException(this.name,
82+
throw new BeanCreationException(this.beanName,
8383
"Only one 'PublisherAnnotationBeanPostProcessor' bean can be defined in the application context." +
8484
" Do not use '@EnablePublisher' (or '<int:enable-publisher>') if you declare a" +
85-
" 'PublisherAnnotationBeanPostProcessor' bean definition manually. " +
86-
"Bean names found: " + ex.getBeanNamesFound());
85+
" 'PublisherAnnotationBeanPostProcessor' bean definition manually.", ex);
8786
}
8887
}
8988

0 commit comments

Comments
 (0)