diff --git a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml
index 0d56bbbea2..8cce56d2e5 100644
--- a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml
+++ b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/pom.xml
@@ -172,6 +172,11 @@
tika-core
1.7
+
+ com.fasterxml.jackson.core
+ jackson-databind
+ 2.4.5
+
@@ -195,6 +200,7 @@
src/test/resources/TestEncryptContent/text.txt.asc
src/test/resources/TestIdentifyMimeType/1.txt
src/test/resources/TestJson/json-sample.json
+ src/test/resources/TestJson/control-characters.json
src/test/resources/TestMergeContent/demarcate
src/test/resources/TestMergeContent/foot
src/test/resources/TestMergeContent/head
@@ -262,5 +268,5 @@
-
+
diff --git a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractJsonPathProcessor.java b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractJsonPathProcessor.java
index d03240e54f..2f1ff43a4f 100644
--- a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractJsonPathProcessor.java
+++ b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/AbstractJsonPathProcessor.java
@@ -19,9 +19,8 @@ package org.apache.nifi.processors.standard;
import com.jayway.jsonpath.Configuration;
import com.jayway.jsonpath.DocumentContext;
import com.jayway.jsonpath.JsonPath;
+import com.jayway.jsonpath.spi.json.JacksonJsonProvider;
import com.jayway.jsonpath.spi.json.JsonProvider;
-import com.jayway.jsonpath.spi.json.JsonSmartJsonProvider;
-import net.minidev.json.parser.JSONParser;
import org.apache.nifi.components.PropertyDescriptor;
import org.apache.nifi.components.ValidationContext;
import org.apache.nifi.components.ValidationResult;
@@ -50,7 +49,7 @@ import java.util.Objects;
*/
public abstract class AbstractJsonPathProcessor extends AbstractProcessor {
- private static final Configuration STRICT_PROVIDER_CONFIGURATION = Configuration.builder().jsonProvider(new JsonSmartJsonProvider(JSONParser.MODE_RFC4627)).build();
+ private static final Configuration STRICT_PROVIDER_CONFIGURATION = Configuration.builder().jsonProvider(new JacksonJsonProvider()).build();
private static final JsonProvider JSON_PROVIDER = STRICT_PROVIDER_CONFIGURATION.jsonProvider();
diff --git a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEvaluateJsonPath.java b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEvaluateJsonPath.java
index 69d47c818f..eff8bfe7e1 100644
--- a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEvaluateJsonPath.java
+++ b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/java/org/apache/nifi/processors/standard/TestEvaluateJsonPath.java
@@ -344,4 +344,23 @@ public class TestEvaluateJsonPath {
assertEquals("Null Value", "null", nullValue);
}
+ @Test
+ public void testHandleAsciiControlCharacters() throws Exception {
+ final TestRunner testRunner = TestRunners.newTestRunner(new EvaluateJsonPath());
+ testRunner.setProperty(EvaluateJsonPath.DESTINATION, EvaluateJsonPath.DESTINATION_ATTRIBUTE);
+ testRunner.setProperty(EvaluateJsonPath.RETURN_TYPE, EvaluateJsonPath.RETURN_TYPE_JSON);
+
+ final String jsonPathControlCharKey = "evaluatejson.controlcharacterpath";
+
+ testRunner.setProperty(jsonPathControlCharKey, "$.jinxing_json.object.property");
+
+ testRunner.enqueue(Paths.get("src/test/resources/TestJson/control-characters.json"));
+ testRunner.run();
+
+ final Relationship expectedRel = EvaluateJsonPath.REL_MATCH;
+
+ testRunner.assertAllFlowFilesTransferred(expectedRel, 1);
+ final MockFlowFile out = testRunner.getFlowFilesForRelationship(expectedRel).get(0);
+ Assert.assertNotNull("Transferred flow file did not have the correct result for id attribute", out.getAttribute(jsonPathControlCharKey));
+ }
}
diff --git a/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJson/control-characters.json b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJson/control-characters.json
new file mode 100644
index 0000000000..73bf1db6d8
--- /dev/null
+++ b/nifi/nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/test/resources/TestJson/control-characters.json
@@ -0,0 +1,7 @@
+{
+ "jinxing_json": {
+ "object": {
+ "property": "Arbitrary characters to the right more normal characters"
+ }
+ }
+}