Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value\n at [Source: (org.apache.cxf.transport.http.AbstractHTTPDestination$1);


報錯堆棧:

Illegal unquoted character ((CTRL-CHAR, code 10)): has to be escaped using backslash to be included in string value\n at [Source: (org.apache.cxf.transport.http.AbstractHTTPDestination$1); line: 3, column: 34

報錯原因:

字符串中包含換行 '\n'

解決辦法:

1.在'\n'之前加轉義符號'\';

2.ObjectMapper MAPPER = new ObjectMapper();給MAPPER設置一個屬性 MAPPER.configure(com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true);


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM