Uploaded image for project: 'Xporter for Jira'
  1. Xporter for Jira
  2. XPORTER-4496

PatternSyntaxException when template uses nested Xray iterator TestExecutions[n].TestRuns[n].<field>

    XporterXMLWordPrintable

Details

    • Bug
    • Status: Open
    • Medium
    • Resolution: Unresolved
    • Xporter DC 7.4.5
    • Continuous Delivery
    • Xray Integration
    • None
    • jira11

    • UNCOVERED

    Description

      Summary

      When a template contains a nested Xray iterator mapping of the form
      TestExecutions[n].TestRuns[n].<field>, Xporter builds an *internal regex
      pattern* with a stray closing parenthesis. The resulting
      PatternSyntaxException aborts the "getting test plans info from Xray"
      pipeline, which silently breaks any data resolved through that path
      (Pre-Conditions, linked Tests, embedded images/attachments coming from
      Xray-related issues).

      The user-facing template syntax is correct; the malformed pattern is generated
      internally by the mapping engine.

      Environment

      • Xporter for Jira 7.4.3-j10
      • Jira Data Center 10.3.8 (Java 17)
      • Xray DC (any recent version)

      Steps to reproduce

      1. Have a Test Plan with at least one Test Execution that contains Test Runs.
      2. Create a Xporter template that includes a nested mapping such as:
        #{for TestExecutions}
           #{for TestRuns}
               ${TestExecutions[n].TestRuns[n].Key}
           #{end}
        #{end}
        
      3. Trigger the export against the Test Plan issue.
      4. Inspect atlassian-jira.log (DEBUG on com.xpandit.plugins.xporter is enough).

      Expected behaviour

      The template renders the Test Run keys for every Test Execution under the
      Test Plan, and the rest of the Xray-related data (Pre-Conditions, linked
      Test attachments, etc.) is resolved normally.

      Actual behaviour

      The following error is logged and the Xray pipeline aborts:

      ERROR [c.x.j.mapping.a.w] An error has occurred while Xporter is getting
      test plans info from Xray: Unmatched closing ')' near index 41
          TestExecutions\[\d+\].TestRuns\[\d+\].Key')
                                                   ^
      java.util.regex.PatternSyntaxException: Unmatched closing ')' near index 41
      TestExecutions\[\d+\].TestRuns\[\d+\].Key')
                                               ^
          at java.base/java.util.regex.Pattern.error(Unknown Source)
          at java.base/java.util.regex.Pattern.compile(Unknown Source)
          at java.base/java.util.regex.Pattern.<init>(Unknown Source)
          at java.base/java.util.regex.Pattern.compile(Unknown Source)
          at com.xpandit.jiraxporter.mapping.a.w.a(Unknown Source)
          at com.xpandit.jiraxporter.mapping.a.w.a(Unknown Source)
          ...
          at com.xpandit.jiraxporter.manager.impl.XporterFieldRetrieverImpl
              .lambda$getFieldRetriever$193(Unknown Source)
          at com.xpandit.jiraxporter.mapping.c.a(Unknown Source)
          at com.xpandit.jiraxporter.mapping.g.a(Unknown Source)
          at com.xpandit.jiraxporter.utils.DocumentBuildLookup.lookup(Unknown Source)
          at com.xpandit.jiraxporter.component.service.XporterServiceImpl
              .exportIssue(Unknown Source)
      

      The malformed pattern is TestExecutions[\d+].TestRuns[\d+].Key') — note
      the trailing ') that should not be there.

      Side effects observed

      Because the failing pipeline is the same one that resolves Xray-related data
      under a Test Plan, this bug can transitively cause:

      • Pre-Condition embedded images / attachments not appearing in the report.
      • Attachments stored at the linked Test level not

      Attachments

        Activity

          People

            bernardo.cottim Bernardo Cottim
            carolina.molina Carolina Molina
            Votes:
            2 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: