java.lang.StringIndexOutOfBoundsException: String index out of range: 30

Atlassian JIRA | Colin Chauvet | 4 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    h2. What Importing a CSV file to a project will fail if one of the custom field name contains "$" or "/" h2. Why Full stack trace is {noformat} 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) {noformat} The code is actually failing when executing this: {noformat} "field-41fcad5ea614a849560409df318c4534".replaceFirst("field-41fcad5ea614a849560409df318c4534", "field.Original Cost Estimate $"); {noformat} That looks harmless enough, but the replaceFirst method is a bit stupid, from its [Javadoc|http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#replaceFirst(java.lang.String, java.lang.String)] h2. The fix Use Matcher.quoteReplacement h3. The workaround * Open CSV file and replace '$' by something else in the first row (like 'in dollars') * Re-import csv file h3. Note This happened on [this support case|https://support.atlassian.com/browse/JST-59665?focusedCommentId=3466382&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-3466382].

    Atlassian JIRA | 4 years ago | Colin Chauvet
    java.lang.StringIndexOutOfBoundsException: String index out of range: 30
  2. 0

    h2. What Importing a CSV file to a project will fail if one of the custom field name contains "$" or "/" h2. Why Full stack trace is {noformat} 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) {noformat} The code is actually failing when executing this: {noformat} "field-41fcad5ea614a849560409df318c4534".replaceFirst("field-41fcad5ea614a849560409df318c4534", "field.Original Cost Estimate $"); {noformat} That looks harmless enough, but the replaceFirst method is a bit stupid, from its [Javadoc|http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#replaceFirst(java.lang.String, java.lang.String)] h2. The fix Use Matcher.quoteReplacement h3. The workaround * Open CSV file and replace '$' by something else in the first row (like 'in dollars') * Re-import csv file h3. Note This happened on [this support case|https://support.atlassian.com/browse/JST-59665?focusedCommentId=3466382&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-3466382].

    Atlassian JIRA | 4 years ago | Colin Chauvet
    java.lang.StringIndexOutOfBoundsException: String index out of range: 30
  3. 0

    Bug ID: JDK-6421039 String.replaceFirst() crashes with java.lang.StringIndexOutOfBoundsException

    java.com | 11 months ago
    java.lang.StringIndexOutOfBoundsException: String index out of range: 50
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.lang.StringIndexOutOfBoundsException

      String index out of range: 30

      at java.lang.String.charAt()
    2. Java RT
      String.replaceFirst
      1. java.lang.String.charAt(String.java:686)
      2. java.util.regex.Matcher.appendReplacement(Matcher.java:711)
      3. java.util.regex.Matcher.replaceFirst(Matcher.java:861)
      4. java.lang.String.replaceFirst(String.java:2146)
      4 frames
    3. com.atlassian.jira
      CsvFieldMappingsPage.doValidation
      1. com.atlassian.jira.plugins.importer.imports.csv.web.CsvFieldMappingsPage.doValidation(CsvFieldMappingsPage.java:96)
      1 frame
    4. webwork.action
      ActionSupport.execute
      1. webwork.action.ActionSupport.validate(ActionSupport.java:391)
      2. webwork.action.ActionSupport.execute(ActionSupport.java:162)
      2 frames
    5. com.atlassian.jira
      ImporterProcessSupport.execute
      1. com.atlassian.jira.action.JiraActionSupport.execute(JiraActionSupport.java:82)
      2. com.atlassian.jira.plugins.importer.web.ImporterProcessSupport.execute(ImporterProcessSupport.java:145)
      2 frames