Refine Jackson2ObjectMapperBuilder#configureFeature exception handling
This commit changes the FatalBeanException previously thrown for an IllegalArgumentException which seems more suitable for that use case. Closes gh-29859
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
* Copyright 2002-2023 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.
|
||||
@@ -57,7 +57,6 @@ import com.fasterxml.jackson.dataformat.xml.XmlFactory;
|
||||
import com.fasterxml.jackson.dataformat.xml.XmlMapper;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.FatalBeanException;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.KotlinDetector;
|
||||
import org.springframework.http.ProblemDetail;
|
||||
@@ -835,7 +834,7 @@ public class Jackson2ObjectMapperBuilder {
|
||||
objectMapper.configure(mapperFeature, enabled);
|
||||
}
|
||||
else {
|
||||
throw new FatalBeanException("Unknown feature class: " + feature.getClass().getName());
|
||||
throw new IllegalArgumentException("Unknown feature class: " + feature.getClass().getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user