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

Unable to parse version of user-agent where the version is at the end of the string and only contains a major version

    Details

      Description

      Steps to Reproduce

      1. Start the portal
      2. Send a request to the portal with a user-agent string of the following (through Postman or something similar):

      Mozilla/5.0 (iPhone; CPU iPhone OS 13_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Safari IPhoneAppVersion/2.6.87 IPhoneWebkitWrapper BillingSupported iphoneAppVersion/2.6.87 rv:1
      

      Expected Results
      There are no errors in the logs.

      Actual Results
      The following error appears in the logs:

      2019-10-14 18:41:23.373 ERROR [http-nio-8080-exec-2][IncludeTag:128] Current URL / generates exception: String index out of range: 206
      java.lang.StringIndexOutOfBoundsException: String index out of range: 206
      	at java.lang.String.charAt(String.java:658)
      	at com.liferay.portal.servlet.BrowserSnifferImpl.parseVersion(BrowserSnifferImpl.java:328)
      	at com.liferay.portal.servlet.BrowserSnifferImpl.getRevision(BrowserSnifferImpl.java:88)
      	at com.liferay.portal.kernel.servlet.BrowserSnifferUtil.getRevision(BrowserSnifferUtil.java:50)
      	at org.apache.jsp.html.common.themes.top_005fhead_jsp._jspService(top_005fhead_jsp.java:1006)
      	at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      	at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
      	at com.liferay.portal.servlet.DirectRequestDispatcher.include(DirectRequestDispatcher.java:64)
      	at com.liferay.portal.servlet.DirectRequestDispatcherFactoryImpl$IndirectRequestDispatcher.include(DirectRequestDispatcherFactoryImpl.java:199)
      	at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:79)
      	at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.include(ClassLoaderRequestDispatcherWrapper.java:53)
      	at com.liferay.taglib.util.IncludeTag.includePage(IncludeTag.java:398)
      	at com.liferay.taglib.util.IncludeTag.include(IncludeTag.java:374)
      	at com.liferay.taglib.util.IncludeTag.doInclude(IncludeTag.java:217)
      	at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:88)
      	at freemarker.ext.jsp.TagTransformModel$TagWriter.endEvaluation(TagTransformModel.java:400)
      	at freemarker.ext.jsp.TagTransformModel$TagWriter.afterBody(TagTransformModel.java:388)
      	at freemarker.core.Environment.visitAndTransform(Environment.java:427)
      	at freemarker.core.UnifiedCall.accept(UnifiedCall.java:107)
      	at freemarker.core.Environment.visit(Environment.java:324)
      

        Attachments

          Activity

            People

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

              Dates

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

                Packages

                Version Package
                7.1.X
                7.2.X
                Master