Skip to content

fix(licenseinfo): accumulate all obligations per license in DOCX reports#3748

Open
Aman-Cool wants to merge 1 commit intoeclipse-sw360:mainfrom
Aman-Cool:fix/docx-obligation-overwrite
Open

fix(licenseinfo): accumulate all obligations per license in DOCX reports#3748
Aman-Cool wants to merge 1 commit intoeclipse-sw360:mainfrom
Aman-Cool:fix/docx-obligation-overwrite

Conversation

@Aman-Cool
Copy link
Contributor

Description

Fixes silent discard of multiple obligations per license in DOCX compliance reports. The fillComponentObligationsTable() method blindly overwrites instead of accumulating obligations, causing all but the last obligation for each license to vanish from generated reports.

For Apache-2.0 with three obligations (Attribution, Distribution, Patent retaliation), only the last obligation appears in the report. The other two are silently lost with no error, warning, or log entry.

Related Issue

N/A

Changes Made

  • Changed fillComponentObligationsTable() to use computeIfAbsent() instead of put()
  • Now accumulates multiple obligations per license instead of overwriting
  • Uses LinkedHashMap to preserve document-defined obligation order

File changed: backend/licenseinfo/src/main/java/org/eclipse/sw360/licenseinfo/outputGenerators/DocxGenerator.java (3 lines)

Testing

  • ✅ Manual test performed with Apache-2.0 CLI attachment containing 3 obligations
  • ✅ Verified all obligations now appear in generated DOCX report
  • ✅ Tested with multiple licenses (GPL-2.0, LGPL-2.1, MPL-2.0)
  • ⭕ Unit test (existing tests cover this code path)

Impact

  • All obligations per license now included in compliance reports (not just the last one)
  • Legal teams get complete, accurate obligation checklists
  • Eliminates silent compliance gaps that would fail IP audits
  • No behavior change for licenses with single obligations
  • No breaking changes to report format or API

Checklist

  • ✅ Code follows project style guidelines
  • ✅ All existing tests pass
  • ✅ Signed-off-by added to commit (git commit -s)
  • ✅ Commit message follows conventional format: fix(licenseinfo): accumulate all obligations per license in DOCX reports
  • ✅ No new files added (existing file modified)

Additional Notes

This is a critical fix for compliance workflows. The bug causes legally-binding compliance reports to silently omit obligations, creating undetectable compliance gaps. The rendering code was already correct - only the accumulation logic was broken.

Use computeIfAbsent to merge topic-text entries instead of overwriting,
so multiple obligations referencing the same license ID are all included
in the Additional Requirements table.
@Aman-Cool
Copy link
Contributor Author

Aman-Cool commented Feb 23, 2026

Hi @GMishx @Farooq-Fateh-Aftab ,Ran into this while exporting compliance reports. The DOCX generator overwrites obligations instead of accumulating them, so only the last obligation per license makes it into the report.

Bit concerning since these are used for audits. Let me know if you need any changes.

@GMishx GMishx added needs code review needs general test This is general testing, meaning that there is no org specific issue to check for labels Feb 24, 2026
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.

Changes looks good.

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.

Missed to select approve

@GMishx
Copy link
Member

GMishx commented Feb 24, 2026

@keerthi-bl please help test the PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs general test This is general testing, meaning that there is no org specific issue to check for

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants