Skip to content

List-to-String conversion exception does not refer to element type [SPR-14971] #19537

Closed
@spring-projects-issues

Description

@spring-projects-issues

Luca Burgazzoli opened SPR-14971 and commented

I'm leveraging ConversionService to convert from different types and I found out an issue related to a conversion from a List of POJO to String.

The issue are:

  • the conversion services says that it can convert from List to String but then while converting elements it fails because FallbackObjectToStringConverter can convert only POJO with some characteristics (a String constructors or with some static methods) but then none of those methods is used as it invokes source.toString().
  • the exceptions says that it can't convert from List to String but it is not true as teh real cause is that it can't convert from POJO to String
Caused by: org.springframework.core.convert.ConverterNotFoundException: No converter found capable of converting from type [java.util.Arrays$ArrayList<?>] to type [java.lang.String]
 at org.springframework.core.convert.support.GenericConversionService.handleConverterNotFound(GenericConversionService.java:324)
 at org.springframework.core.convert.support.GenericConversionService.convert(GenericConversionService.java:206)
 at org.springframework.core.convert.support.CollectionToStringConverter.convert(CollectionToStringConverter.java:68)
 at org.springframework.core.convert.support.ConversionUtils.invokeConverter(ConversionUtils.java:36)
 ... 38 more

 

 

 


Affects: 4.2.8, 4.3.4

Reference URL: spring-attic/spring-framework-issues#142

Referenced from: commits 442d8a6, bcdda91, aef1460

Backported to: 4.2.9

Metadata

Metadata

Assignees

Labels

in: coreIssues in core modules (aop, beans, core, context, expression)status: backportedAn issue that has been backported to maintenance branchestype: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions