Skip to content

Commit 56eb135

Browse files
committed
Fix AbstractJackson2HttpMessageConverter nullness
This commit makes AbstractJackson2HttpMessageConverter#getObjectMappersForType return value non nullable as an empty map is returned in case of no registrations. Closes gh-34811
1 parent 5c5cf73 commit 56eb135

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

spring-web/src/main/java/org/springframework/http/converter/json/AbstractJackson2HttpMessageConverter.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2024 the original author or authors.
2+
* Copyright 2002-2025 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -184,7 +184,6 @@ public void registerObjectMappersForType(Class<?> clazz, Consumer<Map<MediaType,
184184
* or empty if in case of no registrations for the given class.
185185
* @since 5.3.4
186186
*/
187-
@Nullable
188187
public Map<MediaType, ObjectMapper> getObjectMappersForType(Class<?> clazz) {
189188
for (Map.Entry<Class<?>, Map<MediaType, ObjectMapper>> entry : getObjectMapperRegistrations().entrySet()) {
190189
if (entry.getKey().isAssignableFrom(clazz)) {

0 commit comments

Comments
 (0)