[java-identity-provider COMMIT] /trunk/idp-core/src/main/java/net/shibboleth/idp/spring/IdentifiableBeanPostProcessor...

noreply at shibboleth.net noreply at shibboleth.net
Tue Feb 25 14:55:24 EST 2014


Author: tzeller
Date: Tue Feb 25 14:55:24 2014
New Revision: 5476

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=5476&view=rev
Log:
JSPT-40 : Cleanup. Log redundant setting of id property as well as mismatch between id attribute and property to debug.

Modified:
    trunk/idp-core/src/main/java/net/shibboleth/idp/spring/IdentifiableBeanPostProcessor.java

Modified: trunk/idp-core/src/main/java/net/shibboleth/idp/spring/IdentifiableBeanPostProcessor.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-core/src/main/java/net/shibboleth/idp/spring/IdentifiableBeanPostProcessor.java?rev=5476&r1=5475&r2=5476&view=diff
==============================================================================
--- trunk/idp-core/src/main/java/net/shibboleth/idp/spring/IdentifiableBeanPostProcessor.java (original)
+++ trunk/idp-core/src/main/java/net/shibboleth/idp/spring/IdentifiableBeanPostProcessor.java Tue Feb 25 14:55:24 2014
@@ -17,6 +17,8 @@
 
 package net.shibboleth.idp.spring;
 
+import javax.annotation.Nonnull;
+
 import net.shibboleth.utilities.java.support.component.IdentifiableComponent;
 
 import org.slf4j.Logger;
@@ -24,13 +26,12 @@
 import org.springframework.beans.factory.config.BeanPostProcessor;
 
 /**
- * Pre-processes {@link IdentifiableComponent} beans by setting their ID to their bean name.
- * <p>
+ * Pre-processes {@link IdentifiableComponent} beans by setting the bean ID to the bean name.
  */
 public class IdentifiableBeanPostProcessor implements BeanPostProcessor {
 
     /** Logger. */
-    private Logger log = LoggerFactory.getLogger(IdentifiableBeanPostProcessor.class);
+    @Nonnull private final Logger log = LoggerFactory.getLogger(IdentifiableBeanPostProcessor.class);
 
     /** {@inheritDoc} */
     @Override public Object postProcessBeforeInitialization(Object bean, String beanName) {
@@ -38,9 +39,12 @@
             final IdentifiableComponent component = (IdentifiableComponent) bean;
             if (component.getId() == null) {
                 component.setId(beanName);
-            } else if (component.getId().equals(beanName)) {
-                log.error("Bean Named {} has the component identifier set to be the bean name.  This is redundant",
-                        beanName);
+            } else if (log.isDebugEnabled()) {
+                if (component.getId().equals(beanName)) {
+                    log.debug("The 'id' property is redundant for bean with 'id' attribute '{}'", beanName);
+                } else {
+                    log.debug("The 'id' property is not the same as the 'id' attribute for bean '{}'", beanName);
+                }
             }
         }
         return bean;



More information about the commits mailing list