Skip to content

Comments

fix: Prevent NullPointerException in Sw360ProjectService#3709

Merged
GMishx merged 1 commit intoeclipse-sw360:mainfrom
ADITYA-CODE-SOURCE:fix/sw360-project-npe
Feb 23, 2026
Merged

fix: Prevent NullPointerException in Sw360ProjectService#3709
GMishx merged 1 commit intoeclipse-sw360:mainfrom
ADITYA-CODE-SOURCE:fix/sw360-project-npe

Conversation

@ADITYA-CODE-SOURCE
Copy link
Contributor

Description

Fixed potential NullPointerException in Sw360ProjectService.setObligationsFromAdminSection method.

Changes

Changed from:

To:

Why This Fix Works

This is a standard Java idiom to avoid NullPointerException - by putting the constant string first ("Project".equalsIgnoreCase(oblLevel)), if oblLevel is null, it simply returns false instead of throwing an NPE.

Testing

  • No functional changes, only null-safety improvement
  • The logic remains the same

Fixes #3706

Changed oblLevel.equalsIgnoreCase(...) to "Project".equalsIgnoreCase(oblLevel)
to avoid NPE when oblLevel parameter is null.

This is a standard Java idiom - by putting the constant string first,
if oblLevel is null, it returns false instead of throwing NPE.

Fixes eclipse-sw360#3706
Copy link
Member

@GMishx GMishx left a comment

Choose a reason for hiding this comment

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

LGTM

@GMishx GMishx added the ready ready to merge label Feb 23, 2026
@GMishx
Copy link
Member

GMishx commented Feb 23, 2026

@ADITYA-CODE-SOURCE your future PRs will not be reviewed unless they follow the communities template.

@GMishx GMishx merged commit de763bb into eclipse-sw360:main Feb 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ready ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug Potential NullPointerException in Sw360ProjectService.setObligationsFromAdminSection

2 participants