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

LikeKeywordAnalyzer cannot be instantiated with Assertions enabled

    Details

      Description

      The class com.liferay.portal.search.lucene.LikeKeywordAnalyzer and com.liferay.portal.search.lucene.PerFieldAnalyzer cannot be instantiated with Java Assertions enabled (-ea).

      Liferay uses Lucene 3.5 in 6.1.30, where the org.apache.lucene.analysis.Analyzer class checks for certain methods being declared final. Those methods are not declared final in LikeKeywordAnalyzer.

      Lucene Javadoc (http://lucene.apache.org/core/3_5_0/api/core/org/apache/lucene/analysis/Analyzer.html) says the followings:

      The Analyzer-API in Lucene is based on the decorator pattern. Therefore all non-abstract subclasses must be final or their tokenStream(java.lang.String, java.io.Reader) and reusableTokenStream(java.lang.String, java.io.Reader) implementations must be final! This is checked when Java assertions are enabled.

      If you start Liferay with assertion enabled, then an java.lang.AssertionError will be thrown and the portal won't work correctly.

      The issue is the same the branches and on trunk.

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Due:
                  Created:
                  Updated:
                  Resolved:
                  Days since last comment:
                  5 years, 10 weeks ago

                  Packages

                  Version Package
                  6.1.X EE
                  6.2.2 CE GA3
                  6.2.X EE
                  7.0.0 M3