You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jspwiki.apache.org by "Ichiro Furusato (JIRA)" <ji...@apache.org> on 2014/02/25 11:12:30 UTC

[jira] [Commented] (JSPWIKI-822) NPE thrown by PluginContext#getText()

    [ https://issues.apache.org/jira/browse/JSPWIKI-822?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13911442#comment-13911442 ] 

Ichiro Furusato commented on JSPWIKI-822:
-----------------------------------------

I have patched my own copy with the recommended (context == null) check and I'm as expected seeing the "No WikiContext available: INTERNAL ERROR" message.

I wasn't sure if the missing WikiContext might itself be a bug, as that is happening within my own use of the WikiForms feature, so I'm hesitant to lay blame on the JSPWiki code (hence I'm providing this as a comment rather than in the body of the issue). But if anyone knows this part of the plugin handling better than I might keep an eye out for *why* the context is null -- I couldn't determine that. 

This bug occurred while using a relatively straightforward WikiForms example, so anyone else using forms might see this occur after a 2.10.x upgrade. I do realise that the WikiForms code hasn't had a lot of attention for awhile and is probably not a high priority.


> NPE thrown by PluginContext#getText()
> -------------------------------------
>
>                 Key: JSPWIKI-822
>                 URL: https://issues.apache.org/jira/browse/JSPWIKI-822
>             Project: JSPWiki
>          Issue Type: Bug
>          Components: Plugins
>    Affects Versions: 2.10
>         Environment: Ubuntu Linux 12.10, JDK 7 (but bug is independent of environment)
>            Reporter: Ichiro Furusato
>            Priority: Minor
>             Fix For: 2.10.1
>
>   Original Estimate: 0.25h
>  Remaining Estimate: 0.25h
>
> In previous versions of JSPWiki there was a null check in PluginContent#getText() to make sure that 
>   WikiContext context = doc.getContext(); 
> actually returns a WikiContext. In certain cases (e.g., WikiForms) the context can get lost, so that the subsequent call on line 150
>   Boolean wysiwygVariable = (Boolean) context.getVariable(RenderingManager.WYSIWYG_EDITOR_MODE);
> throws an NPE. I would recommend reinstating the earlier check from JSPWiki 2.9.x:
>    if( context == null )
>             return "No WikiContext available: INTERNAL ERROR";
> or perhaps an improvement. As is, the NPE results (from the user's perspective) in empty wiki page.



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)