kundera icon indicating copy to clipboard operation
kundera copied to clipboard

NullPointerException if some field of Entity are not filled

Open rsinelle opened this issue 14 years ago • 4 comments

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

rsinelle avatar Jan 04 '12 20:01 rsinelle

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.

mevivs avatar Jan 05 '12 05:01 mevivs

"reproducible" and will be fixed with 2.0.5

kkmishra.

kkmishra avatar Jan 05 '12 10:01 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).

kcarlson avatar Feb 08 '12 20:02 kcarlson

Fixed . closing it,

mevivs avatar Apr 18 '12 09:04 mevivs