Collections$UnmodifiableRandomAccessList Cassandra Frozen Map

Author: Krishna

I have a below UDT in my table

productsinfo FROZEN<productsinfo>

and this is the UDT schema for productsinfo

"owned_product_details" map<text, FROZEN<list<FROZEN<productdetails>>>>,
"available_product_details" map<text, FROZEN<list<FROZEN<productdetails>>>>

and the product details UDT has some text fields

When I try to insert the values using Java, it is throwing the exception

java.lang.NullPointerException: at index 1
at com.google.common.collect.ObjectArrays.checkElementNotNull(ObjectArrays.java:239)
at com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:230)
at com.google.common.collect.ObjectArrays.checkElementsNotNull(ObjectArrays.java:225)
at com.google.common.collect.ImmutableList.construct(ImmutableList.java:281)
at com.google.common.collect.ImmutableList.of(ImmutableList.java:85)
at com.datastax.driver.core.DataType.map(DataType.java:462)
at com.datastax.driver.core.DataType.map(DataType.java:475)
at org.springframework.data.cassandra.core.mapping.BasicCassandraPersistentProperty.getDataTypeFor(BasicCassandraPersistentProperty.java:223)
at org.springframework.data.cassandra.core.mapping.BasicCassandraPersistentProperty.findDataType(BasicCassandraPersistentProperty.java:186)
at org.springframework.data.cassandra.core.mapping.BasicCassandraPersistentProperty.getDataType(BasicCassandraPersistentProperty.java:169)
at org.springframework.data.cassandra.core.mapping.CassandraMappingContext.getDataTypeWithUserTypeFactory(CassandraMappingContext.java:571)
at org.springframework.data.cassandra.core.mapping.CassandraMappingContext.getDataType(CassandraMappingContext.java:536)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.getCodec(MappingCassandraConverter.java:151)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.writeUDTValue(MappingCassandraConverter.java:657)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.write(MappingCassandraConverter.java:391)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.getWriteValue(MappingCassandraConverter.java:822)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.getWriteValue(MappingCassandraConverter.java:749)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.writeUpdateFromWrapper(MappingCassandraConverter.java:478)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.write(MappingCassandraConverter.java:383)
at org.springframework.data.cassandra.core.convert.MappingCassandraConverter.write(MappingCassandraConverter.java:365)
at org.springframework.data.cassandra.core.QueryUtils.createUpdateQuery(QueryUtils.java:132)
at org.springframework.data.cassandra.core.CassandraTemplate.update(CassandraTemplate.java:584)

and on debugging I found this

suppressedExceptions    Collections$UnmodifiableRandomAccessList<E>  (id=317)   

Following are the entity classes in Java

@Column("productsinfo")
@CassandraType(type = DataType.Name.UDT, userTypeName = "productsinfo")
private ProductsInfo productsInfo;

@Column("owned_product_details")
@CassandraType(type = DataType.Name.MAP, typeArguments = { DataType.Name.TEXT, DataType.Name.LIST })
private Map<String, List<ProductDetails>> ownedProductDetails;

@Column("available_product_details")
@CassandraType(type = DataType.Name.MAP, typeArguments = { DataType.Name.TEXT, DataType.Name.LIST })
private Map<String, List<ProductDetails>> availableProductDetails;

Originally Sourced from: https://stackoverflow.com/questions/57478838/collectionsunmodifiablerandomaccessliste-cassandra-frozen-map