Skip to content

Fix UnsupportedOperationException in executeAdminDomainCommand for postBootCommands with arguments#37

Open
jcputney wants to merge 1 commit intoOmniFish-EE:mainfrom
jcputney:fix/issue-36-post-boot-commands-immutable-args
Open

Fix UnsupportedOperationException in executeAdminDomainCommand for postBootCommands with arguments#37
jcputney wants to merge 1 commit intoOmniFish-EE:mainfrom
jcputney:fix/issue-36-post-boot-commands-immutable-args

Conversation

@jcputney
Copy link
Copy Markdown

Fixes #36.

Problem

executeAdminDomainCommand mutates its caller-supplied args list via args.add(config.getDomain()). Callers from start() (post-boot-commands loop) and stop()/stopContainer() pass immutable lists from Arrays.asList(...) and List.of(), so this throws UnsupportedOperationException at runtime — surfacing most visibly at @AfterSuite teardown.

Fix

Defensive copy of args inside executeAdminDomainCommand. The method no longer mutates caller state, and immutable inputs work as expected.

Tests

Adds GlassFishServerControlPostBootCommandsTest with three cases covering both immutable list flavors (Arrays.asList, List.of). Verified to fail with UnsupportedOperationException without the fix
and pass with it.

Scope

One-line behavior change + targeted unit test. No reformatting, no unrelated edits.

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.

postBootCommands with arguments throws UnsupportedOperationException

1 participant