NIFI-12395 Upgraded Jackson JSON from 2.15.3 to 2.16.1

Signed-off-by: Pierre Villard <pierre.villard.fr@gmail.com>

This closes #8201.
This commit is contained in:
exceptionfactory 2024-01-02 18:17:23 -06:00 committed by Pierre Villard
parent 99c843f25a
commit 4dc0d44dc4
No known key found for this signature in database
GPG Key ID: F92A93B30C07C6D5
5 changed files with 9 additions and 66 deletions

View File

@ -135,12 +135,7 @@ public abstract class AbstractByQueryElasticsearchTest {
runner.setProperty(ElasticsearchRestProcessor.QUERY, "not-json");
final AssertionError assertionError = assertThrows(AssertionError.class, runner::run);
final String expected = String.format("Processor has 1 validation failures:\n" +
"'%s' validated against 'not-json' is invalid because %s is not a valid JSON representation due to Unrecognized token 'not': was expecting" +
" (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n" +
" at [Source: (String)\"not-json\"; line: 1, column: 4]\n",
ElasticsearchRestProcessor.QUERY.getName(), ElasticsearchRestProcessor.QUERY.getName());
assertEquals(expected, assertionError.getMessage());
assertTrue(assertionError.getMessage().contains("not-json"));
}
@Test
@ -151,24 +146,7 @@ public abstract class AbstractByQueryElasticsearchTest {
runner.setProperty(ElasticsearchRestProcessor.SCRIPT, "not-json-script");
final AssertionError assertionError = assertThrows(AssertionError.class, runner::run);
String expected;
if (getTestProcessor() instanceof DeleteByQueryElasticsearch) {
// no SCRIPT in Query Builder
expected = "Processor has 1 validation failures:\n";
} else {
expected = "Processor has 2 validation failures:\n";
}
expected += String.format("'%s' validated against 'not-json' is invalid because %s is not a valid JSON representation due to Unrecognized token 'not': was expecting" +
" (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n" +
" at [Source: (String)\"not-json\"; line: 1, column: 4]\n",
ElasticsearchRestProcessor.QUERY_CLAUSE.getName(), ElasticsearchRestProcessor.QUERY_CLAUSE.getName());
if (getTestProcessor() instanceof UpdateByQueryElasticsearch) {
expected += String.format("'%s' validated against 'not-json-script' is invalid because %s is not a valid JSON representation due to Unrecognized token 'not': was expecting " +
"(JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n" +
" at [Source: (String)\"not-json-script\"; line: 1, column: 4]\n",
ElasticsearchRestProcessor.SCRIPT.getName(), ElasticsearchRestProcessor.SCRIPT.getName());
}
assertEquals(expected, assertionError.getMessage());
assertTrue(assertionError.getMessage().contains("not-json"));
}
@Test

View File

@ -169,12 +169,7 @@ public abstract class AbstractJsonQueryElasticsearchTest<P extends AbstractJsonQ
runner.assertValid();
} else {
final AssertionError assertionError = assertThrows(AssertionError.class, runner::run);
final String expected = String.format("Processor has 1 validation failures:\n" +
"'%s' validated against 'not-json' is invalid because %s is not a valid JSON representation due to Unrecognized token 'not': was expecting" +
" (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n" +
" at [Source: (String)\"not-json\"; line: 1, column: 4]\n",
queryPropertyDescriptor.getName(), queryPropertyDescriptor.getName());
assertEquals(expected, assertionError.getMessage());
assertTrue(assertionError.getMessage().contains("not-json"));
}
}
@ -190,36 +185,7 @@ public abstract class AbstractJsonQueryElasticsearchTest<P extends AbstractJsonQ
runner.setProperty(ElasticsearchRestProcessor.SCRIPT_FIELDS, "not-json-script_fields");
final AssertionError assertionError = assertThrows(AssertionError.class, runner::run);
String expected;
if (runner.getProcessor() instanceof ConsumeElasticsearch) {
// ConsumeElasticsearch doesn't use QUERY_CLAUSE
expected = "Processor has 5 validation failures:\n";
} else {
expected = String.format("Processor has 6 validation failures:\n" +
"'%s' validated against 'not-json' is invalid because %s is not a valid JSON representation due to Unrecognized token 'not': was expecting" +
" (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n" +
" at [Source: (String)\"not-json\"; line: 1, column: 4]\n",
ElasticsearchRestProcessor.QUERY_CLAUSE.getName(), ElasticsearchRestProcessor.QUERY_CLAUSE.getName());
}
expected += String.format("'%s' validated against '-1' is invalid because not a positive value\n" +
"'%s' validated against 'not-json-sort' is invalid because %s is not a valid JSON representation due to Unrecognized token 'not': was expecting" +
" (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n" +
" at [Source: (String)\"not-json-sort\"; line: 1, column: 4]\n" +
"'%s' validated against 'not-json-aggs' is invalid because %s is not a valid JSON representation due to Unrecognized token 'not': was expecting" +
" (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n" +
" at [Source: (String)\"not-json-aggs\"; line: 1, column: 4]\n" +
"'%s' validated against 'not-json-fields' is invalid because %s is not a valid JSON representation due to Unrecognized token 'not': was expecting" +
" (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n" +
" at [Source: (String)\"not-json-fields\"; line: 1, column: 4]\n" +
"'%s' validated against 'not-json-script_fields' is invalid because %s is not a valid JSON representation due to Unrecognized token 'not': was expecting" +
" (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n" +
" at [Source: (String)\"not-json-script_fields\"; line: 1, column: 4]\n",
ElasticsearchRestProcessor.SIZE.getName(),
ElasticsearchRestProcessor.SORT.getName(), ElasticsearchRestProcessor.SORT.getName(),
ElasticsearchRestProcessor.AGGREGATIONS.getName(), ElasticsearchRestProcessor.AGGREGATIONS.getName(),
ElasticsearchRestProcessor.FIELDS.getName(), ElasticsearchRestProcessor.FIELDS.getName(),
ElasticsearchRestProcessor.SCRIPT_FIELDS.getName(), ElasticsearchRestProcessor.SCRIPT_FIELDS.getName());
assertEquals(expected, assertionError.getMessage());
assertTrue(assertionError.getMessage().contains("not-json"));
}
@Test

View File

@ -441,8 +441,7 @@ public class PutElasticsearchJsonTest extends AbstractPutElasticsearchTest<PutEl
runner.assertTransferCount(PutElasticsearchJson.REL_FAILED_DOCUMENTS, 0);
runner.assertTransferCount(PutElasticsearchRecord.REL_ERROR_RESPONSES, 0);
runner.getFlowFilesForRelationship(PutElasticsearchJson.REL_FAILURE).get(0).assertAttributeEquals("elasticsearch.put.error",
"Unrecognized token 'not': was expecting (JSON String, Number, Array, Object or token 'null', 'true' or 'false')\n" +
" at [Source: (String)\"not-json\"; line: 1, column: 4]");
final MockFlowFile flowFile = runner.getFlowFilesForRelationship(PutElasticsearchJson.REL_FAILURE).get(0);
assertTrue(flowFile.getAttribute("elasticsearch.put.error").contains("not"));
}
}

View File

@ -305,8 +305,8 @@ class TestJsonTreeRowRecordReader {
void testReadJSONStringTooLong() {
final StreamConstraintsException mre = assertThrows(StreamConstraintsException.class, () ->
testReadAccountJson("src/test/resources/json/bank-account-multiline.json", false, StreamReadConstraints.builder().maxStringLength(2).build()));
assertTrue(mre.getMessage().contains("maximum length"));
assertTrue(mre.getMessage().contains("(2)"));
assertTrue(mre.getMessage().contains("maximum"));
assertTrue(mre.getMessage().contains("2"));
}
@Test

View File

@ -130,7 +130,7 @@
<derby.version>10.17.1.0</derby.version>
<ranger.version>2.4.0</ranger.version>
<jetty.version>10.0.18</jetty.version>
<jackson.bom.version>2.15.3</jackson.bom.version>
<jackson.bom.version>2.16.1</jackson.bom.version>
<avro.version>1.11.3</avro.version>
<jaxb.runtime.version>2.3.9</jaxb.runtime.version>
<javax.annotation-api.version>1.3.2</javax.annotation-api.version>