Skip to content

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