Skip to content

Clear the user context with clearUserContext() in QueueEntryServiceTest - #127

Merged
dkayiwa merged 1 commit into
openmrs:core-3.xfrom
dkayiwa:core-3.x-clear-user-context
Oct 10, 2026
Merged

dkayiwa merged 1 commit into
openmrs:core-3.xfrom
dkayiwa:core-3.x-clear-user-context

Conversation

@dkayiwa

@dkayiwa dkayiwa commented Oct 10, 2026

Copy link
Copy Markdown
Member

Since TRUNK-6799 (openmrs-core #6544), Context.setUserContext(null) throws an NPE, because it now wraps its argument in an OpenmrsAuthenticationToken. shouldUndoTransitionQueueEntry cleaned up with setUserContext(null) and failed on core-3.x. clearUserContext() is the API for removing the context.

QueueEntryServiceTest locally on Java 21 against the current core 3.0.0-SNAPSHOT: before, 31 run with 1 error (that NPE); after, 31 run with 0 failures and 0 errors.

🤖 Generated with Claude Code

https://claude.ai/code/session_01ASZcAmLun5HaBwCZ4kjEjx

Since TRUNK-6799 (openmrs-core #6544) setUserContext wraps its argument
in an OpenmrsAuthenticationToken, so setUserContext(null) throws a
NullPointerException and shouldUndoTransitionQueueEntry fails in its
finally block. clearUserContext() is the API for removing the context.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ASZcAmLun5HaBwCZ4kjEjx
@sonarqubecloud

Copy link
Copy Markdown

@greptile-apps

greptile-apps Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

RetriggerConfidence Score: 5/5

[Low impact] This change appears safe to merge.

Summary

No actionable issues found.

  • The undo-transition test clears its user context with clearUserContext().

Reviews (1) · Last reviewed commit: "Clear the user context with clearUserCon..." · Reviewed by Greptile

@dkayiwa
dkayiwa merged commit 1ccae7b into openmrs:core-3.x Oct 10, 2026
9 checks passed
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.

1 participant