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

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

merged 1 commit into from
Jan 10, 2020

Conversation

rdebusscher
Copy link

This is a bug fix

When you try to delete a JVM option which has defined a min and/or max version, the option cannot be found (and thus not deleted).

This PR fixes the delete logic of the JVM Options.

Important Info

No Unit Test created due to proxy requirements of JavaConfig within org.jvnet.hk2.config.ConfigSupport#apply(org.jvnet.hk2.config.SingleConfigCode<T>, T)

Testing

Testing Performed

./asadmin start-domain
./asadmin create-jvm-options '[1.8.123|1.8.231]-DtestOption'
./asadmin delete-jvm-options '[1.8.123|1.8.231]-DtestOption'

  • Quicklook

Testing Environment

Maven 3.5.4
JDK 1.8u181

@rdebusscher rdebusscher self-assigned this Jan 6, 2020
@@ -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.

@dmatej
Copy link
Contributor

dmatej commented Jan 9, 2020

Jenkins test please

@dmatej dmatej changed the title Delete JVM options with min max versions. CUSTOM-142. CUSTOM-142 Delete JVM options with min max versions. Jan 9, 2020
@MattGill98 MattGill98 merged commit 7002f7a into payara:master Jan 10, 2020
@rdebusscher rdebusscher deleted the CUSTCOM-142 branch January 20, 2020 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants