Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import java.util.TreeMap;
import java.util.Map;
import java.util.List;

/**
* A {@link CouchbaseDocument} is an abstract representation of a document stored inside Couchbase Server.
Expand Down Expand Up @@ -275,8 +276,14 @@ private void verifyValueType(final Object value) {
if (CouchbaseSimpleTypes.DOCUMENT_TYPES.isSimpleType(clazz)) {
return;
}

// Special handling for List implementations like Collections.SingletonList and ArrayList
if (value instanceof List) {
return;
}

throw new IllegalArgumentException(
"Attribute of type " + clazz.getCanonicalName() + " cannot be stored and must be converted.");
"Attribute of type " + clazz.getCanonicalName() + " cannot be stored in document and must be converted.");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,9 +200,14 @@ private void verifyValueType(final Object value) {
if (simpleTypeHolder.isSimpleType(clazz)) {
return;
}

// Special handling for List implementations like Collections.SingletonList and ArrayList
if (value instanceof List) {
return;
}

throw new IllegalArgumentException(
"Attribute of type " + clazz.getCanonicalName() + " can not be stored and must be converted.");
"Attribute of type " + clazz.getCanonicalName() + " cannot be stored in list and must be converted.");
}

/**
Expand Down