dan-s1 commented on code in PR #9785:
URL: https://github.com/apache/nifi/pull/9785#discussion_r1993462226


##########
nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformJSON.java:
##########
@@ -122,14 +146,34 @@ public void onTrigger(final ProcessContext context, 
ProcessSession session) thro
 
         final ComponentLog logger = getLogger();
         final StopWatch stopWatch = new StopWatch(true);
-
         final Object inputJson;
-        try (final InputStream in = session.read(original)) {
-            inputJson = jsonUtil.jsonToObject(in);
-        } catch (final Exception e) {
-            logger.error("JSON parsing failed for {}", original, e);
-            session.transfer(original, REL_FAILURE);
-            return;
+        final boolean isSourceFlowFileContent  = SourceStrategy.FLOW_FILE == 
context.getProperty(JSON_SOURCE).asAllowableValue(SourceStrategy.class);
+        String jsonSourceAttributeName = null;
+
+        if (isSourceFlowFileContent ) {

Review Comment:
   ```suggestion
           if (isSourceFlowFileContent) {
   ```



##########
nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/test/java/org/apache/nifi/processors/jolt/TestJoltTransformJSON.java:
##########
@@ -464,6 +464,71 @@ void testJoltSpecInvalidEL() throws IOException {
         runner.assertNotValid();
     }
 
+    @Test
+    void testJsonAttributeNotInitialised() throws IOException {
+        runner.setProperty(JoltTransformJSON.JSON_SOURCE, 
SourceStrategy.ATTRIBUTE);
+        runner.setProperty(JoltTransformJSON.JOLT_SPEC, 
"./src/test/resources/specs/shiftrSpec.json");

Review Comment:
   I see this value  `"./src/test/resources/specs/shiftrSpec.json"` being used 
a total of three times by you on this line, line 481, and line 494. Another 
test uses the same value on line 225. In addition there is another form of this 
same file used `"src/test/resources/specs/shiftrSpec.json"` without the leading 
`./` on lines 214 and 255. Please make a `private static final String` variable 
with one of these values and use it in all six places.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to