Catch errors when adding SourceHttpMessageConverter
This commit ignores errors like TransformerFactoryConfigurationError that can be thrown when instantiating SourceHttpMessageConverter on platforms where no TransformerFactory implementation is available, like when compiling/running as GraalVM native images. Issue: SPR-17007
This commit is contained in:
@@ -805,7 +805,12 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
messageConverters.add(stringHttpMessageConverter);
|
||||
messageConverters.add(new ResourceHttpMessageConverter());
|
||||
messageConverters.add(new ResourceRegionHttpMessageConverter());
|
||||
messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
try {
|
||||
messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
}
|
||||
catch (Error err) {
|
||||
// Ignore when no TransformerFactory implementation is available
|
||||
}
|
||||
messageConverters.add(new AllEncompassingFormHttpMessageConverter());
|
||||
|
||||
if (romePresent) {
|
||||
|
||||
@@ -111,7 +111,12 @@ public class ExceptionHandlerExceptionResolver extends AbstractHandlerMethodExce
|
||||
this.messageConverters = new ArrayList<>();
|
||||
this.messageConverters.add(new ByteArrayHttpMessageConverter());
|
||||
this.messageConverters.add(stringHttpMessageConverter);
|
||||
this.messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
try {
|
||||
this.messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
}
|
||||
catch (Error err) {
|
||||
// Ignore when no TransformerFactory implementation is available
|
||||
}
|
||||
this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());
|
||||
}
|
||||
|
||||
|
||||
@@ -184,7 +184,12 @@ public class RequestMappingHandlerAdapter extends AbstractHandlerMethodAdapter
|
||||
this.messageConverters = new ArrayList<>(4);
|
||||
this.messageConverters.add(new ByteArrayHttpMessageConverter());
|
||||
this.messageConverters.add(stringHttpMessageConverter);
|
||||
this.messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
try {
|
||||
this.messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
}
|
||||
catch (Error err) {
|
||||
// Ignore when no TransformerFactory implementation is available
|
||||
}
|
||||
this.messageConverters.add(new AllEncompassingFormHttpMessageConverter());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user