How do I add a new line in an InvalidInputException in a workflow validator plugin?

Bhushan Nagaraj March 2, 2012

I am writing a Workflow validator plugin. When displaying the error message I need a few new lines.

I tried adding \n and <br /> as part of my string but didnt work.

Can anyone please help me out with this?

2 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

2 votes
Answer accepted
JamieA
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 Leaders.
March 2, 2012

The message is escaped, so I don't think you can without changing the velocity template, ie macros.vm.

6 votes
Radha Khullar June 29, 2015

Call addError method of InvalidInputException class for each new line of the error message.

For example:

InvalidInputException error= new InvalidInputException()

Instead of error.addError("First line. \n Second line")

try error.addError("First line")

error.addError("Second line")

Output will now be :

First line

Second line

Toli An June 27, 2018

Yes, it works!

Pascal Robert August 27, 2019

Don't seem to work anymore :-/ Jira 7.13.5. It only display the first part of the error (eg, the line added by the first addError call).

TAGS
AUG Leaders

Atlassian Community Events