Uploaded image for project: 'Confluence Data Center'
  1. Confluence Data Center
  2. CONFSERVER-59540

Using Confluence With Google Chrome In Spanish Causes Errors In Logs

XMLWordPrintable

      Issue Summary

      Whilst using Google Chrome configured with Spanish (Latin America) as the primary language, there are situations where an error may be seen in the logs indicating the es-419 is not a valid language tag. This issue is similar to that seen in CONFSERVER-29922 which was fixed, but there are some additional scenarios where this issue arises.

      Environment Notes

      • Google Chrome with the top language set to Spanish (Latin America)

      Steps to Reproduce

      Scenario 1

      1. Install the Confluence Source Editor Plugin
      2. Using Google Chrome, change the top language in Chrome to Spanish (Latin America)
      3. Make a new page in Confluence
      4. Edit the Page using the source editor, and submit a change

      Submitting the change in the source editor will result in an error in the logs.

      Scenario 2

      1. Install the Confluence Source Editor Plugin
      2. Using Google Chrome, change the top language in Chrome to Spanish (Latin America)
      3. Edit a page, leaving the editor open
      4. In a seperate tab, navigate to Confluence and log out

      The editor tab will continue to poll back to Confluence every 30 seconds resulting in an error in the logs.

      Expected Results

      No 'es-419, is not a valid language tag' error in the logs

      Actual Results

      Currently the error gets generated when we add this content.
      The below exception is thrown in the catalina.out file:

      Scenario 1
      27-Feb-2020 23:40:33.723 SEVERE [http-nio-8090-exec-3] com.sun.jersey.spi.container.ContainerResponse.logException Mapped exception to response: 500 (Internal Server Error)
       javax.ws.rs.WebApplicationException: java.text.ParseException: String, es-419, is not a valid language tag
      	at com.sun.jersey.server.impl.model.HttpHelper.clientError(HttpHelper.java:273)
      	at com.sun.jersey.server.impl.model.HttpHelper.getAcceptLanguage(HttpHelper.java:228)
      	at com.sun.jersey.server.impl.VariantSelector.selectVariant(VariantSelector.java:290)
      	at com.sun.jersey.spi.container.ContainerRequest.selectVariant(ContainerRequest.java:696)
      	at com.sun.jersey.spi.container.AdaptingContainerRequest.selectVariant(AdaptingContainerRequest.java:286)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:498)
      	at com.sun.jersey.server.impl.application.WebApplicationImpl$2.invoke(WebApplicationImpl.java:301)
      	at com.sun.proxy.$Proxy2631.selectVariant(Unknown Source)
      	at com.atlassian.plugins.rest.common.Status.variantFor(Status.java:304)
      	at com.atlassian.plugins.rest.common.error.jersey.NotFoundExceptionMapper.toResponse(NotFoundExceptionMapper.java:21)
      	at com.atlassian.plugins.rest.common.error.jersey.NotFoundExceptionMapper.toResponse(NotFoundExceptionMapper.java:16)
      	at com.sun.jersey.spi.container.ContainerResponse.mapException(ContainerResponse.java:480)
      	at com.sun.jersey.spi.container.ContainerResponse.mapWebApplicationException(ContainerResponse.java:444)
      	at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1475)
      	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
      	at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
      	at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
      	at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558)
      ...
      Caused by: java.text.ParseException: String, es-419, is not a valid language tag
      ...
      
      Scenario 2
      24-Jun-2020 02:19:54.975 SEVERE [http-nio-8090-exec-7] com.sun.jersey.spi.container.ContainerResponse.mapException Exception mapper com.atlassian.plugins.rest.common.error.jersey.NotFoundExceptionMapper@23a32b83 for Throwable com.sun.jersey.api.NotFoundException: null for uri: http://confluence/rest/experimental/relation/touched/from/user/current/to/content/7864323?targetStatus=current threw a RuntimeException when attempting to obtain the response
      24-Jun-2020 02:19:54.975 SEVERE [http-nio-8090-exec-7] com.sun.jersey.spi.container.ContainerResponse.logException Mapped exception to response: 500 (Internal Server Error)
      	javax.ws.rs.WebApplicationException: java.text.ParseException: String, es-419, is not a valid language tag
      		at com.sun.jersey.server.impl.model.HttpHelper.clientError(HttpHelper.java:273)
      		at com.sun.jersey.server.impl.model.HttpHelper.getAcceptLanguage(HttpHelper.java:228)
      		at com.sun.jersey.server.impl.VariantSelector.selectVariant(VariantSelector.java:290)
      		at com.sun.jersey.spi.container.ContainerRequest.selectVariant(ContainerRequest.java:696)
      		at com.sun.jersey.spi.container.AdaptingContainerRequest.selectVariant(AdaptingContainerRequest.java:286)
      		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      		at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      		at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      		at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      		at com.sun.jersey.server.impl.application.WebApplicationImpl$2.invoke(WebApplicationImpl.java:301)
      		at com.sun.proxy.$Proxy2975.selectVariant(Unknown Source)
      		at com.atlassian.plugins.rest.common.Status.variantFor(Status.java:304)
      		at com.atlassian.plugins.rest.common.error.jersey.NotFoundExceptionMapper.toResponse(NotFoundExceptionMapper.java:21)
      		at com.atlassian.plugins.rest.common.error.jersey.NotFoundExceptionMapper.toResponse(NotFoundExceptionMapper.java:16)
      		at com.sun.jersey.spi.container.ContainerResponse.mapException(ContainerResponse.java:480)
      		at com.sun.jersey.spi.container.ContainerResponse.mapWebApplicationException(ContainerResponse.java:444)
      		at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1475)
      		at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1419)
      		at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1409)
      		at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:409)
      		at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:558)
      		at com.atlassian.plugins.rest.module.RestDelegatingServletFilter$JerseyOsgiServletContainer.doFilter(RestDelegatingServletFilter.java:162)
      		...
      		at com.atlassian.plugins.rest.module.servlet.RestServletUtilsUpdaterFilter.doFilter(RestServletUtilsUpdaterFilter.java:34)
      		...
      		at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
      		at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
      		at java.base/java.lang.Thread.run(Thread.java:834)
      	Caused by: java.text.ParseException: String, es-419, is not a valid language tag
      		at com.sun.jersey.core.header.LanguageTag.parse(LanguageTag.java:122)
      		at com.sun.jersey.core.header.AcceptableLanguageTag.<init>(AcceptableLanguageTag.java:69)
      		at com.sun.jersey.core.header.reader.HttpHeaderReader$8.create(HttpHeaderReader.java:434)
      		at com.sun.jersey.core.header.reader.HttpHeaderReader$8.create(HttpHeaderReader.java:432)
      		at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:481)
      		at com.sun.jersey.core.header.reader.HttpHeaderReader.readList(HttpHeaderReader.java:473)
      		at com.sun.jersey.core.header.reader.HttpHeaderReader.readAcceptableList(HttpHeaderReader.java:452)
      		at com.sun.jersey.core.header.reader.HttpHeaderReader.readAcceptLanguage(HttpHeaderReader.java:439)
      		at com.sun.jersey.server.impl.model.HttpHelper.getAcceptLanguage(HttpHelper.java:226)
      		... 308 more
      

      Workaround

      Currently there is no way to mitigate this issue directly within Confluence.

      It is possible to work around the issue at the load balancer/reverse proxy level using a rewrite rule. The header provided by Chrome will look similar to

      accept-language String
      Accept-Language: es-419,es;q=0.9,en-GB;q=0.8,en-US;q=0.7,en;q=0.6
      

      The required pseudo code rewrite rule is

      Pseudo Code Rewrite Rule
      IF (accept-language.contains("es-419"))
          accept-language = accept-language.replace("es-419", "es")
      

      This removes the es-419 tag leaving only the es tag, whilst maintaining other language settings.
      This may change the Spanish dialect on pages received by Spanish (Latin America) users.

              5e496a614b63 Diclehan Erdal
              9d9b0f94d2fe Brian Johnson (Inactive)
              Votes:
              12 Vote for this issue
              Watchers:
              28 Start watching this issue

                Created:
                Updated:
                Resolved: