The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Xporter for JIRA - for loop error

JimmyVanAU
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
January 9, 2017

When exporting a template on a sub-task, to get the parent task's due date, I get the following error:

We are sorry, an unexpected error hasnoccured in the export of your issue.

Please provide the information below to our support.

General Exception:
java.lang.StringIndexOutOfBoundsException: String index out of range: -180
java.lang.StringIndexOutOfBoundsException:
String index out of range: -180
                at
java.lang.String.substring(String.java:1967)
                at
com.xpandit.jiraxporter.exporter.callbacks.j.replacing(Unknown Source)
...

It goes on for a few pages.

The following snippet appears to be the problem:

#{for i=JQLIssuesCount|clause=issuekey = ${ParentIssueKey}}
    ${JQLIssues[i].DueDate}
#{end}

If I run the export without this snippet, the template is fine. If I add this, it produces the above error message.

I tried with another for loop as suggested in the documentation #{for comments}${Comments[n].Author} #{end}, and also hand typing the above query, to ensure there were no invisible characters, but the results are the same.

 

Running JIRA SD 3.2.6/JIRA Core 7.2.6 and Xporter 4.3.1.

Has anyone seen anything similar/is there another way to get the parent issue due date?

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
JimmyVanAU
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
January 9, 2017

OK, so I've determined that you can't have the #for loop mid-sentence. For context, it was in the middle of a paragraph:

You should therefore expect a response from us by  #{for i=JQLIssuesCount|clause=issuekey = ${ParentIssueKey}}

    ${JQLIssues[i].DueDate}

#{end}. The consultation period may be extended....

EDIT: So this is my workaround:

#{for i=JQLIssuesCount|clause=issuekey = ${ParentIssueKey}}You should therefore expect a response from us by ${dateformat("d MMMM yyyy"):JQLIssues[i].DueDate}#{end}. The consultation period may be extended...

Peculiar that I can add text after the #{end}, but not before the #{for...

Rui Rodrigues
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
January 11, 2017

Hi @Jimmy Van,

Could open a ticket in our Support Portal in order to share your template with us? We need analyse what's happening

THanks.

Rui Rodrigues.