vmassol (SVN) wrote:
Author: vmassol
Date: 2009-02-22 20:24:02 +0100 (Sun, 22 Feb 2009)
New Revision: 16991
Modified:
platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
platform/core/branches/xwiki-core-1.8/xwiki-core/src/test/java/com/xpn/xwiki/doc/XWikiDocumentTest.java
Log:
XWIKI-3228: Error while saving xwiki 2.0 documents containing anchor links
Fixed bugs introduced in rev 16482 (XWIKI-281) for XWiki Syntax 2.0. The underlying code
is pretty flaky and there are other potential errors in the code...
Merged from trunk (rev 16990)
Modified:
platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java
===================================================================
---
platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java 2009-02-22
18:11:58 UTC (rev 16990)
+++
platform/core/branches/xwiki-core-1.8/xwiki-core/src/main/java/com/xpn/xwiki/doc/XWikiDocument.java 2009-02-22
19:24:02 UTC (rev 16991)
+ // Verify that the link is not an
autolink (i.e. a link to the current document) and only add
+ // if the link is not already in the list.
+ // TODO: Would be better to use a Set instead of a Link but this
needs to change the API and I'm
s/Link/List
Also, can't you use a Set internally and transform it to a list at the
end? Does a Set provide better performance than List.contains?
+ // not ready to risk this right
now: Vincent Massol, 22/02/2009 close to the 1.8RC2 release...
+ if (!document.getFullName().equals(getFullName()) &&
!pageNames.contains(document.getFullName())) {
+ pageNames.add(document.getFullName());
+ }
--
Sergiu Dumitriu
http://purl.org/net/sergiu/