Catch Error for SourceHttpMessageConverter in WebMvcConfigurationSupport
Prior to this commit, the addDefaultHttpMessageConverters() method in WebMvcConfigurationSupport caught Throwable for SourceHttpMessageConverter instantiation; whereas, the rest of the code base correctly catches Error for SourceHttpMessageConverter instantiation (to handle errors such as NoClassDefFoundError). Throwable should not be caught since it can mask other categories of failures (such as configuration errors). This commit therefore switches to catching Error for SourceHttpMessageConverter instantiation in WebMvcConfigurationSupport. Closes gh-29537
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -907,8 +907,8 @@ public class WebMvcConfigurationSupport implements ApplicationContextAware, Serv
|
||||
try {
|
||||
messageConverters.add(new SourceHttpMessageConverter<>());
|
||||
}
|
||||
catch (Throwable ex) {
|
||||
// Ignore when no TransformerFactory implementation is available...
|
||||
catch (Error err) {
|
||||
// Ignore when no TransformerFactory implementation is available
|
||||
}
|
||||
}
|
||||
messageConverters.add(new AllEncompassingFormHttpMessageConverter());
|
||||
|
||||
Reference in New Issue
Block a user