catch ConversionFailedException and fallback to default container conversion logic rather than propogate exception
This commit is contained in:
		
							parent
							
								
									9ece4a88a9
								
							
						
					
					
						commit
						2127b16051
					
				| 
						 | 
				
			
			@ -28,6 +28,7 @@ import org.apache.commons.logging.Log;
 | 
			
		|||
import org.apache.commons.logging.LogFactory;
 | 
			
		||||
import org.springframework.core.CollectionFactory;
 | 
			
		||||
import org.springframework.core.MethodParameter;
 | 
			
		||||
import org.springframework.core.convert.ConversionFailedException;
 | 
			
		||||
import org.springframework.core.convert.ConversionService;
 | 
			
		||||
import org.springframework.core.convert.TypeDescriptor;
 | 
			
		||||
import org.springframework.core.type.filter.TypeFilter;
 | 
			
		||||
| 
						 | 
				
			
			@ -135,7 +136,11 @@ class TypeConverterDelegate {
 | 
			
		|||
			TypeDescriptor sourceTypeDesc = TypeDescriptor.forObject(newValue);
 | 
			
		||||
			TypeDescriptor targetTypeDesc = typeDescriptor;
 | 
			
		||||
			if (conversionService.canConvert(sourceTypeDesc, targetTypeDesc)) {
 | 
			
		||||
				try {
 | 
			
		||||
					return (T) conversionService.convert(convertedValue, sourceTypeDesc, targetTypeDesc);
 | 
			
		||||
				} catch (ConversionFailedException e) {
 | 
			
		||||
					// fallback to default conversion logic below
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue