Since the string stores an array of characters, just like arrays the position of each character is represented by an index (starting from 0). If you try to access the character of a String at the index is either negative or greater than the size of the string, a StringIndexOutOfBoundsException is thrown. For some methods such as the
java substring, charAt method, this exception also is thrown when the index is equal to the size of the string.
How to solve the StringIndexOutOfBoundsException
- Check the length of the string before using substring()
- Exception handling using try...catch.
------------------------------
mark vanber
------------------------------
Original Message:
Sent: Thu October 01, 2020 10:54 AM
From: Colin Paice
Subject: FFDC Exception = java.lang.StringIndexOutOfBoundsException
Ive got
------Start of DE processing------ = ∇10/1/20 15:11:16:725 BST∆
Exception = java.lang.StringIndexOutOfBoundsException
Source = com.ibm.zosconnect.internal.web.ServiceProxyServlet$4
probeid = 3243
Stack Dump = java.lang.StringIndexOutOfBoundsException: String index out of range: 0
at java.lang.String.substring(String.java:2695)
at com.ibm.zosconnect.internal.web.ServiceProxyServlet$14.run(Unknown Source)
at com.ibm.ws.webcontainer.async.ServiceWrapper.wrapAndRun(ServiceWrapper.java:236)
at com.ibm.ws.webcontainer.async.ContextWrapper.run(ContextWrapper.java:28)
at com.ibm.ws.webcontainer.async.WrapperRunnableImpl.run(WrapperRunnableImpl.java:89)
at com.ibm.ws.threading.internal.ExecutorServiceImpl$RunnableWrapper.run(ExecutorServiceImpl.java:239)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1160)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.lang.Thread.run(Thread.java:818)
Dump of callerThis
null
Dump of objectArray∇0∆
Object type = java.lang.String
looks like an ffdc for a spelling mistake! sapi-docs
is this a known problem?
Colin