Searched on Google with the first line of a JAVA stack trace?

We can recommend more relevant solutions and speed up debugging when you paste your entire stack trace with the exception message. Try a sample exception.

Recommended solutions based on your search

Samebug tips

  1. ,

    Thrown by the methods of the String class to indicate that an index is either negative, or greater than the size of the string itself. You are probably using the wrong index when accessing substring of the array.

Solutions on the web

via Coderanch by Kudret Serin, 1 year ago
String index out of range: -2
via GitHub by mitelg
, 5 months ago
String index out of range: -2
via Atlassian JIRA by Gurleen Anand [Atlassian], 1 year ago
via Stack Overflow by Brad
, 1 year ago
via Stack Overflow by shamuddin mohd
, 2 years ago
String index out of range: -2
java.lang.StringIndexOutOfBoundsException: String index out of range: -2 at java.lang.String.substring(Unknown Source) at certifier.Certifier$Quiz.getQuestion(Certifier.java:228) at certifier.Certifier$Quiz.access$600(Certifier.java:84) at certifier.Certifier$Quiz$1.mouseClicked(Certifier.java:195) at java.awt.AWTEventMulticaster.mouseClicked(Unknown Source) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)