SmartCompositeMessageConverter fails with NullPointerException or ClassCastException in several conversion paths
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 35/100
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Java
- Sterne
- 1.1k
- Forks
- 655
- Ø Merge
- 4 Std. 54 Min.
- Gemergte PRs (30 T.)
- 10
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus spring-cloud/spring-cloud-function
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
spring-cloud/spring-cloud-function#1542 ·
Maintainer antworten meist innerhalb von 1 Tag
-
GcfJarLayout omits GcfJarLauncher$NestedUrlStreamHandlerFactory, causing NoClassDefFoundError under the GCF invokerEvtl. vergeben @zemiles hat das heute übernommen. Offen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 32/100
spring-cloud/spring-cloud-function#1544 · 1 Reaktion ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 55/100
spring-cloud/spring-cloud-function#1538 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
Kotlin function wrapper treats empty input as no inputEvtl. vergeben @seonwooj0810 hat das heute übernommen. Offen5.0.x backport bug
Schwierigkeit 3/5 Ein halber Tag Anfängerfreundlichkeit 30/100
spring-cloud/spring-cloud-function#1537 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Default JSON mapper collection limit is hard-coded and replaces all collection deserializationOffen5.0.x backport bug
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 22/100
spring-cloud/spring-cloud-function#1536 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in spring-cloud/spring-cloud-function
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
bug devops low
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
-
enhancement
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 88/100
MDMesh-app/MDMesh#252 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 80/100
Maintainer antworten meist innerhalb von 1 Tag