Batched notification in Chinese language causes Velocity template error which is also included into notification

XMLWordPrintable

    • 8
    • 9
    • Severity 2 - Major
    • 20

      Issue Summary

      Batched notification in Chinese language causes Velocity template error which is also included into notification.

      Steps to Reproduce

      1. Turn on "Batching email notifications" option is enabled (Go to Jira settings > System > Batching notifications)
      2. As a Jira User A, change profile language to Chinese language
      3. As User B, leave a number of comments that trigger batched notification to User A

      Expected Results

      User A receives batched notification that is normally rendered.

      Actual Results

      User A receives batched notification that contains error and stack trace:

      The below exception is thrown in the atlassian-jira.log file:

      2019-04-16 13:39:59,529 Caesium-2-3 ERROR ServiceRunner     [velocity] Exception rendering #parse(/templates/email/batch/html/IssueUpdateBatcher-header.vm) at templates/email/batch/html/IssueUpdateBatcher-content.vm[line 28, column 17]
      2019-04-16 13:39:59,529 Caesium-2-3 ERROR ServiceRunner     [velocity] Exception rendering #parse(templates/email/batch/html/IssueUpdateBatcher-content.vm) at templates/email/batch/html/template.vm[line 18, column 1]
      2019-04-16 13:39:59,529 Caesium-2-3 ERROR ServiceRunner     [velocity] Exception rendering #parse(templates/email/batch/html/template.vm) at getEncodedBodyFromContent[line 2, column 1]
      2019-04-16 13:39:59,529 Caesium-2-3 ERROR ServiceRunner     [c.atlassian.velocity.DefaultVelocityManager] Exception getting message body from Velocity: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getText' in  class com.atlassian.jira.i18n.BackingI18n threw exception java.lang.IllegalArgumentException: can't parse argument number: 0,选择,0#| 1#{0}更新,| 1 <{0}更新, at /templates/email/batch/html/IssueUpdateBatcher-header.vm[line 69, column 45]
      org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getText' in  class com.atlassian.jira.i18n.BackingI18n threw exception java.lang.IllegalArgumentException: can't parse argument number: 0,选择,0#| 1#{0}更新,| 1 <{0}更新, at /templates/email/batch/html/IssueUpdateBatcher-header.vm[line 69, column 45]
              at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:337)
              at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:284)
              at org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReference.java:262)
              at org.apache.velocity.runtime.parser.node.ASTReference.value(ASTReference.java:507)
              at org.apache.velocity.runtime.parser.node.ASTExpression.value(ASTExpression.java:71)
              at org.apache.velocity.runtime.parser.node.ASTSetDirective.render(ASTSetDirective.java:142)
              at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
              at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:87)
              at org.apache.velocity.runtime.parser.node.ASTBlock.render(ASTBlock.java:72)
              at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
              at org.apache.velocity.runtime.parser.node.ASTIfStatement.render(ASTIfStatement.java:106)
              at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
              at org.apache.velocity.runtime.directive.Parse.render(Parse.java:263)
              at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
              at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
              at org.apache.velocity.runtime.directive.Parse.render(Parse.java:263)
              at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
              at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
              at org.apache.velocity.runtime.directive.Parse.render(Parse.java:263)
              at org.apache.velocity.runtime.parser.node.ASTDirective.render(ASTDirective.java:175)
              at org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.java:336)
              at org.apache.velocity.runtime.RuntimeInstance.render(RuntimeInstance.java:1276)
              at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1215)
              at org.apache.velocity.runtime.RuntimeInstance.evaluate(RuntimeInstance.java:1164)
              at org.apache.velocity.app.VelocityEngine.evaluate(VelocityEngine.java:219)
              at com.atlassian.velocity.DefaultVelocityManager.getEncodedBodyForContent(DefaultVelocityManager.java:205)
              at com.atlassian.jira.plugins.inform.batching.rendering.VelocityTemplate.render(VelocityTemplate.java:37)
              at com.atlassian.jira.plugins.inform.batching.rendering.VelocityTemplate.renderContent(VelocityTemplate.java:28)
              at com.atlassian.jira.plugins.inform.batching.BatcherServiceImpl.createEmail(BatcherServiceImpl.java:141)
              at com.atlassian.jira.plugins.inform.batching.cron.BatchNotificationJob.lambda$processEventBatch$3(BatchNotificationJob.java:163)
              at com.atlassian.jira.plugins.inform.performance.MeasurementProducer$MeasureWorkerBuilder$1.measure(MeasurementProducer.java:48)
              at com.atlassian.jira.plugins.inform.batching.cron.BatchNotificationJob.processEventBatch(BatchNotificationJob.java:137)
              at com.atlassian.jira.plugins.inform.batching.cron.BatchNotificationJob.lambda$notifyUsers$1(BatchNotificationJob.java:115)
              at com.atlassian.jira.plugins.inform.performance.MeasurementProducer$MeasureWorkerBuilder$1.measure(MeasurementProducer.java:48)
              at com.atlassian.jira.plugins.inform.batching.cron.BatchNotificationJob.notifyUsers(BatchNotificationJob.java:109)
              at com.atlassian.jira.plugins.inform.batching.cron.BatchNotificationJob.lambda$runJob$0(BatchNotificationJob.java:87)
              at com.atlassian.jira.plugins.inform.performance.MeasurementProducer$MeasureWorkerBuilder$1.measure(MeasurementProducer.java:48)
              at com.atlassian.jira.plugins.inform.batching.cron.BatchNotificationJob.runJob(BatchNotificationJob.java:85)
              at com.atlassian.jira.plugins.inform.batching.cron.ConditionalJobRunner.runJob(ConditionalJobRunner.java:33)
              at com.atlassian.jira.plugins.inform.batching.cron.ConditionalJobRunner.runJob(ConditionalJobRunner.java:33)
              at com.atlassian.jira.plugins.inform.batching.cron.OncePerClusterJobRunner.runJob(OncePerClusterJobRunner.java:46)
              at com.atlassian.scheduler.core.JobLauncher.runJob(JobLauncher.java:134)
              at com.atlassian.scheduler.core.JobLauncher.launchAndBuildResponse(JobLauncher.java:106)
              at com.atlassian.scheduler.core.JobLauncher.launch(JobLauncher.java:90)
              at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.launchJob(CaesiumSchedulerService.java:435)
              at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJob(CaesiumSchedulerService.java:430)
              at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeClusteredJobWithRecoveryGuard(CaesiumSchedulerService.java:454)
              at com.atlassian.scheduler.caesium.impl.CaesiumSchedulerService.executeQueuedJob(CaesiumSchedulerService.java:382)
              at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeJob(SchedulerQueueWorker.java:66)
              at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.executeNextJob(SchedulerQueueWorker.java:60)
              at com.atlassian.scheduler.caesium.impl.SchedulerQueueWorker.run(SchedulerQueueWorker.java:35)
              at java.lang.Thread.run(Thread.java:745)
      Caused by: java.lang.IllegalArgumentException: can't parse argument number: 0,选择,0#| 1#{0}更新,| 1 <{0}更新,
              at java.text.MessageFormat.makeFormat(MessageFormat.java:1429)
              at java.text.MessageFormat.applyPattern(MessageFormat.java:479)
              at java.text.MessageFormat.<init>(MessageFormat.java:380)
              at com.atlassian.jira.i18n.BackingI18n.formatI18nMsg(BackingI18n.java:244)
              at com.atlassian.jira.i18n.BackingI18n.getText(BackingI18n.java:222)
              ... 2 filtered
              at java.lang.reflect.Method.invoke(Method.java:498)
              at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.doInvoke(UberspectImpl.java:385)
              at org.apache.velocity.util.introspection.UberspectImpl$VelMethodImpl.invoke(UberspectImpl.java:374)
              at com.atlassian.velocity.htmlsafe.introspection.AnnotationBoxingMethod.invoke(AnnotationBoxingMethod.java:24)
              at com.atlassian.velocity.htmlsafe.introspection.UnboxingMethod.invoke(UnboxingMethod.java:28)
              at org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java:270)
              ... 50 more
      Caused by: java.lang.NumberFormatException: For input string: "0,选择,0#| 1#{0}更新,| 1 <{0}更新,"
              at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
              at java.lang.Integer.parseInt(Integer.java:580)
              at java.lang.Integer.parseInt(Integer.java:615)
              at java.text.MessageFormat.makeFormat(MessageFormat.java:1427)
              ... 63 more
      
      

      Notes

      Fixed for Romanian language https://jira.atlassian.com/browse/JRASERVER-68890 in 8.1.0, but still affects Chinese language

      Workaround

      • Change user profile language to English, or
      • Turn off "Batching email notifications" feature

        1. screenshot-1.png
          291 kB
          Tzu Hau Chai

            Assignee:
            Artur Pawelczyk (Inactive)
            Reporter:
            Tzu Hau Chai (Inactive)
            Votes:
            8 Vote for this issue
            Watchers:
            23 Start watching this issue

              Created:
              Updated:
              Resolved: