Uploaded image for project: 'JIRA Components'
  1. JIRA Components
  2. JIRA-108

JIRA XML parsing fails for Polish characters

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Trivial
    • None
    • 11.1.3
    • JIRA Macro
    • Docker image
    • Unknown

    Description

      The JQL macro "issueKey in (PROC-315)" causes a rendering error:

      Failed to execute the JIRA macro. Cause: 

      [XML document structures must start and end within the same entity.]
      

      Full stack trace attached: jira-macro-error-anonymized.txt

      *Probable cause*:

      • Atlassian Cloud API returns XML with a BOM (EF BB BF) at the very beginning of the response.
      • The JDOM/Xerces parser does not tolerate this when data is passed directly as an InputStream.

      *Solution (introduced in code):*

      In the HTTPJIRAFetcher class, the fetch method, the parsing behavior has been changed:

      **Before:**

      return createSAXBuilder().build(is);
      

      **After:**

      try (InputStreamReader reader = new InputStreamReader(is, StandardCharsets.UTF_8)) {
      return createSAXBuilder().build(reader);
      }
      

      The UTF-8 InputStreamReader automatically removes the BOM, which solves the problem.

      **Status:**

      Pull Request issued – https://github.com/xwiki-contrib/jira/pull/74
      Waiting for code review and merge.

      Environment:
      The application is running in a Docker container.

      Attachments:

      jira-macro-error-anonymized.log (anonymized log with the full stack trace and a snippet of the server response)

      **At the same time, a colleague from his perspective says that this could be the case:**

      So, to summarize:

      • It's accessed through the Atlassian API, using a service account - https://api.atlassian.com/ex/jira/\{appId}
      • The error always occurs for individual tasks or groups of tasks
      • If the same task is placed in a list with other tasks, it works correctly
      • The underlying XML is valid and the parser reads it correctly
      • If you wrap IS, it works too
      • There could even be some race conditions in Java itself here - for example, the HTTP client is still writing the response to some buffer, and the parser is already trying to read it
      • So, you can indicate in the report that you're using a Docker image

      By the way, sorry for the strange ticket, but this is the first time I'm writing to open-source developers.

      Attachments

        Activity

          People

            vmassol Vincent Massol
            iwokonl Iwo Stanisławski
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated: