Using JAVA api to retrieve Account information problem

Using Java api(edema-api-2.5.918.jar) to retrieve account information,

but get the following error:

Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: 13
at java.lang.String.substring(Unknown Source)
at com.edmz.api.APICommandLib.extractDateTime(Unknown Source)
at com.edmz.api.APICommandLib.buildAccountList(Unknown Source)
at com.edmz.api.APICommandLib.listAccounts(Unknown Source)
at com.htic.tpam.APIAccountTest.main(APIAccountTest.java:46)

And the following is my code snippet:

......

apiClient.connect(ip);

apiClient.authenticate(authFile, user);

SessionChannelClient scClient = apiClient.createSessionChannel();

APICommandLib apiCommandLib = new APICommandLib(scClient);

AccountFilter accFilter = new AccountFilter();

ListResult listResult = new ListResult();

List<Account> accounts = new ArrayList<Account>();

apiCommandLib.listAccounts(accFilter, listResult, accounts);

System.out.println("Return Code: " + listResult.getReturnCode());

System.out.println("Display Error String: " + apiCommandLib.getErrorString());

System.out.println("Row Count: " + listResult.getRowCount());

.......

 

very appriciate for any help

Andy

  • StringIndexOutOfBoundsException error is realted to Java substring and it means you are attempting to access a character which would come after the end of the string. If a String is only 4 characters long, attempting to get the substring from index 0 - 8, will throw this exception. substring(beginIndex, endInded) throws IndexOutOfBoundsException if the beginIndex is negative, or endIndex is larger than the length of this String object, or beginIndex is larger than endIndex.