Skip to content

NIFI-15975 Fixed single line comment bug, multiple let statements bug and improved the invalid read JSLT transform message.#11338

Open
dan-s1 wants to merge 5 commits into
apache:mainfrom
dan-s1:NIFI-15975
Open

NIFI-15975 Fixed single line comment bug, multiple let statements bug and improved the invalid read JSLT transform message.#11338
dan-s1 wants to merge 5 commits into
apache:mainfrom
dan-s1:NIFI-15975

Conversation

@dan-s1

@dan-s1 dan-s1 commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Summary

NIFI-15975
This PR along with the fix in the nifi-api for NIFI-15982 solve three issues that were reported in NIFI-15975.
The first two issues had to do with when single line Java comments are used in the JSLT transform. Before the fix for NIFI-15982, the framework mistook the leading forward slash of the Java comment as a file path. The second issue was the code in the JSLTTransformJSON actually did not report the true reason why it failed which was the JSLT transform was not a valid file path. The fix for NIFI-15982 took care of NIFI mistakenly thinking the single line Java comment is a file and the fix in this PR ensures the real reason for failure is displayed.
The final issue reported what was the inability to place two let statements on separate lines without placing an additional space between them. That was due to the JSLT transform being read with the new lines being stripped out. The fix for this was to reintroduce the new lines when reconstituting the JSLT transform after it is read from the given source.

As an aside, the fix for NIFI-15982 also fixed JoltTransformJSON and ValidateJson, as the Jolt spec and schema source could be text and single Java comments are allowed.

Tracking

Please complete the following tracking steps prior to pull request creation.

Issue Tracking

Pull Request Tracking

  • Pull Request title starts with Apache NiFi Jira issue number, such as NIFI-00000
  • Pull Request commit message starts with Apache NiFi Jira issue number, as such NIFI-00000
  • Pull request contains commits signed with a registered key indicating Verified status

Pull Request Formatting

  • Pull Request based on current revision of the main branch
  • Pull Request refers to a feature branch with one commit containing changes

Verification

Please indicate the verification steps performed prior to pull request creation.

Build

  • Build completed using ./mvnw clean install -P contrib-check
    • JDK 21
    • JDK 25

Licensing

  • New dependencies are compatible with the Apache License 2.0 according to the License Policy
  • New dependencies are documented in applicable LICENSE and NOTICE files

Documentation

  • Documentation formatting appears as expected in rendered files

… and improved the invalid read JSLT transform message.
@dan-s1 dan-s1 requested a review from pvillard31 June 15, 2026 13:52
@dan-s1 dan-s1 added the bug label Jun 15, 2026
}
try (final BufferedReader reader = new BufferedReader(new InputStreamReader(resourceReference.read()))) {
return reader.lines().collect(Collectors.joining());
return reader.lines().collect(Collectors.joining(System.lineSeparator()));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you consider joining the lines with a fixed newline instead of System.lineSeparator(), so the compiled transform and the modifyContent provenance detail stay identical across Windows and Linux?

@dan-s1 dan-s1 Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not consider that. I made the same change as was made in #7678 for JoltTransformJSON and JoltTransformRecord which solved the similar issue. Do still want this change? If so, should a similar change then be made for JoltTransformJSON and JoltTransformRecord?

@dan-s1 dan-s1 requested a review from pvillard31 June 16, 2026 16:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants