Affects: 5.3.8


Issue happens only if log level for org.springframework is set to DEBUG

This is the stack trace for error -

caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'queueMessageHandler' defined in class path resource [org/springframework/cloud/aws/messaging/config/annotation/SqsConfiguration.class]: Invocation of init method failed; nested exception is java.lang.StringIndexOutOfBoundsException: String index out of range: 1
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1786)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:602)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:524)
    at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:335)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:333)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:218)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.resolveBeanReference(ConfigurationClassEnhancer.java:361)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:334)
    at org.springframework.cloud.aws.messaging.config.annotation.SqsConfiguration$$EnhancerBySpringCGLIB$$321a8abf.queueMessageHandler(<generated>)
    at org.springframework.cloud.aws.messaging.config.annotation.SqsConfiguration.simpleMessageListenerContainer(SqsConfiguration.java:78)
    at org.springframework.cloud.aws.messaging.config.annotation.SqsConfiguration$$EnhancerBySpringCGLIB$$321a8abf.CGLIB$simpleMessageListenerContainer$0(<generated>)
    at org.springframework.cloud.aws.messaging.config.annotation.SqsConfiguration$$EnhancerBySpringCGLIB$$321a8abf$$FastClassBySpringCGLIB$$79a177e6.invoke(<generated>)
    at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244)
    at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:331)
    at org.springframework.cloud.aws.messaging.config.annotation.SqsConfiguration$$EnhancerBySpringCGLIB$$321a8abf.simpleMessageListenerContainer(<generated>)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
    ... 29 more
Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: 1
    at java.lang.String.substring(String.java:1963)
    at org.springframework.messaging.handler.invocation.AbstractMethodMessageHandler.lambda$formatMappings$2(AbstractMethodMessageHandler.java:323)

It seems like it breaks for empty string.

This part of code seems to be problematic -

Screen Shot 2021-08-06 at 10 15 08 AM

Comment From: rstoyanchev

Indeed, it breaks for classes in the default package, which I presume is how you run into an empty string? We have similar formatting code in web handler mappings as well that need to be updated too.