I'm using Morphia 0.99.1-SNAPSHOT because i need the URIConverter changes from
r1751. Sadly, the URIConverter is broken when a URI field has a null value and
is passed to save(). I created a self-contained test case at github which can
be used to reproduce the bug: https://github.com/Malax/MorphiaURIBugTestcase
Please include a stack trace below:
Exception in thread "main" com.google.code.morphia.mapping.MappingException:
Error mapping field:de.malax.testcase.morphia.uri.TestClass.uriProperty
at com.google.code.morphia.mapping.Mapper.toDBObject(Mapper.java:484)
at com.google.code.morphia.mapping.Mapper.toDBObject(Mapper.java:466)
at com.google.code.morphia.DatastoreImpl.entityToDBObj(DatastoreImpl.java:713)
at com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:763)
at com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:834)
at com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:828)
at de.malax.testcase.morphia.uri.MorphiaBugTestcase.main(MorphiaBugTestcase.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.lang.RuntimeException: java.lang.NullPointerException
at com.google.code.morphia.mapping.ValueMapper.toDBObject(ValueMapper.java:18)
at com.google.code.morphia.mapping.Mapper.writeMappedField(Mapper.java:567)
at com.google.code.morphia.mapping.Mapper.toDBObject(Mapper.java:482)
... 11 more
Caused by: java.lang.NullPointerException
at com.google.code.morphia.converters.URIConverter.encode(URIConverter.java:21)
at com.google.code.morphia.converters.URIConverter.encode(URIConverter.java:14)
at com.google.code.morphia.converters.DefaultConverters.toDBObject(DefaultConverters.java:191)
at com.google.code.morphia.mapping.ValueMapper.toDBObject(ValueMapper.java:16)
... 13 more
Original issue reported on code.google.com by the.ma...@gmail.com on 16 Dec 2011 at 1:33
Original issue reported on code.google.com by
the.ma...@gmail.com
on 16 Dec 2011 at 1:33