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


##########
nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TransformXml.java:
##########
@@ -123,6 +132,7 @@ public class TransformXml extends AbstractProcessor {
             .required(false)
             
.expressionLanguageSupported(ExpressionLanguageScope.FLOWFILE_ATTRIBUTES)
             .addValidator(StandardValidators.NON_EMPTY_EL_VALIDATOR)
+            .identifiesExternalResource(ResourceCardinality.SINGLE, 
ResourceType.TEXT)

Review Comment:
   This addition appears to be incorrect.



##########
nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TransformXml.java:
##########
@@ -403,6 +422,14 @@ private Source getSecureSource(final StreamSource 
streamSource) throws Transform
         }
     }
 
+    private String getResourceReferenceText(ResourceReference 
resourceReference) {
+        try (InputStream inputStream = resourceReference.read()) {
+            return new String(inputStream.readAllBytes(), 
StandardCharsets.UTF_8);
+        } catch (IOException ignored) {

Review Comment:
   It looks like this `IOException` can be declared on the method



##########
nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TransformXml.java:
##########
@@ -204,16 +214,16 @@ protected List<PropertyDescriptor> 
getSupportedPropertyDescriptors() {
     protected Collection<ValidationResult> customValidate(ValidationContext 
validationContext) {
         final List<ValidationResult> results = new 
ArrayList<>(super.customValidate(validationContext));
 
-        PropertyValue filename = validationContext.getProperty(XSLT_FILE_NAME);
+        PropertyValue document = validationContext.getProperty(XSLT_DOCUMENT);
         PropertyValue controller = 
validationContext.getProperty(XSLT_CONTROLLER);
         PropertyValue key = validationContext.getProperty(XSLT_CONTROLLER_KEY);
 
-        if ((filename.isSet() && controller.isSet())
-                || (!filename.isSet() && !controller.isSet())) {
+        if ((document.isSet() && controller.isSet())
+                || (!document.isSet() && !controller.isSet())) {
             results.add(new ValidationResult.Builder()
                     .valid(false)
                     .subject(this.getClass().getSimpleName())
-                    .explanation("Exactly one of the \"XSLT file name\" and 
\"XSLT controller\" properties must be defined.")
+                    .explanation("Exactly one of the \"XSLT Content\" and 
\"XSLT Lookup\" properties must be defined.")

Review Comment:
   `XSLT Content` should be changed to `XSLT Document` in several places.



##########
nifi-extension-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/TransformXml.java:
##########
@@ -403,6 +422,14 @@ private Source getSecureSource(final StreamSource 
streamSource) throws Transform
         }
     }
 
+    private String getResourceReferenceText(ResourceReference 
resourceReference) {

Review Comment:
   ```suggestion
       private String getResourceReferenceText(final ResourceReference 
resourceReference) {
   ```



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