You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ofbiz.apache.org by "Giulio Speri (Jira)" <ji...@apache.org> on 2022/11/13 14:09:00 UTC

[jira] [Comment Edited] (OFBIZ-9362) Screen rendering error on ViewForumMessage page

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

Giulio Speri edited comment on OFBIZ-9362 at 11/13/22 2:08 PM:
---------------------------------------------------------------

Hi [~arunpati] ,

while searching for the TEMPLATE_TEXT_ONLY issue, I found another thing and I think that this could be the "main" issue.

I found that in the class _ContentServiceComplex.java_ the implementation of the method _getAssocAndContentAndDataResourceCacheMethod_ has changed (I think passing from OFBiz v13.07.03 to OFBiz 16): in particular has changed the entity from which the sub-content is retrieved.

In OFBiz v13, the sub-content was searched in the ContentAssoc entity, while in the newer implementation the have been used the views _ContentAssocDataResourceViewTo/From_ for content retrieval.

The problem in this change is that the fields used to set up the query condition have a different meaning between the entity _ContentAssoc_ and the view _ContentAssocDataResourceViewTo;_ in this "forum  view message" context the contentId passed  in to the method is the main forum contentId and we're looking for its sub-contents (messages).

 

_In OFBiz v13 the code was:_
{code:java}
_if (direction != null && direction.equalsIgnoreCase("From")) {
contentFieldName = "contentIdTo";
} else {_
//WE ARE IN THIS "TO" DIRECTION FOR THE FORUM MESSAGES
contentFieldName = "contentId";
_}
if (direction != null && direction.equalsIgnoreCase("From")) {
viewName = "ContentAssocDataResourceViewFrom";
} else {
   viewName = "ContentAssocDataResourceViewTo";
}_ 
/*
...
query condition preparation
...
...the query is...
*/
contentAssocsUnfiltered = delegator.findByAnd("ContentAssoc", fieldMap, UtilMisc.toList("-fromDate"), true);
/* the query executed had basically the following parameters: 
contentId=<main thread Id> //"thread10021"
mapKey="ARTICLE"
This condition run on the ContentAssoc entity actually returned the sub-content messages, indeed OFBiz v13 had not this NPE issue.
*/{code}
 

while in newer OFbiz versions  (trunk 22 at the moment I am writing, but I think also versions after the 13) the code is:
{code:java}
 if (direction != null && "From".equalsIgnoreCase(direction)) {
    contentF ieldName = "caContentIdTo";
    joinExpr = EntityCondition.makeCondition("caContentIdTo",        EntityOperator.EQUALS, contentId);
 } else {
     contentFieldName = "contentId";
     joinExpr = EntityCondition.makeCondition("contentId", EntityOperator.EQUALS, contentId);
 }
 if (direction != null && "From".equalsIgnoreCase(direction)) {
    viewName = "ContentAssocDataResourceViewFrom";
 } else {
    viewName = "ContentAssocDataResourceViewTo";
 }

/*
...
other query conditions..
..caMapKey = "ARTICLE"
...
...then query on the view...
*/
 List<GenericValue> contentAssocsTypeFiltered = EntityQuery.use(delegator).from(viewName)
                .where(conditionList).orderBy("caSequenceNum", "-caFromDate").cache().queryList();

/* this query is executed on the ContentAssocDataresourceViewTo with:
contentId=<thread content id> //"thread10021"
caMapKey="ARTICLE"

but this query returned 0 results and thus the NPE during screen rendering
*/


{code}
 

I am currently performing some tests and I found a possible solution in changing the condition field for contentId on the view, from "contentId" to "caContentId" (or also contentIdStart) ; that will correctly return the two ARTICLE for the forum.

 

I'll keep testing and I hope to come with a definitive solution soon.

 

Giulio

 

 


was (Author: giulio_mpstyle):
Hi [~arunpati] ,

while searching for the TEMPLATE_TEXT_ONLY issue, I found another thing and I think that this could be the "main" issue.

I found that in the class _ContentServiceComplex.java_ the implementation of the method _getAssocAndContentAndDataResourceCacheMethod_ has changed (I think passing from OFBiz v13.07.03 to OFBiz 16): in particular has changed the entity from which the sub-content is retrieved.

In OFBiz v13, the sub-content was searched in the ContentAssoc entity, while in the newer implementation the have been used the views _ContentAssocDataResourceViewTo/From_ for content retrieval.

The problem in this change is that the fields used to set up the query condition have a different meaning between the entity _ContentAssoc_ and the view _ContentAssocDataResourceViewTo;_ in this "forum  view message" context the contentId passed  in to the method is the main forum contentId and we're looking for its sub-contents (messages).

 

_In OFBiz v13 the code was:_

 
{code:java}

{code}
_if (direction != null && direction.equalsIgnoreCase("From")) \{
   contentFieldName = "contentIdTo";
} else {_
   _//WE ARE IN THIS "TO" DIRECTION FOR THE FORUM MESSAGES_
   _contentFieldName = "contentId";_
_}
if (direction != null && direction.equalsIgnoreCase("From")) \{
   viewName = "ContentAssocDataResourceViewFrom";
} else \{
   viewName = "ContentAssocDataResourceViewTo";
}_ 
_/*_
_..._
_query condition preparation_
_..._
_...the query is..._
_*/_
_contentAssocsUnfiltered = delegator.findByAnd("ContentAssoc", fieldMap, UtilMisc.toList("-fromDate"), true);_

_/* the query executed had basically the following parameters:_ 
_contentId=<main thread Id> //"thread10021"_
_mapKey="ARTICLE"_

_This condition run on the ContentAssoc entity actually returned the sub-content messages, indeed OFBiz v13 had not this NPE issue._

_*/_



 __ 

 

 

 

> Screen rendering error on ViewForumMessage page
> -----------------------------------------------
>
>                 Key: OFBIZ-9362
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-9362
>             Project: OFBiz
>          Issue Type: Bug
>          Components: ecommerce
>            Reporter: Aditya Sharma
>            Assignee: Akash Jain
>            Priority: Trivial
>         Attachments: OFBIz-9362.patch
>
>
> Steps to reproduce:
> 1. Go to Ecommerce component (https://demo-trunk.ofbiz.apache.org/ecommerce/control/main)
> 2. Click on Gizmos from Browse Forum section.(https://demo-trunk.ofbiz.apache.org/ecommerce/control/showforum?forumId=GIZMOS)
> 3. Click on View button (https://demo-trunk.ofbiz.apache.org/ecommerce/control/ViewForumMessage?forumId=GIZMOS&responseContentId=thread10021&threadContentId=thread10021), the message box shows an error message with ScreenRendererException.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)