tynamo/tapestry-conversations

<t:conversation.moderator/> throws exception

Closed this issue · 2 comments

Hello,

i'm playing with a very simple test case while using Tapestry 5.4.1.
My index.tml contains <t:conversation.moderator/>, the index class is (stripped):

@Meta("tapestry.persistence-strategy=conversation")
public class Index {
    @Inject
    private ConversationManager conversationManager;

    @Inject
    private ComponentResources componentResources;

    public void onActivate() {
        if (!conversationManager.isActiveConversation(conversationId)) {
            conversationId = conversationManager.createConversation(componentResources.getPageName(), 60, false);
        }
    }
}

This is nearly the sample used in tapestry conversation guide. But when i call the index page, i get this exception:

Caused by: java.lang.IllegalArgumentException: null isn't valid in JSONObject and JSONArray. Use JSONObject.NULL instead.
    at org.apache.tapestry5.json.JSONObject.testValidity(JSONObject.java:793)
    at org.apache.tapestry5.json.JSONArray.put(JSONArray.java:390)
    at org.apache.tapestry5.json.JSONArray.<init>(JSONArray.java:100)
    at org.apache.tapestry5.internal.services.ajax.JavaScriptSupportImpl$InitializationImpl.with(JavaScriptSupportImpl.java:102)
    at org.tynamo.conversations.components.ConversationModerator.afterRender(ConversationModerator.java:98)
    at org.tynamo.conversations.components.ConversationModerator.afterRender(ConversationModerator.java)
    at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AfterRenderPhase.invokeComponent(ComponentPageElementImpl.java:375)
    at org.apache.tapestry5.internal.structure.ComponentPageElementImpl$AbstractPhase.invoke(ComponentPageElementImpl.java:133)

The tapestry error page is showing this part in the session context

**conversations**
    {1477332738073=org.tynamo.conversations.services.Conversation@6e56df15, 1477332731200=org.tynamo.conversations.services.Conversation@d10f144}
**state:Index::conversationId**
    1477332731200
**state:ProgramTime::conversationId**
    1477332738073

The conversation is created, but the rendering of the conversation.moderator fails. But why? Am i'm doing something wrong? But what?

Zabrimus

Looks like that's a bug. Despite claiming compatibility with T5.4, looks like I didn't update the conversationModerator component for T5.4. Been doing similar upgrades lately, so shouldn't take long. I hope to get to it this evening.

Looks like I forgot to update the issue at the time, but I recall finding nothing wrong in the implementation. I now updated the library to T5.5 with some small bug fixes and added conversation.moderator to one of the test pages and all seems to work as expected.