Srilatha-ramreddy commented on code in PR #9785:
URL: https://github.com/apache/nifi/pull/9785#discussion_r2002122756


##########
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();

Review Comment:
   @exceptionfactory I agree with you, EL support was just to support any edge 
case scenarios but there can be workarounds to achieve what is intended. Happy 
to remove the expression language support.



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