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


##########
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 ) {
+            try (final InputStream in = session.read(original)) {
+                inputJson = jsonUtil.jsonToObject(in);
+            } catch (final Exception e) {
+                logger.error("JSON parsing failed on FlowFile content for {}", 
original, e);
+                session.transfer(original, REL_FAILURE);
+                return;
+            }
+        } else {
+            jsonSourceAttributeName = 
context.getProperty(JSON_SOURCE_ATTRIBUTE).evaluateAttributeExpressions(original).getValue();
+            final String jsonSourceAttributeValue = 
original.getAttribute(jsonSourceAttributeName);
+            if (StringUtils.isBlank(jsonSourceAttributeValue)) {
+                logger.error("FlowFile attribute value evaluated to null");

Review Comment:
   `StringUtils.isBlank` is not only when a string is null. It can even be when 
the string is empty or only has white space.
   ```suggestion
                   logger.error("FlowFile attribute value was blank);
   ```



-- 
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