greenrobot/greenDAO — Issue #5: update doesn't fail gracefully in case of a missing id column
Author: manuelciosici
Created: 2011-11-07 16:04:29+00:00
State: open

If an entity that implements Parcelable is passed from one Activity to another and the Parcelable class is not implemented correctly (not sending the id property) the update method fails without a clear failure message.

See stack trace:
11-07 16:54:43.114: E/AndroidRuntime(21655): FATAL EXCEPTION: main
11-07 16:54:43.114: E/AndroidRuntime(21655): java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent { (has extras) }} to activity {com.z/com.z.areas.ActivityGeo}: java.lang.NullPointerException
11-07 16:54:43.114: E/AndroidRuntime(21655):	at android.app.ActivityThread.deliverResults(ActivityThread.java:2504)
11-07 16:54:43.114: E/AndroidRuntime(21655):	at android.app.ActivityThread.handleSendResult(ActivityThread.java:2546)
11-07 16:54:43.114: E/AndroidRuntime(21655):	at android.app.ActivityThread.access$2000(ActivityThread.java:121)
11-07 16:54:43.114: E/AndroidRuntime(21655):	at android.app.ActivityThread$H.handleMessage(ActivityThread.java:966)
11-07 16:54:43.114: E/AndroidRuntime(21655):	at android.os.Handler.dispatchMessage(Handler.java:99)
11-07 16:54:43.114: E/AndroidRuntime(21655):	at android.os.Looper.loop(Looper.java:123)
11-07 16:54:43.114: E/AndroidRuntime(21655):	at android.app.ActivityThread.main(ActivityThread.java:3652)
11-07 16:54:43.114: E/AndroidRuntime(21655):	at java.lang.reflect.Method.invokeNative(Native Method)
11-07 16:54:43.114: E/AndroidRuntime(21655):	at java.lang.reflect.Method.invoke(Method.java:507)
11-07 16:54:43.114: E/AndroidRuntime(21655):	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:862)
11-07 16:54:43.114: E/AndroidRuntime(21655):	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:620)
11-07 16:54:43.114: E/AndroidRuntime(21655):	at dalvik.system.NativeStart.main(Native Method)
11-07 16:54:43.114: E/AndroidRuntime(21655): Caused by: java.lang.NullPointerException
11-07 16:54:43.114: E/AndroidRuntime(21655):	at de.greenrobot.dao.AbstractDao.updateInsideSynchronized(AbstractDao.java:444)
11-07 16:54:43.114: E/AndroidRuntime(21655):	at de.greenrobot.dao.AbstractDao.update(AbstractDao.java:428)
11-07 16:54:43.114: E/AndroidRuntime(21655):	at com.z.areas.Area.update(Area.java:131)
11-07 16:54:43.114: E/AndroidRuntime(21655):	at com.z.areas.ActivityGeo.onActivityResult(ActivityGeo.java:137)
11-07 16:54:43.114: E/AndroidRuntime(21655):	at android.app.Activity.dispatchActivityResult(Activity.java:3907)
11-07 16:54:43.114: E/AndroidRuntime(21655):	at android.app.ActivityThread.deliverResults(ActivityThread.java:2500)
11-07 16:54:43.114: E/AndroidRuntime(21655):	... 11 more