Oaf exception patch ...



Hi there,

	This was most helpful for me, and will prolly help others in
the future:

	May I commit ?

		Michael.

Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/oaf/ChangeLog,v
retrieving revision 1.175
diff -u -r1.175 ChangeLog
--- ChangeLog	2001/07/27 18:26:13	1.175
+++ ChangeLog	2001/07/30 17:00:20
@@ -1,3 +1,9 @@
+2001-07-30  Michael Meeks  <michael ximian com>
+
+	* liboaf/oaf-plugin.c (oaf_server_activate_shlib): fire an
+	exception if the factory acts strangely, and returns NIL
+	when it should create an object - yet threw no exception.
+
 2001-07-27  Michael Meeks  <michael ximian com>
 
 	* liboaf/oaf-plugin.c (oaf_server_activate_shlib): fire an
Index: liboaf/oaf-plugin.c
===================================================================
RCS file: /cvs/gnome/oaf/liboaf/oaf-plugin.c,v
retrieving revision 1.16
diff -u -r1.16 oaf-plugin.c
--- liboaf/oaf-plugin.c	2001/07/27 18:26:14	1.16
+++ liboaf/oaf-plugin.c	2001/07/30 17:00:20
@@ -196,8 +196,20 @@
 								    &dummy,
 								    ev);
 			if (ev->_major != CORBA_NO_EXCEPTION
-			    || CORBA_Object_is_nil (new_retval, ev))
+			    || CORBA_Object_is_nil (new_retval, ev)) {
+                                if (ev->_major == CORBA_NO_EXCEPTION) {
+                                        OAF_GeneralError *error = OAF_GeneralError__alloc ();
+                                        char *error_string = g_strdup_printf (
+                                                _("Factory '%s' returned NIL for '%s'"),
+                                                pobj->iid, iid);
+                                        error->description = CORBA_string_dup (error_string);
+                                        CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
+                                                             ex_OAF_GeneralError, error);
+                                        g_free (error_string);
+                                        
+                                }
 				new_retval = CORBA_OBJECT_NIL;
+                        }
 
 			CORBA_Object_release (retval, ev);
 			retval = new_retval;

-- 
 mmeeks gnu org  <><, Pseudo Engineer, itinerant idiot





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]