Pattern selector

Most relevant patterns first. Most helpful ones displayed. Click here to show all.

  1. Start or end index provided to substring method outside the range of String indices
    Java Runtime
    302
    803
    195

Your stack trace compared to the selected pattern

Jump to solutionsExpand frames
java.lang.StringIndexOutOfBoundsException: String index out of range: 42
    at java.lang.String.substring(Unknown Source)
    at ExecTest.main(ExecTest.java:22)

Solution

rp3 years ago

Ensure that the start and end indices for the substring are within range of the String's start and end indices

External results for this pattern (10)

  1. 843789via Oracle Community20 hours ago
    String index out of range: 45
    Show stack trace
  2. nicolatimeusvia GitHub1 day ago
    String index out of range: -10
    Show stack trace
  3. CreeperHangvia GitHub1 day ago
    String index out of range: -1
    Show stack trace
  4. lightlikevia GitHub1 day ago
    String index out of range: -1
    Show stack trace
  5. bin4rym4gevia GitHub1 day ago
    String index out of range: 2
    Show stack trace
  6. zachbrvia GitHub1 day ago
    String index out of range: -279
    Show stack trace
  7. Patryk003via GitHub1 day ago
    String index out of range: -1
    Show stack trace
  8. musketyrvia GitHub1 day ago
    String index out of range: 5
    Show stack trace
  9. pedrorijo91via GitHub1 day ago
    String index out of range: -1
    Show stack trace
  10. smolavia GitHub3 days ago
    exception writing response
    Show stack trace