Skip to content

fix: allow nullable uid in InetOrgPerson#19373

Open
ezhilnn wants to merge 1 commit into
spring-projects:mainfrom
ezhilnn:fix/inet-org-person-nullable-uid
Open

fix: allow nullable uid in InetOrgPerson#19373
ezhilnn wants to merge 1 commit into
spring-projects:mainfrom
ezhilnn:fix/inet-org-person-nullable-uid

Conversation

@ezhilnn

@ezhilnn ezhilnn commented Jun 23, 2026

Copy link
Copy Markdown

Fixes #19370

Problem

uid is marked @Nullable on the field but two places contradicted
this:

  • getUid() called Objects.requireNonNull(), throwing NPE if uid is null
  • Essence(DirContextOperations) constructor called Assert.notNull(),
    throwing IllegalArgumentException if uid is absent from LDAP context

According to the LDAP inetOrgPerson schema, uid is not a mandatory
field. This behavior also regressed from pre-7.1.0 behavior (introduced
in commit c5632cc).

Changes

  • getUid() now returns @Nullable String and returns the field directly
  • Constructor no longer asserts uid is non-null; skips setUid() if absent
  • setUid() now accepts @Nullable String and guards username mapping
    with a null check

Testing

  • Added testNullUidIsAllowed() to verify null uid no longer throws

Signed-off-by: ezhilnn <ezhilnaga4732@gmail.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jun 23, 2026
@ezhilnn ezhilnn force-pushed the fix/inet-org-person-nullable-uid branch from 3c516d5 to dd57915 Compare June 23, 2026 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged

Projects

None yet

Development

Successfully merging this pull request may close these issues.

InetOrgPerson uid should not be a mandatory field - may cause regression as of version 7.1.0

2 participants