In doCreate(): check for a NULL pointer as a field value, and
authorscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 11 Aug 2009 18:49:43 +0000 (18:49 +0000)
committerscottmk <scottmk@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Tue, 11 Aug 2009 18:49:43 +0000 (18:49 +0000)
report it by class and field name.

git-svn-id: svn://svn.open-ils.org/ILS/trunk@13813 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/c-apps/oils_cstore.c

index 5365c6a..65be642 100644 (file)
@@ -1501,6 +1501,28 @@ static jsonObject* doCreate(osrfMethodContext* ctx, int* err ) {
                        value = jsonObjectToSimpleString( field_object );
                }
 
+               if( ! value ) {
+                       osrfAppSessionStatus(
+                               ctx->session,
+                               OSRF_STATUS_BADREQUEST,
+                               "osrfMethodException",
+                               ctx->request,
+                               "No value available for column"
+                       );
+                       osrfLogError(
+                               OSRF_LOG_MARK,
+                               "%s: NULL value for field %s of class %s",
+                               MODULENAME,
+                               field_name,
+                               osrfHashGet(meta, "classname")
+                       );
+                       osrfHashIteratorFree( field_itr );
+                       buffer_free( val_buf );
+                       buffer_free( col_buf );
+                       buffer_free( table_buf );
+                       *err = -1;
+                       return jsonNULL;
+               }
 
                if (first) {
                        first = 0;