Uploaded image for project: 'PUBLIC - Liferay Portal Community Edition'
  1. PUBLIC - Liferay Portal Community Edition
  2. LPS-25730

Journal Portlet - XSL article templates are not working. (No content is displayed)

    Details

      Description

      After debugging I've found that this issue is caused by:

      in the class: com.liferay.portlet.journal.util.XSLTemplateParser

      the _transformerFactory is never set so it will be always null and a NPE will be thrown when the XSL Template is evaluated.

      Curent SVN code (23 feb 2012):

      com.liferay.portlet.journal.util.XSLTemplateParser
       
       private TransformerFactory _getTransformerFactory() {
      		if (_transformerFactory == null) {
      			TransformerFactory transformerFactory =
      				TransformerFactory.newInstance();
      
      			transformerFactory.setErrorListener(_getXSLErrorListener());
      			transformerFactory.setURIResolver(
      				new URIResolver(getTokens(), getLanguageId()));
      		}
      
      		return _transformerFactory;
      	}
      

      My suggestion:

      com.liferay.portlet.journal.util.XSLTemplateParser (patched)
       private TransformerFactory _getTransformerFactory() {
      		if (_transformerFactory == null) {
      			_transformerFactory  =
      				TransformerFactory.newInstance();
      
      			_transformerFactory.setErrorListener(_getXSLErrorListener());
      			_transformerFactory.setURIResolver(
      				new URIResolver(getTokens(), getLanguageId()));
      		}
      
      		return _transformerFactory;
      	}
      

      Also I noticed that the method:

       protected boolean mergeTemplate(
      			TemplateContext templateContext,
      			UnsyncStringWriter unsyncStringWriter) 
      

      is always returning 'false' so this method was adjusted also in order to return true if no error occurs and false in case of a failure.

      I attached a patched version of the file. (see: XSLTemplateParser.java)

        Attachments

          Activity

            People

            • Assignee:
              lawrence.lee Lawrence Lee
              Reporter:
              vasile.dirla Vasile Dirla
              Participants of an Issue:
              Recent user:
              Esther Sanz
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Days since last comment:
                3 years, 15 weeks, 1 day ago