Skip to content

Conversation

@Eruis2579
Copy link

Description

Fixes #5578

This PR fixes a ClassCastException that occurs when calling /api/v1/general/extract-bookmarks. The method was returning List<Map<String, Object>> directly, but Spring MVC was wrapping it in a ResponseEntity, causing a type mismatch.

Changes

  • Changed return type from List<Map<String, Object>> to ResponseEntity<List<Map<String, Object>>>
  • Wrapped return values with ResponseEntity.ok(...) to match Spring MVC pattern
  • Removed @ResponseBody annotation as it is not needed with ResponseEntity

Verification

This fix follows the same pattern used in other similar endpoints:

  • VerifyPDFController.verifyPDF() returns ResponseEntity<List<PDFVerificationResult>>
  • ValidateSignatureController.validateSignature() returns ResponseEntity<List<SignatureValidationResult>>

Testing

The endpoint should now return a proper JSON response with the list of bookmarks instead of throwing a 500 error.

- Change return type from List<Map<String, Object>> to ResponseEntity<List<Map<String, Object>>>
- Wrap return values in ResponseEntity.ok() to match Spring MVC pattern
- Remove @responsebody annotation as it's not needed with ResponseEntity

Fixes Stirling-Tools#5578
@dosubot dosubot bot added size:XS This PR changes 0-9 lines ignoring generated files. Bugfix Pull requests that fix bugs labels Jan 30, 2026
@stirlingbot stirlingbot bot added Java Pull requests that update Java code Back End Issues related to back-end development API API-related issues or pull requests and removed Bugfix Pull requests that fix bugs labels Jan 30, 2026
- Update extractBookmarks test methods to expect ResponseEntity<List<Map<String, Object>>>
- Extract body from ResponseEntity before assertions
- Fixes compilation errors in test suite
@dosubot dosubot bot added size:M This PR changes 30-99 lines ignoring generated files. and removed size:XS This PR changes 0-9 lines ignoring generated files. labels Jan 30, 2026
@stirlingbot stirlingbot bot added the Test Testing-related issues or pull requests label Jan 30, 2026
@Eruis2579
Copy link
Author

Hi, @Frooodle @Ludy87 @DarioGii @jbrunton96 @ConnorYoh
Could you review my PR please?
Thank you

@Frooodle
Copy link
Member

This is planned to get added don't worry
Will be in next release

@Eruis2579
Copy link
Author

This is planned to get added don't worry Will be in next release

Thank you.

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

Labels

API API-related issues or pull requests Back End Issues related to back-end development Java Pull requests that update Java code size:M This PR changes 30-99 lines ignoring generated files. Test Testing-related issues or pull requests

2 participants