After quite a bit exploring, bringing a recompiled version into mine and
debugging.
It appears that:
- DefaultExcution.getContext is very commonly called with an empty stack
field... hence returns null
- the one that interests us, and where it breaks, happens in yet a more
difficult place than what you've been telling, I feel: the
ConversionFilter. From what I could see inside there, it calls to
XhtmlParser.parse that creates the exception. At this point calls to
CurrentEntityReferenceValueProvider seem to be without context.
Is this conversion done on the fly in a filter too in modern XWikis?
As this is called on the velocity page CreateResources/AssetDone, how
would the xhtml conversion filter perform any entity-resolution of
images if it does not know the page that the context would carry?
A parameter, pageName, would be available here. But is this the standard
that would be applied there?
I seem to understand that this is causing our bug, which only appears if
we have attached images whereas external images work fine.
If this is right, either there's a clean adjustment here, to inject the
page context properly for the conversion, or I'll use workaround with
code within my velocity page, after javascript has made these images
become "external" ones.
thanks
paul
On 29/03/15 11:28, Marius Dumitru Florea wrote:
From the stack trace, the cause of the failure seems
to be that there
is no ExecutionContext set on the Execution component [1]. On which
request is this stack trace logged? Is it a GWT-RPC request? In this
case the Execution is initialized by XWikiContextInitializationFilter
[2] which calls ServletContainerInitializer#initializeRequest() where
a new ExecutionContext is put on the Execution [3]. Otherwise, for an
action request (save, preview, etc.) the ExecutionContext is
initialized in XWikiAction [4].
If the ExecutionContext is properly initialized then it means some
code removes it from the Execution afterwards. Putting some
breakpoints in DefaultExecution [5] should catch this code.
Hope this helps,
Marius
[1]
https://github.com/xwiki/xwiki-platform/blob/xwiki-platform-3.5.1/xwiki-pla…
[2]
https://github.com/xwiki/xwiki-platform/blob/xwiki-platform-3.5.1/xwiki-pla…
[3]
https://github.com/xwiki/xwiki-platform/blob/xwiki-platform-3.5.1/xwiki-pla…
[4]
https://github.com/xwiki/xwiki-platform/blob/xwiki-platform-3.5.1/xwiki-pla…
[5]
https://github.com/xwiki/xwiki-commons/blob/xwiki-commons-3.5.1/xwiki-commo…
On Sat, Mar 28, 2015 at 2:37 AM, Paul Libbrecht <paul(a)hoplahup.net> wrote:
Hello XWiki experts,
in Curriki, we met a bug that seems related to the wysiwyg editor's
ability to accept html.
When it does so, and is input with an image, it fails the html
conversion because of the exception below for the simple (cleaned) content:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html><head></head><body><p>Image</p><p><!--startimage:false|-|attach|-|sunset-dark2.PNG--><img
alt="sunset-dark2.PNG"
src="http://node1.hoplahup.net/xwiki/bin/download/AssetTemp/dgW1kVv9l2…
Yielding the exception:
Caused by: java.lang.NullPointerException: null
at
com.xpn.xwiki.doc.DefaultDocumentAccessBridge.getContext(DefaultDocumentAccessBridge.java:85)
~[xwiki-platform-legacy-oldcore-3.5.1.jar:na]
at
com.xpn.xwiki.doc.DefaultDocumentAccessBridge.getAttachmentURL(DefaultDocumentAccessBridge.java:847)
~[xwiki-platform-legacy-oldcore-3.5.1.jar:na]
at
org.xwiki.rendering.internal.wiki.XWikiWikiModel.getLinkURL(XWikiWikiModel.java:137)
~[xwiki-platform-rendering-xwiki-3.5.1.jar:na]
at
org.xwiki.rendering.internal.wiki.XWikiWikiModel.getImageURL(XWikiWikiModel.java:153)
~[xwiki-platform-rendering-xwiki-3.5.1.jar:na]
at
org.xwiki.rendering.internal.renderer.xhtml.image.DefaultXHTMLImageRenderer.onImage(DefaultXHTMLImageRenderer.java:120)
~[xwiki-rendering-syntax-xhtml-3.5.1.jar:na]
at
org.xwiki.rendering.internal.renderer.xhtml.XHTMLChainingRenderer.onImage(XHTMLChainingRenderer.java:545)
~[xwiki-rendering-syntax-xhtml-3.5.1.jar:na]
at
org.xwiki.rendering.listener.chaining.AbstractChainingListener.onImage(AbstractChainingListener.java:454)
~[xwiki-rendering-api-3.5.1.jar:na]
at
org.xwiki.rendering.listener.chaining.AbstractChainingListener.onImage(AbstractChainingListener.java:454)
~[xwiki-rendering-api-3.5.1.jar:na]
at
org.xwiki.rendering.listener.chaining.EmptyBlockChainingListener.onImage(EmptyBlockChainingListener.java:600)
~[xwiki-rendering-api-3.5.1.jar:na]
at
org.xwiki.rendering.listener.chaining.AbstractChainingListener.onImage(AbstractChainingListener.java:454)
~[xwiki-rendering-api-3.5.1.jar:na]
at
org.xwiki.rendering.listener.chaining.BlockStateChainingListener.onImage(BlockStateChainingListener.java:796)
~[xwiki-rendering-api-3.5.1.jar:na]
I am not too sure how to debug that.
Clues would be welcome.
thanks in advance.
Paul
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs
_______________________________________________
devs mailing list
devs(a)xwiki.org
http://lists.xwiki.org/mailman/listinfo/devs