This issue has been created
 
 
JIRA Components / cid:jira-generated-image-avatar-7d0903c9-7940-4143-a375-fc739d95077a JIRA-108 Open

JIRA XML parsing fails for Polish characters

 
View issue   ·   Add comment
 

Issue created

 
cid:jira-generated-image-avatar-7de7f2a7-0c4b-41c6-8bfd-1071be1863fe Iwo Stanisławski created this issue on 04/Feb/26 13:57
 
Summary: JIRA XML parsing fails for Polish characters
Issue Type: cid:jira-generated-image-avatar-7d0903c9-7940-4143-a375-fc739d95077a Bug
Assignee: Unassigned
Attachments: jira-macro-error-anonymized.txt
Components: JIRA Macro
Created: 04/Feb/26 13:57
Environment: Docker image
Labels: usability
Priority: cid:jira-generated-image-static-trivial-bbf74ebf-d648-4b89-a794-bfc20adc39e5 Trivial
Reporter: Iwo Stanisławski
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:**

```java
return createSAXBuilder().build(is);
```

**After:**
```java
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.