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

    • Similar Issues:
      Show 5 results 

      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)

        Activity

        Hide
        Lawrence Lee added a comment -

        Hi Vasile Dirla,

        I was able to reproduce this XSL issue on 6.1.0 CE GA1, but I see that it has since been fixed. I am unable to reproduce this issue on 6.2.0 CE GA1 and later. If you are still seeing XSL template issues in later versions please let me know.

        Thank you for your contribution.

        -Lawrence

        Show
        Lawrence Lee added a comment - Hi Vasile Dirla, I was able to reproduce this XSL issue on 6.1.0 CE GA1, but I see that it has since been fixed. I am unable to reproduce this issue on 6.2.0 CE GA1 and later. If you are still seeing XSL template issues in later versions please let me know. Thank you for your contribution. -Lawrence

          People

          • Assignee:
            Lawrence Lee
            Reporter:
            Vasile Dirla
            Recent user:
            Lawrence Lee
            Participants of an Issue:
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:
              Days since last comment:
              1 year, 8 weeks, 6 days ago

              Development

                Structure Helper Panel