Details
-
Bug
-
Resolution: Timed out
-
Low
-
Severity 3 - Minor
-
Description
What
Importing a CSV file to a project will fail if one of the custom field name contains "$" or "/"
Why
Full stack trace is
java.lang.StringIndexOutOfBoundsException: String index out of range: 30 at java.lang.String.charAt(String.java:686) at java.util.regex.Matcher.appendReplacement(Matcher.java:711) at java.util.regex.Matcher.replaceFirst(Matcher.java:861) at java.lang.String.replaceFirst(String.java:2146) at com.atlassian.jira.plugins.importer.imports.csv.web.CsvFieldMappingsPage.doValidation(CsvFieldMappingsPage.java:96) at webwork.action.ActionSupport.validate(ActionSupport.java:391) at webwork.action.ActionSupport.execute(ActionSupport.java:162) at com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:82) at com.atlassian.jira.plugins.importer.web.ImporterProcessSupport.execute(ImporterProcessSupport.java:145)
The code is actually failing when executing this:
"field-41fcad5ea614a849560409df318c4534".replaceFirst("field-41fcad5ea614a849560409df318c4534", "field.Original Cost Estimate $");
That looks harmless enough, but the replaceFirst method is a bit stupid, from its Javadoc
The fix
Use Matcher.quoteReplacement
The workaround
- Open CSV file and replace '$' by something else in the first row (like 'in dollars')
- Re-import csv file
Note
This happened on this support case.
Attachments
Issue Links
- was cloned as
-
JIM-1345 Loading...