Details
-
Bug
-
Resolution: Fixed
-
Major
-
1.4.1, 1.7 M1
-
None
-
NPE XWikiDocument XML
-
Description
An NPE may occurs during XML conversion at line 2269 of XWikiDocument.java in XWiki 1.4.1, which is currently line 2410 in latest SVN. Here is an excerpt:
// Add Objects (THEIR ORDER IS MOLDED IN STONE!) for (Vector<BaseObject> objects : getxWikiObjects().values()) { for (BaseObject obj : objects) { if (obj != null) { BaseClass objclass = null; here ---> if (obj.getName().equals(obj.getClassName())) { objclass = bclass; } else { objclass = obj.getxWikiClass(context); } docel.add(obj.toXML(objclass)); } } } }
I suggest that this line has to be replace by:
if (getName().equals(obj.getClassName())) {
This should not have any effect if proper naming of object are ensured (see XWIKI-2813), but currently the line says "if the name and classname of an object is the same, take the class of the document", my feeling is that it should say "if the name of the document is the classname of the object than take the class of the document", which is a clearer intend and reduce inter-dependancy
Attachments
Issue Links
- depends on
-
XWIKI-2813 Name of object should always be set to the name of their document
- Closed