Bug: License Upload Loses Original Error When Stream Cleanup Fails
Description
When uploading a license file fails, the error message can be replaced by a stream cleanup error, hiding the real problem.
What's wrong:
- If license import fails AND stream cleanup also fails, you only see the cleanup error
- The actual reason for the import failure is lost
- No validation check if file is null or empty
How to Reproduce
- Upload an invalid license archive to
/api/licenses/upload
- If the import fails and a stream also fails to close
- The logs only show "Failed to close stream" instead of the actual import error
Location
File: rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/license/Sw360LicenseService.java
Method: uploadLicense() (line ~273)
The Problem
} finally {
// ... cleanup code ...
if (closeFailure != null) {
throw closeFailure; // This hides the original exception!
}
}
Bug: License Upload Loses Original Error When Stream Cleanup Fails
Description
When uploading a license file fails, the error message can be replaced by a stream cleanup error, hiding the real problem.
What's wrong:
How to Reproduce
/api/licenses/uploadLocation
File:
rest/resource-server/src/main/java/org/eclipse/sw360/rest/resourceserver/license/Sw360LicenseService.javaMethod:
uploadLicense()(line ~273)The Problem