On Jan 28, 2009, at 6:28 AM, sdumitriu (SVN) wrote:
Author: sdumitriu Date: 2009-01-28 06:28:25 +0100 (Wed, 28 Jan 2009) New Revision: 15808
Modified: platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/api/ Document.java Log: XWIKI-3168: Changing the document syntax without saving the document can cause an invalid document state Fixed.
Modified: platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/ api/Document.java =================================================================== --- platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/api/ Document.java 2009-01-27 23:34:55 UTC (rev 15807) +++ platform/core/trunk/xwiki-core/src/main/java/com/xpn/xwiki/api/ Document.java 2009-01-28 05:28:25 UTC (rev 15808) @@ -273,6 +273,15 @@ }
/** + * @return the Syntax id representing the syntax used for the current document. For example "xwiki/1.0" represents + * the first version XWiki syntax while "xwiki/2.0" represents version 2.0 of the XWiki Syntax. + */ + public String getSyntaxId() + { + return this.doc.getSyntaxId();
should this be getDoc().getSyntaxId()? Should all methods use getDoc() instead of this.doc?
+ } + + /** * return the language of the document if it's a traduction, otherwise, it return default */ public String getLanguage() @@ -1498,6 +1507,10 @@ getDoc().setContent(content); }
+ /** + * @param syntaxId the Syntax id representing the syntax used for the current document. For example "xwiki/1.0" represents + * the first version XWiki syntax while "xwiki/2.0" represents version 2.0 of the XWiki Syntax. + */ public void setSyntaxId(String syntaxId) { getDoc().setSyntaxId(syntaxId); @@ -1900,15 +1913,6 @@ }
/** - * @return the Syntax id representing the syntax used for the current document. For example "xwiki/1.0" represents - * the first version XWiki syntax while "xwiki/2.0" represents version 2.0 of the XWiki Syntax. - */ - public String getSyntaxId() - { - return this.doc.getSyntaxId(); - } - - /** * Convert the current document content from its current syntax to the new syntax passed as parameter. * * @param targetSyntaxId the syntax to convert to (eg "xwiki/ 2.0", "xhtml/1.0", etc) @@ -1917,7 +1921,7 @@ public boolean convertSyntax(String targetSyntaxId) throws XWikiException { try { - this.doc.convertSyntax(targetSyntaxId); + getDoc().convertSyntax(targetSyntaxId); } catch (Exception ex) { return false; }
Thanks -Vincent http://xwiki.com http://xwiki.org http://massol.net