Github user mattyb149 commented on a diff in the pull request:
https://github.com/apache/nifi/pull/564#discussion_r70157635
--- Diff:
nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/JoltTransformJSON.java
---
@@ -212,12 +279,40 @@ public void process(OutputStream out) throws
IOException {
@OnScheduled
public void setup(final ProcessContext context) {
- Object specJson = null;
- if(context.getProperty(JOLT_SPEC).isSet() &&
!SORTR.getValue().equals(context.getProperty(JOLT_TRANSFORM).getValue())){
- specJson =
JsonUtils.jsonToObject(context.getProperty(JOLT_SPEC).getValue(),
DEFAULT_CHARSET);
+
+ try{
+ Object specJson = null;
+
+ if(context.getProperty(MODULES).isSet()){
+ customClassLoader =
ClassLoaderUtils.getCustomClassLoader(context.getProperty(MODULES).getValue(),this.getClass().getClassLoader(),getJarFilenameFilter());
+ }else{
+ customClassLoader = null;
+ }
+
+ if(context.getProperty(JOLT_SPEC).isSet() &&
!SORTR.getValue().equals(context.getProperty(JOLT_TRANSFORM).getValue())){
+ specJson =
JsonUtils.jsonToObject(context.getProperty(JOLT_SPEC).getValue(),
DEFAULT_CHARSET);
+ }
+
+
if(CUSTOMR.getValue().equals(context.getProperty(JOLT_TRANSFORM).getValue())){
+ transform =
TransformFactory.getCustomTransform(customClassLoader,context.getProperty(CUSTOM_CLASS).getValue(),
specJson);
+ }else {
+ transform =
TransformFactory.getTransform(customClassLoader != null? customClassLoader :
this.getClass().getClassLoader(),
+
context.getProperty(JOLT_TRANSFORM).getValue(), specJson);
+ }
+
+ } catch (Exception ex){
+ getLogger().error("Unable to setup processor",ex);
}
- transform =
TransformFactory.getTransform(context.getProperty(JOLT_TRANSFORM).getValue(),
specJson);
+
}
+ protected FilenameFilter getJarFilenameFilter(){
--- End diff --
Another spot where lambdas could be (but don't have to be) used
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---