You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "exceptionfactory (via GitHub)" <gi...@apache.org> on 2023/06/09 01:42:59 UTC

[GitHub] [nifi] exceptionfactory commented on a diff in pull request #4044: NIFI-4957: Add ability to get JOLT transform from file

exceptionfactory commented on code in PR #4044:
URL: https://github.com/apache/nifi/pull/4044#discussion_r1223736844


##########
nifi-nar-bundles/nifi-jolt-record-bundle/nifi-jolt-record-processors/src/main/java/org/apache/nifi/processors/jolt/record/JoltTransformRecord.java:
##########
@@ -445,12 +457,14 @@ private List<Record> transform(final Record record, final JoltTransform transfor
         return recordList;
     }
 
-    private JoltTransform getTransform(final ProcessContext context, final FlowFile flowFile) {
+    private JoltTransform getTransform(final ProcessContext context, final FlowFile flowFile) throws Exception {

Review Comment:
   Is this `throws Exception` declaration needed?



##########
nifi-nar-bundles/nifi-jolt-record-bundle/nifi-jolt-record-processors/src/main/java/org/apache/nifi/processors/jolt/record/JoltTransformRecord.java:
##########
@@ -238,48 +247,51 @@ protected Collection<ValidationResult> customValidate(ValidationContext validati
         final List<ValidationResult> results = new ArrayList<>(super.customValidate(validationContext));
         final String transform = validationContext.getProperty(JOLT_TRANSFORM).getValue();
         final String customTransform = validationContext.getProperty(CUSTOM_CLASS).getValue();
-        if (!validationContext.getProperty(JOLT_SPEC).isSet() || StringUtils.isEmpty(validationContext.getProperty(JOLT_SPEC).getValue())) {
-            if (!SORTR.getValue().equals(transform)) {
-                final String message = "A specification is required for this transformation";
-                results.add(new ValidationResult.Builder().valid(false)
-                        .explanation(message)
-                        .build());
-            }
+        final String modulePath = validationContext.getProperty(MODULES).isSet()? validationContext.getProperty(MODULES).getValue() : null;
+        final String joltSpecValue = validationContext.getProperty(JOLT_SPEC).getValue();
+
+        if (StringUtils.isEmpty(joltSpecValue) && !SORTR.getValue().equals(transform)) {
+                results.add(new ValidationResult.Builder().subject("Spec Body or Spec File").valid(false).explanation(
+                        "exactly one of 'Jolt Specification' or 'Path To Jolt Specification' must be set, or the Transformation must be 'Sort'").build());

Review Comment:
   It looks like this message needs to be adjusted to remove `Path To Jolt Specification`.



-- 
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: issues-unsubscribe@nifi.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org