Skip to content

Enhance CouchbaseDocument and CouchbaseList to handle List implementa… #2042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

teetangh
Copy link

@teetangh teetangh commented Apr 1, 2025

Fix for Collections.SingletonList handling in Spring Data Couchbase

This PR addresses an issue where Collections.SingletonList and other List implementations cannot be stored directly in Couchbase documents after upgrading to Spring Boot 3.4.3 with Spring Data Couchbase 5.4.3.

Details

The error manifests as:

java.lang.IllegalArgumentException: Attribute of type java.util.Collections.SingletonList cannot be stored and must be converted.

The fix adds special handling for List implementations in the verifyValueType methods of both CouchbaseDocument and CouchbaseList classes, allowing them to be processed without requiring explicit conversion.

Changes

  • Modified CouchbaseDocument.verifyValueType() to accept List implementations
  • Modified CouchbaseList.verifyValueType() to accept List implementations
  • Updated error messages to provide clarity about which component is generating the error

This change ensures backward compatibility with code that worked in Spring Boot 3.2.4 while maintaining proper functionality in Spring Boot 3.4.3.

…tions in attribute validation. Updated error messages for clarity.
Copy link
Collaborator

@mikereiche mikereiche left a comment

Choose a reason for hiding this comment

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

Needs a test case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: waiting-for-triage An issue we've not yet triaged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants