diff --git a/org.springframework.context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java b/org.springframework.context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java index 393323c862b..c48b505337a 100644 --- a/org.springframework.context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java +++ b/org.springframework.context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java @@ -249,7 +249,6 @@ public class ApplicationContextExpressionTests { GenericApplicationContext ac = new GenericApplicationContext(); AnnotationConfigUtils.registerAnnotationConfigProcessors(ac); - GenericBeanDefinition bd = new GenericBeanDefinition(); bd.setBeanClass(TestBean.class); bd.getPropertyValues().add("country", "#{systemProperties.country}"); @@ -264,12 +263,10 @@ public class ApplicationContextExpressionTests { public void checkPropertiesAccess() { throw new AccessControlException("Not Allowed"); } - @Override public void checkPermission(Permission perm) { // allow everything else } - }; System.setSecurityManager(securityManager); ac.refresh(); @@ -284,6 +281,22 @@ public class ApplicationContextExpressionTests { } } + @Test + public void stringConcatenationWithDebugLogging() { + GenericApplicationContext ac = new GenericApplicationContext(); + AnnotationConfigUtils.registerAnnotationConfigProcessors(ac); + + GenericBeanDefinition bd = new GenericBeanDefinition(); + bd.setBeanClass(String.class); + bd.getConstructorArgumentValues().addGenericArgumentValue("test-#{ T(java.lang.System).currentTimeMillis() }"); + ac.registerBeanDefinition("str", bd); + ac.refresh(); + + String str = ac.getBean("str", String.class); + assertTrue(str.startsWith("test-")); + } + + public static class ValueTestBean implements Serializable { @Autowired @Value("XXX#{tb0.name}YYY#{mySpecialAttr}ZZZ") diff --git a/org.springframework.core/src/main/java/org/springframework/core/MethodParameter.java b/org.springframework.core/src/main/java/org/springframework/core/MethodParameter.java index 2ae4361230f..2f8743e251b 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/MethodParameter.java +++ b/org.springframework.core/src/main/java/org/springframework/core/MethodParameter.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2009 the original author or authors. + * Copyright 2002-2010 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. @@ -230,7 +230,12 @@ public class MethodParameter { if (this.parameterAnnotations == null) { Annotation[][] annotationArray = (this.method != null ? this.method.getParameterAnnotations() : this.constructor.getParameterAnnotations()); - this.parameterAnnotations = annotationArray[this.parameterIndex]; + if (this.parameterIndex >= 0 && this.parameterIndex < annotationArray.length) { + this.parameterAnnotations = annotationArray[this.parameterIndex]; + } + else { + this.parameterAnnotations = new Annotation[0]; + } } return this.parameterAnnotations; } diff --git a/org.springframework.core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java b/org.springframework.core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java index 588498217bb..34003b0913d 100644 --- a/org.springframework.core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java +++ b/org.springframework.core/src/main/java/org/springframework/core/convert/support/GenericConversionService.java @@ -28,6 +28,7 @@ import java.util.Set; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; + import org.springframework.core.GenericTypeResolver; import org.springframework.core.convert.ConversionFailedException; import org.springframework.core.convert.ConversionService; @@ -38,7 +39,6 @@ import org.springframework.core.convert.converter.Converter; import org.springframework.core.convert.converter.ConverterFactory; import org.springframework.core.convert.converter.ConverterRegistry; import org.springframework.core.convert.converter.GenericConverter; -import org.springframework.core.style.StylerUtils; import org.springframework.util.Assert; import org.springframework.util.ClassUtils; @@ -122,7 +122,7 @@ public class GenericConversionService implements ConversionService, ConverterReg public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) { assertNotNull(sourceType, targetType); if (logger.isDebugEnabled()) { - logger.debug("Converting value " + StylerUtils.style(source) +" of " + sourceType + " to " + targetType); + logger.debug("Converting value of " + sourceType + " to " + targetType); } if (sourceType == TypeDescriptor.NULL) { Assert.isTrue(source == null, "The source must be null if sourceType == TypeDescriptor.NULL"); @@ -246,8 +246,8 @@ public class GenericConversionService implements ConversionService, ConverterReg } private GenericConverter findConverterForClassPair(TypeDescriptor sourceType, TypeDescriptor targetType) { - if (logger.isDebugEnabled()) { - logger.debug("Looking for Converter to convert from " + sourceType + " to " + targetType); + if (logger.isTraceEnabled()) { + logger.trace("Looking for Converter to convert from " + sourceType + " to " + targetType); } Class sourceObjectType = sourceType.getObjectType(); if (sourceObjectType.isInterface()) {