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

CUSTOM-142 Delete JVM options with min max versions. #4409

Merged
merged 1 commit into from
Jan 10, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ private void deleteX(final JvmOptionBag bag, final List<String> toRemove, final
SingleConfigCode<JvmOptionBag> scc = (JvmOptionBag bag1) -> {
List<String> jvmopts = new ArrayList<>(bag1.getJvmRawOptions());
int orig = jvmopts.size();
boolean removed = jvmopts.removeIf(option -> toRemove.contains(new JvmOption(option).option));
// using new JvmOption(option).toString() (instead op option directly) to make sure the correct formatting is applied.
boolean removed = jvmopts.removeIf(option -> toRemove.contains(new JvmOption(option).toString()));
Copy link
Contributor

Choose a reason for hiding this comment

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

This method has expectations ... it expects that formatting is done in option.toString() and it's result will be same as strings in bag1.getJvmRawOptions().
Seems fragile to me,

getJvmRawOptions does not have javadoc, but it looks it is the content of the XML element.
JvmOption.toString prints also minVersion and maxVersion, seems it is really symetric at this moment ... ok.

bag1.setJvmOptions(jvmopts);
int now = jvmopts.size();
if (removed) {
Expand Down