Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with formatMapping method in AbstractMethodMessageHandler.java #27247

Closed
rhishirajnema opened this issue Aug 6, 2021 · 1 comment
Closed
Assignees
Labels
in: messaging Issues in messaging modules (jms, messaging) in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Milestone

Comments

@rhishirajnema
Copy link

rhishirajnema commented Aug 6, 2021

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

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 6, 2021
@rstoyanchev rstoyanchev self-assigned this Aug 10, 2021
@rstoyanchev rstoyanchev added in: messaging Issues in messaging modules (jms, messaging) in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Aug 10, 2021
@rstoyanchev rstoyanchev added this to the 5.3.10 milestone Aug 10, 2021
@rstoyanchev
Copy link
Contributor

rstoyanchev commented Aug 10, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: messaging Issues in messaging modules (jms, messaging) in: web Issues in web modules (web, webmvc, webflux, websocket) type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants