apache / apache/servicecomb-java-chassis

Jackson在处理字符串时存在长度限制,是否可以添加配置项,供业务控制其所能解析的字符传长度?

Aperta
#4,239 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
enhancement
Lingua principale
Java
Stelle
1.9k
Fork
814
Merge medio
8g 23h
PR unite (30g)
1

Descrizione

当前遇到一个问题,是服务端返回的响应消息中,字符串长度过长,导致jackson解析失败
```
Caused by: com.fasterxml.jackson.core.exc.StreamConstraintsException: String length (20051112) exceeds the maximum length (20000000)
at com.fasterxml...core.StreamReadConstraints.validateStringLength:324
at com.fasterxml...util.ReadConstrainedTextBuffer.validateStringLength:27
at com.fasterxml...util.TextBuffer.finishCurrentSegment:939
at com.fasterxml...json.UTF8StreamJsonParser._finishString2:2584
at com.fasterxml...json.UTF8StreamJsonParser._finishAndReturnString:2560
at com.fasterxml...json.UTF8StreamJsonParser.getText:335
at com.fasterxml...jsonorg.JSONObjectDeserializer.deserialize:51
at com.fasterxml...jsonorg.JSONObjectDeserializer.deserialize:48
at com.fasterxml...jsonorg.JSONObjectDeserializer.deserialize:14
at com.fasterxml...deser.DefaultDeserializationContext.readRootValue:323
at com.fasterxml...databind.ObjectMapper._readMapAndClose:4825mas
at com.fasterxml...databind.ObjectMapper.readValue:3825
at org.apache...produce.ProduceJsonProcessor.doDecodeResponse:64
at org.apache...produce.ProduceProcessor.decodeResponse:76
at org.apache...http.DefaultHttpClientFilter.extractResponse:105
at org.apache...http.DefaultHttpClientFilter.afterReceiveResponse:139
at org.apache...http.RestClientInvocation.lambda$processResponseBody$7:251
```
20000000是jackson提供的默认值;从chassis源码中来看,并没有提供配置该长度的配置项,是否可以加一个

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Trace response decoding from ProduceJsonProcessor.doDecodeResponse through ProduceProcessor.decodeResponse and DefaultHttpClientFilter.extractResponse, focusing on Jackson's StreamReadConstraints string-length validation. Determine where a service-level maximum string length could be configured, then verify that a configured limit is honored when decoding an oversized response.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
api, backend
Tipo di issue
Funzionalità
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.