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


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to