levilentz commented on a change in pull request #5444: URL: https://github.com/apache/nifi/pull/5444#discussion_r738861493
########## File path: nifi-nar-bundles/nifi-standard-bundle/nifi-standard-processors/src/main/java/org/apache/nifi/processors/standard/JoltTransformJSON.java ########## @@ -306,26 +316,33 @@ public void process(OutputStream out) throws IOException { logger.info("Transformed {}", new Object[]{original}); } - private JoltTransform getTransform(final ProcessContext context, final FlowFile flowFile) throws Exception { + private JoltTransform getTransform(final ProcessContext context, final FlowFile flowFile) { final Optional<String> specString; if (context.getProperty(JOLT_SPEC).isSet()) { specString = Optional.of(context.getProperty(JOLT_SPEC).evaluateAttributeExpressions(flowFile).getValue()); } else { specString = Optional.empty(); } - return transformCache.get(specString); + return transformCache.get(specString, currString -> { + try { + return createTransform(context, currString.orElse(null), flowFile); + } catch (Exception e) { + getLogger().error("Problem getting transform", e); + } + return null; + }); } @OnScheduled public void setup(final ProcessContext context) { int maxTransformsToCache = context.getProperty(TRANSFORM_CACHE_SIZE).asInteger(); transformCache = Caffeine.newBuilder() .maximumSize(maxTransformsToCache) - .build(specString -> createTransform(context, specString.orElse(null))); + .build(); try { - if (context.getProperty(MODULES).isSet()) { + if (context.getProperty(MODULES).isSet() && !context.getProperty(MODULES).isExpressionLanguagePresent()) { Review comment: Good catch. After review, I actually think the modules should only be ```ExpressionLanguageScope.VARIABLE_REGISTRY``` for the MODULES properties. The overhead associated with each flowfile having its own associated jar would be very large and an unlikely use case. Therefore I changed that association and removed the complex (and worrisome) expression language exclusions that were being done on the validate step in both the JSON jolt processor and the Jolt Record processor. -- 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. To unsubscribe, e-mail: issues-unsubscr...@nifi.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org