for (Enumeration en = ec.deletedObjects().objectEnumerator(); en.hasMoreElements();)
for (Enumeration en = ec.deletedObjects().objectEnumerator(); en.hasMoreElements();) { buffer.append('\n');
    public void editingContextWillSaveChanges(EOEditingContext ec) throws Throwable {        try {            if (cat.isDebugEnabled()) cat.debug("EditingContextWillSaveChanges: start calling will*");                        _isInWillSaveChanges=true;                                  if (ec != null && ec.hasChanges()) {                NSNotificationCenter.defaultCenter().postNotification(ERXExtensions.objectsWillChangeInEditingContext, ec);                // Changed objects                if (ec.updatedObjects()!=null && ec.updatedObjects().count()>0) {                    for (Enumeration e = ec.updatedObjects().objectEnumerator(); e.hasMoreElements();) {                        EOEnterpriseObject eo = (EOEnterpriseObject)e.nextElement();                        if (eo instanceof ERXGenericRecord)                            ((ERXGenericRecord)eo).willUpdate();                    }                }                // Deleted objects                if (ec.deletedObjects()!=null && ec.deletedObjects().count()>0) {                    for (Enumeration e = ec.deletedObjects().objectEnumerator(); e.hasMoreElements();) {                        EOEnterpriseObject eo = (EOEnterpriseObject)e.nextElement();                        if (eo instanceof ERXGenericRecord)                            ((ERXGenericRecord)eo).willDelete();                    }                                    }                // Inserted objects                if (ec.insertedObjects()!=null && ec.insertedObjects().count()>0) {                    for (Enumeration e = ec.insertedObjects().objectEnumerator(); e.hasMoreElements();) {                        EOEnterpriseObject eo = (EOEnterpriseObject)e.nextElement();                        if (eo instanceof ERXGenericRecord && !ec.deletedObjects().containsObject(eo))                            ((ERXGenericRecord)eo).willInsert();                    }                }                                if (cat.isDebugEnabled()) cat.debug("EditingContextWillSaveChanges: done calling will*");                if (catMod.isDebugEnabled()) {                    if (ec.updatedObjects()!=null) catMod.debug("** Updated Objects "+ec.updatedObjects().count()+" - "+ec.updatedObjects());                    if (ec.insertedObjects()!=null) catMod.debug("** Inserted Objects "+ec.insertedObjects().count()+" - "+ec.insertedObjects());                    if (ec.deletedObjects()!=null) catMod.debug("** Deleted Objects "+ec.deletedObjects().count()+" - "+ec.deletedObjects());                }            }        } catch (Throwable e) {            if (cat.isDebugEnabled()) // i want this stack trace shown in one of the two categories, but not both                cat.debug("Stack Trace:\n" + ERXUtilities.stackTrace(e));            else if (catMod.isDebugEnabled())                catMod.debug("Stack Trace:\n" + ERXUtilities.stackTrace(e));            try {                StringBuffer buffer = new StringBuffer();                buffer.append("The following exception has occurred with ec: " + ec + "\n" + ERXUtilities.stackTrace(e) + "\n");                if (ec.updatedObjects()!=null) {                    buffer.append("** Updated Objects "+ec.updatedObjects().count());                    for (Enumeration en = ec.updatedObjects().objectEnumerator(); en.hasMoreElements();)                        buffer.append("\n" + toDebugString((EOEnterpriseObject)en.nextElement()));                }                if (ec.insertedObjects()!=null) {                    buffer.append("\n** Inserted Objects "+ec.insertedObjects().count());                    for (Enumeration en = ec.insertedObjects().objectEnumerator(); en.hasMoreElements();)                        buffer.append(toDebugString((EOEnterpriseObject)en.nextElement()));                }                if (ec.deletedObjects()!=null) {                    buffer.append("\n** Deleted Objects "+ec.deletedObjects().count());                    for (Enumeration en = ec.deletedObjects().objectEnumerator(); en.hasMoreElements();)                        buffer.append(toDebugString((EOEnterpriseObject)en.nextElement()));                }                catMod.error(buffer);            } catch (Throwable e2) {                cat.error("Caught "+e2+" trying to print editing context state");            } finally {                _isInWillSaveChanges=false;                            }            throw e;        } finally {            _isInWillSaveChanges=false;        }    }