SmartCompositeMessageConverter fails with NullPointerException or ClassCastException in several conversion paths
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start in SmartCompositeMessageConverter and compare the two-argument toMessage/fromMessage variants, which already do the instanceof and content-type checks, against the three-argument ones. Each bullet in the issue maps to one guard to copy over: null headers/content type, instanceof before casting, per-converter try/catch, null-safe element handling, and && instead of &. Add a test per case in the converter's existing test class, then run the module's test suite. Note that an open pull request (#1541) already targets this, so check with maintainers before starting.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
SmartCompositeMessageConverter has several paths that fail with an unexpected exception instead of converting or returning null:
toMessage(payload, headers, hint)callsheaders.get(CONTENT_TYPE).toString(), which throwsNullPointerExceptionwhen the headers or the content type are missing (the two-argument variant checks the content type)- the same method casts each converter unconditionally to
AbstractMessageConverterandSmartMessageConverter, so a converter that is neither (for example one provided by the user) causesClassCastException, while the two-argument variant usesinstanceof - the three-argument
fromMessage(..)has notry/catchand no per-converter failure handling, unlike the two-argument variant, so one converter that throws (for example on a malformed content type header) aborts the whole chain - when converting an
Iterable,item.getClass()is called without a null check, so anullelement causesNullPointerException - one condition uses the non short-circuiting
&instead of&&
In addition, the MessageConversionException message contains the complete message (payload and headers), which may end up in logs or in responses if a caller exposes the exception message, and the converter list is copied for every message.
Proposed change: make the three-argument variants behave like the two-argument ones (null checks, instanceof checks, per-converter error handling), use &&, and add tests for each case above.
- Lenguaje dominante
- Java
- Estrellas
- 1.1k
- Forks
- 655
- Merge medio
- 4 h 54 min
- PR fusionados (30 d)
- 10
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de spring-cloud/spring-cloud-function
-
ClassCastException with spring-cloud-function 4.3.6 when a field of type Set is deserializedAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
spring-cloud/spring-cloud-function#1542 ·
Los mantenedores suelen responder en 1 día
-
GcfJarLayout omits GcfJarLauncher$NestedUrlStreamHandlerFactory, causing NoClassDefFoundError under the GCF invokerPosiblemente ocupada @zemiles la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 32/100
spring-cloud/spring-cloud-function#1544 · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
spring-cloud/spring-cloud-function#1538 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Kotlin function wrapper treats empty input as no inputPosiblemente ocupada @seonwooj0810 la tomó hoy. Abierto5.0.x backport bug
Dificultad 3/5 Medio día Aptitud para principiantes 30/100
spring-cloud/spring-cloud-function#1537 ·
Los mantenedores suelen responder en 1 día
-
Default JSON mapper collection limit is hard-coded and replaces all collection deserializationAbierto5.0.x backport bug
Dificultad 4/5 3-5 días Aptitud para principiantes 22/100
spring-cloud/spring-cloud-function#1536 ·
Los mantenedores suelen responder en 1 día
Todos los issues de spring-cloud/spring-cloud-function
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 80/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
aphtech/brailleblaster#209 ·
Los mantenedores suelen responder en 1 día
-
payers.csv writes QOLS_AVG as NaN for every payer that had no membersPosiblemente ocupada @DG47 la tomó hoy. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 86/100
synthetichealth/synthea#1797 ·
Los mantenedores suelen responder en 19 días
-
build enhancement security
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
midhunhk/lib-aeapps#54 ·