Skip to content

Improve SPDX license import error handling and add development configurations#3927

Closed
sharad-31 wants to merge 4 commits intoeclipse-sw360:mainfrom
sharad-31:feature/licensedb-integration
Closed

Improve SPDX license import error handling and add development configurations#3927
sharad-31 wants to merge 4 commits intoeclipse-sw360:mainfrom
sharad-31:feature/licensedb-integration

Conversation

@sharad-31
Copy link
Copy Markdown

Summary

This pull request improves the robustness of the SPDX license import workflow and introduces several configuration updates to support local development and testing.

The main improvement enhances the reliability of the SPDX license import process by introducing explicit request status tracking and improved error handling in the license import logic.

Additionally, this PR includes configuration updates for local Docker setups, Keycloak test configuration, and Maven lifecycle mapping adjustments to improve the developer experience.


Changes

1. Improve SPDX License Import Error Handling

Updated the method LicenseDatabaseHandler.importAllSpdxLicenses() to improve reliability and error reporting during SPDX license import.

Key improvements:

  • Introduced RequestStatus requestStatus to track the success or failure of the import operation.
  • Captured the result of the license import operation:
List<License> importedLicenses = addOrOverwriteLicenses(newLicenses, user, false);
  • Added validation when the import operation returns null.
  • Ensured mismatch reporting only occurs when the import operation succeeds:
if (mismatchedLicenses.size() > 0 && requestStatus == RequestStatus.SUCCESS)
  • Updated the request summary to dynamically reflect the request status:
.setRequestStatus(requestStatus);

This prevents situations where the system could incorrectly report a successful import when the import operation actually failed.


2. Docker Configuration for Local Development

Added a docker-compose.override.yml configuration to simplify local development by defining CouchDB credentials.

services:
  couchdb:
    environment:
      - COUCHDB_USER=sw360
      - COUCHDB_PASSWORD=sw360fossie

This allows developers to run SW360 locally with Docker without additional manual configuration.


3. Keycloak Organization Mapping Test Configuration

Added orgmapping.properties under:

keycloak/event-listeners/src/test/resources/

This configuration file provides test mappings for organization mapping functionality, including:

  • Custom mapping enablement
  • Prefix matching
  • Example organization-to-department mappings

This helps validate organization mapping behavior in tests.


4. Maven Lifecycle Mapping Fix for IDE Builds

Added lifecycle mapping configuration in keycloak/pom.xml to prevent m2e from executing the copy-dependencies goal during incremental IDE builds.

This resolves IDE warnings and improves developer workflow when building the Keycloak module in Eclipse-based environments.


5. Code Cleanup

Removed unused imports from:

backend/attachments/src/test/java/org/eclipse/sw360/attachments/TestAttachmentClient.java

This improves code cleanliness and removes unnecessary compiler warnings.


6. Development Environment Improvements

Added .vscode/settings.json for improved Java build configuration when using VSCode.


Files Modified

  • licenses-core/src/main/java/org/eclipse/sw360/licenses/db/LicenseDatabaseHandler.java

    • Added request status tracking and improved error handling for SPDX license import.
  • backend/attachments/src/test/java/org/eclipse/sw360/attachments/TestAttachmentClient.java

    • Removed unused imports.
  • docker-compose.override.yml

    • Added CouchDB environment configuration for local Docker setup.
  • keycloak/event-listeners/src/test/resources/orgmapping.properties

    • Added configuration for organization mapping tests.
  • keycloak/pom.xml

    • Added Maven lifecycle mapping configuration to avoid IDE build issues.
  • .vscode/settings.json

    • Added VSCode Java configuration.

Issue

Related to: #3781
Issue: This pull request contributes improvements related to the ongoing work on integrating LicenseDB as the single source of truth for license and obligation data in SW360.

This PR improves robustness of the SPDX license import process and adds configuration improvements to support local development and testing.


Suggest Reviewer

Kindly requesting review from:
@GMishx
@deo002


How To Test

  1. Start SW360 locally using Docker.

  2. Verify CouchDB configuration works using:

docker-compose up
  1. Trigger the SPDX license import process.

  2. Validate the following scenarios:

Successful Import

  • Licenses are imported correctly.
  • RequestSummary reports SUCCESS.

Import Failure

  • If addOrOverwriteLicenses() fails or returns null, the request status becomes FAILURE.
  • Error logs are generated.

Mismatch Handling

  • Mismatch messages appear only when the import operation succeeds.

Keycloak Tests

  • Verify that organization mapping tests execute correctly using the added orgmapping.properties.

Checklist

Must:

  • All related issues are referenced in commit messages and in PR

@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 Mar 23, 2026
@sharad-31 sharad-31 closed this Mar 26, 2026
@sharad-31 sharad-31 deleted the feature/licensedb-integration branch March 26, 2026 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs code review 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