|
24 | 24 |
|
25 | 25 | import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
26 | 26 | import org.apache.commons.lang3.StringUtils;
|
| 27 | +import org.slf4j.Logger; |
| 28 | +import org.slf4j.LoggerFactory; |
27 | 29 |
|
28 | 30 | import org.springframework.core.MethodParameter;
|
29 | 31 | import org.springframework.core.convert.TypeDescriptor;
|
@@ -69,6 +71,8 @@ public class ParameterInfo {
|
69 | 71 | */
|
70 | 72 | private String paramType;
|
71 | 73 |
|
| 74 | + private static final Logger LOGGER = LoggerFactory.getLogger(ParameterInfo.class); |
| 75 | + |
72 | 76 |
|
73 | 77 | /**
|
74 | 78 | * Instantiates a new Parameter info.
|
@@ -99,10 +103,18 @@ else if (cookieValue != null)
|
99 | 103 |
|
100 | 104 | if (StringUtils.isNotBlank(this.pName))
|
101 | 105 | this.pName = propertyResolverUtils.resolve(this.pName);
|
102 |
| - if (this.defaultValue !=null && !ValueConstants.DEFAULT_NONE.equals(this.defaultValue.toString())){ |
| 106 | + if (this.defaultValue != null && !ValueConstants.DEFAULT_NONE.equals(this.defaultValue.toString())) { |
103 | 107 | this.defaultValue = propertyResolverUtils.resolve(this.defaultValue.toString());
|
104 | 108 | parameterBuilder.getOptionalWebConversionServiceProvider()
|
105 |
| - .ifPresent(conversionService ->this.defaultValue= conversionService.convert(this.defaultValue, new TypeDescriptor(methodParameter))); |
| 109 | + .ifPresent(conversionService -> { |
| 110 | + try { |
| 111 | + this.defaultValue = conversionService.convert(this.defaultValue, new TypeDescriptor(methodParameter)); |
| 112 | + } |
| 113 | + catch (Exception e) { |
| 114 | + LOGGER.warn("Using the following default value : {}, without spring conversionService", this.defaultValue); |
| 115 | + } |
| 116 | + } |
| 117 | + ); |
106 | 118 | }
|
107 | 119 |
|
108 | 120 | this.required = this.required && !methodParameter.isOptional();
|
|
0 commit comments