NullPointerException if some field of Entity are not filled
Tested on 2.0.4.
I have on Entityt with different type of field: Long, Date. I try to store this entity with junit test
If the field with Long type is null,the exception is java.lang.NullPointerException at com.impetus.kundera.property.accessor.LongAccessor.toBytes(LongAccessor.java:47) at com.impetus.kundera.property.PropertyAccessorHelper.get(PropertyAccessorHelper.java:169) at com.impetus.client.cassandra.pelops.PelopsDataHandler.addColumnsToThriftRow(PelopsDataHandler.java:481) at com.impetus.client.cassandra.pelops.PelopsDataHandler.toThriftRow(PelopsDataHandler.java:454) at com.impetus.client.cassandra.pelops.PelopsClient.populateTfRow(PelopsClient.java:479) at com.impetus.client.cassandra.pelops.PelopsClient.persist(PelopsClient.java:344)
If the field with Date type is null, the exception is : java.lang.NullPointerException at com.impetus.kundera.index.DocumentIndexer.addFieldToDocument(DocumentIndexer.java:275) at com.impetus.kundera.index.DocumentIndexer.addEntityFieldsToDocument(DocumentIndexer.java:206) at com.impetus.kundera.index.LuceneIndexer.indexDocument(LuceneIndexer.java:534) at com.impetus.kundera.index.LuceneIndexer.index(LuceneIndexer.java:196) at com.impetus.kundera.index.IndexManager.write(IndexManager.java:104)
If the field with Integer type is null, the exception is : java.lang.NullPointerException at com.impetus.kundera.property.accessor.IntegerAccessor.toBytes(IntegerAccessor.java:43) at com.impetus.kundera.property.PropertyAccessorHelper.get(PropertyAccessorHelper.java:169) at com.impetus.client.cassandra.pelops.PelopsDataHandler.addColumnsToThriftRow(PelopsDataHandler.java:481) at com.impetus.client.cassandra.pelops.PelopsDataHandler.toThriftRow(PelopsDataHandler.java:454) at com.impetus.client.cassandra.pelops.PelopsClient.populateTfRow(PelopsClient.java:479) at com.impetus.client.cassandra.pelops.PelopsClient.persist(PelopsClient.java:344)
It work with String type only because you have surronded with try catch (exception)
And another point, please remove e.printStackTrace(); line 40 of StringAccessor class
Support for different data types is yet to matured(e.g. Date, long , UUID etc) .
Should be fixed in 2.0.5 slated on month end release.
"reproducible" and will be fixed with 2.0.5
kkmishra.
Not sure if this is totally fixed in 2.0.5 yet. I had some issues with ShortAccessor, LongAccessor, and a couple others. I did some fixes in my fork (branch 2.0.5).
Fixed . closing it,