[ https://issues.apache.org/jira/browse/KNOX-2995?focusedWorklogId=897690&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-897690 ]
ASF GitHub Bot logged work on KNOX-2995: ---------------------------------------- Author: ASF GitHub Bot Created on: 02/Jan/24 14:51 Start Date: 02/Jan/24 14:51 Worklog Time Spent: 10m Work Description: smolnar82 commented on code in PR #828: URL: https://github.com/apache/knox/pull/828#discussion_r1439519566 ########## gateway-provider-rewrite/src/main/java/org/apache/knox/gateway/filter/rewrite/impl/json/JsonFilterReader.java: ########## @@ -77,6 +77,11 @@ class JsonFilterReader extends Reader { bufferingLevel = null; bufferingConfig = null; this.config = config; + jsonParserConfigInit(); + } + + private void jsonParserConfigInit() { + parser.enable(com.fasterxml.jackson.core.JsonParser.Feature.ALLOW_NON_NUMERIC_NUMBERS); Review Comment: Why don't you add this feature when creating the `factory` in line 69? Moreover, the referenced feature has been deprecated since 2.10 according to Jackson docs (we use 2.11.4 in Knox already): ``` /** * Feature that allows parser to recognize set of * "Not-a-Number" (NaN) tokens as legal floating number * values (similar to how many other data formats and * programming language source code allows it). * Specific subset contains values that * <a href="http://www.w3.org/TR/xmlschema-2/">XML Schema</a> * (see section 3.2.4.1, Lexical Representation) * allows (tokens are quoted contents, not including quotes): *<ul> * <li>"INF" (for positive infinity), as well as alias of "Infinity" * <li>"-INF" (for negative infinity), alias "-Infinity" * <li>"NaN" (for other not-a-numbers, like result of division by zero) *</ul> *<p> * Since JSON specification does not allow use of such values, * this is a non-standard feature, and as such disabled by default. * * @deprecated Since 2.10 use {@link com.fasterxml.jackson.core.json.JsonReadFeature#ALLOW_NON_NUMERIC_NUMBERS} instead */ @Deprecated ALLOW_NON_NUMERIC_NUMBERS(false), ``` Issue Time Tracking ------------------- Worklog Id: (was: 897690) Time Spent: 0.5h (was: 20m) > json contains NaN value parsing failed > -------------------------------------- > > Key: KNOX-2995 > URL: https://issues.apache.org/jira/browse/KNOX-2995 > Project: Apache Knox > Issue Type: Bug > Components: Server > Affects Versions: 2.0.0, 1.6.0 > Reporter: zhaoshuaihua > Priority: Major > Attachments: KNOX-2995.patch, screenshot-1.png, screenshot-2.png, > screenshot-3.png > > Time Spent: 0.5h > Remaining Estimate: 0h > > If the proxy address returns JSON, which contains something similar to xxx: > NaN, then knox will fail to parse. Therefore, support for parsing NaN is > added. > I click on the page with return json and the content of Resopnse is empty. > like this : !screenshot-1.png! > > Checking the gateway.log log shows the following error message. > !screenshot-2.png! > The display results after my repair are as follows: > !screenshot-3.png! > > -- This message was sent by Atlassian Jira (v8.20.10#820010)