Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: 6.1.0 CE GA1, 6.1.1 CE GA2, 6.1.20 EE GA2
-
Fix Version/s: 6.1.X EE, 6.2.0 CE M2
-
Component/s: WCM, WCM > Web Content Administration
-
Environment:Windows 7, MySQL 5.0, JRE1.6
-
Branch Version/s:6.1.x
-
Backported to Branch:Committed
-
Fix Priority:4
-
Similar Issues:
Description
I am trying to fetch the journal articles using $journalContentUtil variable in velocity.
1. Created two web contents Webcontent1 with default structure, Webcontent2 with user defined structure and templates.
2. Tried to retrieve the Webcontent1 using $journalContentUtil.getContent(10180, '11007', 'view', $themeDisplay.language-id, $xmlrequest) from the template of Webcontent2 and succeeded.
3. Created two web contents Webcontent3,Webcontent4 with two different structures and templates.
4. Tried to retrieve Webcontent3 using $journalContentUtil from the template of Webcontent4 but failed
5. Tried using various overloaded getContent methods in JournalContentUtil class still unable to fetch the article.
6. Also tried fetching the article in JSP but it is returning null.
Note: The templates are included in the web content by parsing VM file in the theme. It is working fine in liferay6.0 CE

This is a valid issue in liferay 6.1 CE, the problem is when JournalContentUtil.getContent() method is called
public static String getContent(long groupId,String articleId,String viewMode,String languageId,ThemeDisplay themeDisplay)
it check whether the article is template driven(if any template is associated with that article), then it called the transformer, it identifies the type of script and calls the respective parserEngine(VelocityTemplateParser)
The populateTemplateContext(TemplateContext tempcontext) method is called, which in turn calls the populateTemplateContext() method of super class BaseTemplateParser
The piece of code the where the problem occurs is populateTemplateContext of BaseTemplateParser.java
protected void populateTemplateContext(TemplateContext templateContext)
throws Exception {
templateContext.put("company", getCompany());
templateContext.put("companyId", getCompanyId());
templateContext.put("device", _themeDisplay.getDevice()); // _themeDisplay object is not initialized, therefore gives null pointer exception