Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NIFI-2619: Added logic to ClassLoaderUtils to trim module paths and accept URLs #907

Closed
wants to merge 3 commits into from

Conversation

mattyb149
Copy link
Contributor

No description provided.

@YolandaMDavis
Copy link
Contributor

@mattyb149 will take a look

// Split and trim the module path(s)
List<String> modules = (modulePath == null)
? null
: Arrays.stream(modulePath.split(",")).map((path) -> path == null ? null : path.trim()).filter((item) -> item != null).collect(Collectors.toList());
Copy link
Contributor

Choose a reason for hiding this comment

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

Executed tests and realized doesn't quite cover for mistakenly added leading commas or leading/trailing commas with blanks before or after them (respectively) e.g. "/src/folder/one.jar1, /src/folder/two.jar, " . Edge case but I think changing the lambda around to blank values in array are filtered out should prevent error:

//Maybe something like this using StringUtils.isNotBlank ?
Arrays.stream(modulePath.split(",")).filter((item) -> StringUtils.isNotBlank(item)).map((path) -> path.trim()).collect(Collectors.toList());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. I changed to use yours (replacing some things with method references) and added a unit test around the errors you found.

@YolandaMDavis
Copy link
Contributor

@mattyb149 thanks for applying that change. I tested on standalone node with Jolt Transform processor using a list of customjars (included extra commas, spaces etc) and works as expected with no exceptions thrown.

+1

Will squash and merge shortly

@asfgit asfgit closed this in 7123a1a Aug 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants