YolandaMDavis commented on a change in pull request #3576: NIFI-6417 
Configurable Jolt Transform Charsets
URL: https://github.com/apache/nifi/pull/3576#discussion_r303692862
 
 

 ##########
 File path: 
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/JoltTransformJSON.java
 ##########
 @@ -332,12 +360,15 @@ public void setup(final ProcessContext context) {
         } catch (final Exception ex) {
             getLogger().error("Unable to setup processor", ex);
         }
+
+        inputCharset = 
Charset.forName(context.getProperty(INPUT_CHARSET).getValue());
+        outputCharset = 
Charset.forName(context.getProperty(OUTPUT_CHARSET).getValue());
     }
 
     private JoltTransform createTransform(final ProcessContext context, final 
String specString) throws Exception {
         final Object specJson;
         if (context.getProperty(JOLT_SPEC).isSet() && 
!SORTR.getValue().equals(context.getProperty(JOLT_TRANSFORM).getValue())) {
-            specJson = JsonUtils.jsonToObject(specString, DEFAULT_CHARSET);
+            specJson = JsonUtils.jsonToObject(specString, inputCharset.name());
 
 Review comment:
   @travisneeley the advanced UI uses some shared utilities with the processor 
but not everything, so it would need to be updated as well.  In this case you 
would need to add the input/output charset entry and ensure that the test 
processor applies those values to test spec as well as test input/output.
   
   I'd be happy to guide you through edits required and how to test if needed 
(can provide more guidance in comments on the JIRA).  The important idea is to 
ensure it's functionality remains consistent with processor functionality.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to