Index: C:/Documents and Settings/gec/workspace/trunks-users/xwiki/core/src/main/java/com/xpn/xwiki/xmlrpc/Page.java =================================================================== --- C:/Documents and Settings/gec/workspace/trunks-users/xwiki/core/src/main/java/com/xpn/xwiki/xmlrpc/Page.java (revision 1953) +++ C:/Documents and Settings/gec/workspace/trunks-users/xwiki/core/src/main/java/com/xpn/xwiki/xmlrpc/Page.java (working copy) @@ -63,13 +63,27 @@ public Page(Hashtable pageht) { super(pageht); - this.setVersion(((Integer)pageht.get("version")).intValue()); + /* + * Check if we want to update or to create a new page. If + * the superclass has set an id not null, we are updateing. + * + * For adding, the Page given as an argument should have space, + * title and content fields at a minimum. + * + * So if we want to create a new page, calls like + * ((Integer)pageht.get("version")).intValue() + * will result in a NullPointerException, becaue + * pageht.get("version") will return null. + */ + if (getId() != null) { + this.setVersion(((Integer)pageht.get("version")).intValue()); + this.setCreated((Date)pageht.get("created")); + this.setCreator((String)pageht.get("creator")); + this.setModified((Date)pageht.get("modified")); + this.setModifier((String)pageht.get("modifier")); + this.setHomepage(((Boolean)pageht.get("homepage")).booleanValue()); + } this.setContent((String)pageht.get("content")); - this.setCreated((Date)pageht.get("created")); - this.setCreator((String)pageht.get("creator")); - this.setModified((Date)pageht.get("modified")); - this.setModifier((String)pageht.get("modifier")); - this.setHomepage(((Boolean)pageht.get("homepage")).booleanValue()); } public Hashtable getHashtable() {