Github user jvwing commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2859#discussion_r204968906
  
    --- Diff: 
nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/sqs/PutSQS.java
 ---
    @@ -115,7 +125,19 @@ public void onTrigger(final ProcessContext context, 
final ProcessSession session
             entry.setId(flowFile.getAttribute("uuid"));
             final ByteArrayOutputStream baos = new ByteArrayOutputStream();
             session.exportTo(flowFile, baos);
    -        final String flowFileContent = baos.toString();
    +
    +        final Charset charset = 
Charset.forName(context.getProperty(CHARSET).getValue());
    +
    +        String flowFileContent;
    +
    +        // Get the content of the FlowFile with the given Charset. Fall 
back to the default charset
    +        // if the given charset is not supported.
    +        try {
    +            flowFileContent = baos.toString(charset.name());
    +        } catch (UnsupportedEncodingException e) {
    --- End diff --
    
    `customValidate` is defined in `AbstractConfigurableComponent`, but can be 
overridden in processors to validate properties as the processor is started, 
before `onTrigger` is ever called.  Take a look at 
[PutCloudWatchMetric.customValidate](https://github.com/apache/nifi/blob/2834fa4ce477014dfad8c96b6d326d0f1f06a23e/nifi-nar-bundles/nifi-aws-bundle/nifi-aws-processors/src/main/java/org/apache/nifi/processors/aws/cloudwatch/PutCloudWatchMetric.java#L216)
 for a good example.  
    * It's important to call `super.customValidate()` to get validation for 
inherited property descriptors.
    * I also recommend TestPutCloudWatchMetric for several examples on how to 
unit test the validation cases.


---

Reply via email to