diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java b/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java index 65326f6e26..2bb00f6526 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/CglibAopProxy.java @@ -292,20 +292,20 @@ class CglibAopProxy implements AopProxy, Serializable { // unadvised but can return this). May be required to expose the proxy. Callback targetInterceptor; if (exposeProxy) { - targetInterceptor = isStatic ? + targetInterceptor = (isStatic ? new StaticUnadvisedExposedInterceptor(this.advised.getTargetSource().getTarget()) : - new DynamicUnadvisedExposedInterceptor(this.advised.getTargetSource()); + new DynamicUnadvisedExposedInterceptor(this.advised.getTargetSource())); } else { - targetInterceptor = isStatic ? + targetInterceptor = (isStatic ? new StaticUnadvisedInterceptor(this.advised.getTargetSource().getTarget()) : - new DynamicUnadvisedInterceptor(this.advised.getTargetSource()); + new DynamicUnadvisedInterceptor(this.advised.getTargetSource())); } // Choose a "direct to target" dispatcher (used for // unadvised calls to static targets that cannot return this). - Callback targetDispatcher = isStatic ? - new StaticDispatcher(this.advised.getTargetSource().getTarget()) : new SerializableNoOp(); + Callback targetDispatcher = (isStatic ? + new StaticDispatcher(this.advised.getTargetSource().getTarget()) : new SerializableNoOp()); Callback[] mainCallbacks = new Callback[] { aopInterceptor, // for normal advice @@ -810,12 +810,16 @@ class CglibAopProxy implements AopProxy, Serializable { } // We must always proxy equals, to direct calls to this. if (AopUtils.isEqualsMethod(method)) { - logger.debug("Found 'equals' method: " + method); + if (logger.isDebugEnabled()) { + logger.debug("Found 'equals' method: " + method); + } return INVOKE_EQUALS; } // We must always calculate hashCode based on the proxy. if (AopUtils.isHashCodeMethod(method)) { - logger.debug("Found 'hashCode' method: " + method); + if (logger.isDebugEnabled()) { + logger.debug("Found 'hashCode' method: " + method); + } return INVOKE_HASHCODE; } Class targetClass = this.advised.getTargetClass(); diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultNamespaceHandlerResolver.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultNamespaceHandlerResolver.java index fd7d64cc8c..e839303f51 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultNamespaceHandlerResolver.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/DefaultNamespaceHandlerResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -147,16 +147,21 @@ public class DefaultNamespaceHandlerResolver implements NamespaceHandlerResolver * Load the specified NamespaceHandler mappings lazily. */ private Map getHandlerMappings() { - if (this.handlerMappings == null) { + Map handlerMappings = this.handlerMappings; + if (handlerMappings == null) { synchronized (this) { - if (this.handlerMappings == null) { + handlerMappings = this.handlerMappings; + if (handlerMappings == null) { + if (logger.isDebugEnabled()) { + logger.debug("Loading NamespaceHandler mappings from [" + this.handlerMappingsLocation + "]"); + } try { Properties mappings = PropertiesLoaderUtils.loadAllProperties(this.handlerMappingsLocation, this.classLoader); if (logger.isDebugEnabled()) { logger.debug("Loaded NamespaceHandler mappings: " + mappings); } - Map handlerMappings = new ConcurrentHashMap(mappings.size()); + handlerMappings = new ConcurrentHashMap(mappings.size()); CollectionUtils.mergePropertiesIntoMap(mappings, handlerMappings); this.handlerMappings = handlerMappings; } @@ -167,7 +172,7 @@ public class DefaultNamespaceHandlerResolver implements NamespaceHandlerResolver } } } - return this.handlerMappings; + return handlerMappings; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/PluggableSchemaResolver.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/PluggableSchemaResolver.java index 6cfefe7559..4798f0a7a7 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/PluggableSchemaResolver.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/PluggableSchemaResolver.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -122,7 +122,7 @@ public class PluggableSchemaResolver implements EntityResolver { } catch (FileNotFoundException ex) { if (logger.isDebugEnabled()) { - logger.debug("Couldn't find XML schema [" + systemId + "]: " + resource, ex); + logger.debug("Could not find XML schema [" + systemId + "]: " + resource, ex); } } } @@ -134,9 +134,11 @@ public class PluggableSchemaResolver implements EntityResolver { * Load the specified schema mappings lazily. */ private Map getSchemaMappings() { - if (this.schemaMappings == null) { + Map schemaMappings = this.schemaMappings; + if (schemaMappings == null) { synchronized (this) { - if (this.schemaMappings == null) { + schemaMappings = this.schemaMappings; + if (schemaMappings == null) { if (logger.isDebugEnabled()) { logger.debug("Loading schema mappings from [" + this.schemaMappingsLocation + "]"); } @@ -146,7 +148,7 @@ public class PluggableSchemaResolver implements EntityResolver { if (logger.isDebugEnabled()) { logger.debug("Loaded schema mappings: " + mappings); } - Map schemaMappings = new ConcurrentHashMap(mappings.size()); + schemaMappings = new ConcurrentHashMap(mappings.size()); CollectionUtils.mergePropertiesIntoMap(mappings, schemaMappings); this.schemaMappings = schemaMappings; } @@ -157,7 +159,7 @@ public class PluggableSchemaResolver implements EntityResolver { } } } - return this.schemaMappings; + return schemaMappings; } diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java b/spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java index 0f7091ade4..e2eaa57c4a 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/xml/XmlBeanDefinitionReader.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2013 the original author or authors. + * Copyright 2002-2018 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -314,7 +314,7 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader { public int loadBeanDefinitions(EncodedResource encodedResource) throws BeanDefinitionStoreException { Assert.notNull(encodedResource, "EncodedResource must not be null"); if (logger.isInfoEnabled()) { - logger.info("Loading XML bean definitions from " + encodedResource.getResource()); + logger.info("Loading XML bean definitions from " + encodedResource); } Set currentResources = this.resourcesCurrentlyBeingLoaded.get(); @@ -430,13 +430,13 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader { getValidationModeForResource(resource), isNamespaceAware()); } - /** - * Gets the validation mode for the specified {@link Resource}. If no explicit - * validation mode has been configured then the validation mode is - * {@link #detectValidationMode detected}. + * Determine the validation mode for the specified {@link Resource}. + * If no explicit validation mode has been configured, then the validation + * mode gets {@link #detectValidationMode detected} from the given resource. *

Override this method if you would like full control over the validation * mode, even when something other than {@link #VALIDATION_AUTO} was set. + * @see #detectValidationMode */ protected int getValidationModeForResource(Resource resource) { int validationModeToUse = getValidationMode(); @@ -454,7 +454,7 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader { } /** - * Detects which kind of validation to perform on the XML file identified + * Detect which kind of validation to perform on the XML file identified * by the supplied {@link Resource}. If the file has a {@code DOCTYPE} * definition then DTD validation is used otherwise XSD validation is assumed. *

Override this method if you would like to customize resolution @@ -540,7 +540,8 @@ public class XmlBeanDefinitionReader extends AbstractBeanDefinitionReader { /** * Create the default implementation of {@link NamespaceHandlerResolver} used if none is specified. - * Default implementation returns an instance of {@link DefaultNamespaceHandlerResolver}. + *

The default implementation returns an instance of {@link DefaultNamespaceHandlerResolver}. + * @see DefaultNamespaceHandlerResolver#DefaultNamespaceHandlerResolver(ClassLoader) */ protected NamespaceHandlerResolver createDefaultNamespaceHandlerResolver() { return new DefaultNamespaceHandlerResolver(getResourceLoader().getClassLoader());