[ 
https://issues.apache.org/jira/browse/NIFI-2020?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15368763#comment-15368763
 ] 

ASF GitHub Bot commented on NIFI-2020:
--------------------------------------

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

    https://github.com/apache/nifi/pull/564#discussion_r70156828
  
    --- Diff: 
nifi-nar-bundles/nifi-standard-bundle/nifi-jolt-transform-json-ui/src/main/java/org/apache/nifi/web/standard/api/transformjson/TransformJSONResource.java
 ---
    @@ -84,6 +84,36 @@ public Response executeSpec(JoltSpecificationDTO 
specificationDTO) {
     
         }
     
    +    protected Transform getTransformation(JoltSpecificationDTO 
specificationDTO) throws Exception{
    +
    +        Object specJson = 
getSpecificationJsonObject(specificationDTO.getSpecification());
    +        String transformName = specificationDTO.getTransform();
    +        String modules = specificationDTO.getModules();
    +
    +        ClassLoader customClassLoader = null;
    +        Transform transform ;
     
    +        if(modules != null && !modules.isEmpty()){
    +            customClassLoader = 
ClassLoaderUtils.getCustomClassLoader(specificationDTO.getModules(),this.getClass().getClassLoader(),
 getJarFilenameFilter());
    +        }
    +
    +        if(transformName.equals("jolt-transform-custom")) {
    +            transform = 
TransformFactory.getCustomTransform(customClassLoader,specificationDTO.getCustomClass(),
 specJson);
    --- End diff --
    
    Is it possible that customClassLoader would be null here? I see you check 
for that in the "else" clause but not the "if" clause. Even if the UI / 
customValidators prevent this kind of thing, it might still be a good thing to 
add. If there is a way to directly make the API call without a value for 
"modules", then this could cause an NPE and a unit test could show that the 
added null check works :)


> Enhance JoltTransformJSON processor to support custom transforms
> ----------------------------------------------------------------
>
>                 Key: NIFI-2020
>                 URL: https://issues.apache.org/jira/browse/NIFI-2020
>             Project: Apache NiFi
>          Issue Type: New Feature
>          Components: Core Framework
>    Affects Versions: 1.0.0
>            Reporter: Yolanda M. Davis
>            Assignee: Yolanda M. Davis
>             Fix For: 1.0.0
>
>
> Jolt supports additional custom transforms via fully-qualified Java 
> classnames. Would like to provide the ability to support custom 
> transformation (via drop in jars) for the Jolt Transform processor.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to