On Thu, Nov 5, 2009 at 21:09, Vincent Massol <vincent(a)massol.net> wrote:
On Nov 5, 2009, at 7:14 PM, tmortagne (SVN) wrote:
Author: tmortagne
Date: 2009-11-05 19:14:43 +0100 (Thu, 05 Nov 2009)
New Revision: 24882
Added:
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/
resources/link/links24.test
Modified:
platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/
java/org/xwiki/rendering/internal/renderer/xhtml/
DefaultXHTMLLinkRenderer.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/
java/org/xwiki/rendering/SimpleRenderingTests.java
platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/test/
java/org/xwiki/rendering/WikiRenderingTests.java
Log:
XWIKI-4554: NPE occurs when there is no WikiModel implementation
registered
Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-api/
src/main/java/org/xwiki/rendering/internal/renderer/xhtml/
DefaultXHTMLLinkRenderer.java
===================================================================
--- platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/
java/org/xwiki/rendering/internal/renderer/xhtml/
DefaultXHTMLLinkRenderer.java 2009-11-05 17:25:33 UTC (rev 24881)
+++ platform/core/trunk/xwiki-rendering/xwiki-rendering-api/src/main/
java/org/xwiki/rendering/internal/renderer/xhtml/
DefaultXHTMLLinkRenderer.java 2009-11-05 18:14:43 UTC (rev 24882)
@@ -157,7 +157,7 @@
*/
public void beginLink(Link link, boolean isFreeStandingURI,
Map<String, String> parameters)
{
- if (link.isExternalLink()) {
+ if (this.wikiModel == null || link.isExternalLink()) {
beginExternalLink(link, isFreeStandingURI, parameters);
} else {
beginInternalLink(link, isFreeStandingURI, parameters);
@@ -188,7 +188,7 @@
if (link.getType() == LinkType.INTERWIKI) {
// TODO: Resolve the Interwiki link
} else {
- if ((link.getType() == LinkType.URI) &&
link.getReference().startsWith(ATTACH)) {
+ if (this.wikiModel != null && link.getType() ==
LinkType.URI && link.getReference().startsWith(ATTACH)) {
// use the default attachment syntax parser to
extract document name and attachment name
Attachment attachment =
this
.attachmentParser
.parse(link.getReference().substring(ATTACH.length()));
aAttributes.put(HREF,
this.wikiModel.getAttachmentURL(attachment.getDocumentName(),
Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/
src/test/java/org/xwiki/rendering/SimpleRenderingTests.java
===================================================================
--- platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/
test/java/org/xwiki/rendering/SimpleRenderingTests.java 2009-11-05
17:25:33 UTC (rev 24881)
+++ platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/
test/java/org/xwiki/rendering/SimpleRenderingTests.java 2009-11-05
18:14:43 UTC (rev 24882)
@@ -210,6 +210,9 @@
suite.addTestsFromResource("misc/misc7", false);
suite.addTestsFromResource("encoding/encoding1", false);
+ // Links without WikiModel
+ suite.addTestsFromResource("link/links24", false);
+
return new ComponentManagerTestSetup(suite);
}
}
Modified: platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/
src/test/java/org/xwiki/rendering/WikiRenderingTests.java
===================================================================
--- platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/
test/java/org/xwiki/rendering/WikiRenderingTests.java 2009-11-05
17:25:33 UTC (rev 24881)
+++ platform/core/trunk/xwiki-rendering/xwiki-rendering-tests/src/
test/java/org/xwiki/rendering/WikiRenderingTests.java 2009-11-05
18:14:43 UTC (rev 24882)
@@ -75,8 +75,6 @@
suite.addTestsFromResource("image/image3", false);
suite.addTestsFromResource("image/image4", false);
suite.addTestsFromResource("image/image5", false);
-
- suite.addTestsFromResource("link/links18", false);
I haven't checked the sources but is it normal that this is removed?
Was it a leftover from before?
Thanks
-Vincent
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs