toXML() (which is called by toString()) on a BaseObject may throw a "java.lang.IllegalArgumentException: Adding text to an XML document must not be null" if it is not yet linked to a document and its name has not been set.
This may be annoying since, for example, current release of Groovy may calls toString() when it prepare the message of exceptions about an object. This cause a double exception, that is not properly chained, and hide the initial cause. Moreover, it is almost impossible to catch the real cause in groovy. Triggering this situation could be done in groovy by creating an object from BaseClass.newObject() and then calling an unexistant method on it.