on 04-23-2008 7:20 AM
Hi Friends,
I have a search window ,in one I/P Field i entered * and kept the default max hits to display as 100 records(This can be changed).
Now when i click on Search i get 100 records being displayed,later when i change it to 150,200 Hits i am able to get them displayed(Records).
But when i enter value greater than 200(i had entered 220) i am getting the following exception.
java.lang.StringIndexOutOfBoundsException: String index out of range: 8
Can anyone please help me out to resolve this issue.
Thanks and regards,
Chandrashekar.
hi chand,
your issue is:
java.lang.StringIndexOutOfBoundsException:
1.Actually you are searching & displaying the documents from a window contains list of all documents.
2. At the same time you can able to get X number of documents depends upon the users requirements.
3. When user enters Maximum, you caught an exception,
so, thing is for value more than 200 you caught an exception
so in a window, it may contain less number of document, than you mentioned (i.e. Number of documents to be displayed....)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Chandra,
If this didnt solve, let us know the code or the logic, so we can help.
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It is better to check the size or length of the string before taking the substring. If you always require a substring with 8th character, you should know what should you do if the string length is not of 8 character, i.e whether to dicard the string or use it as it is. If you still need , take the one which is present. else, dont use substring for that string.
Also make sure that the data is not null.
Hope this will help..
-Shabir.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Chandrashekar,
It looks like in the loop of number of records, you are fetching the record and processing the string either using charAt() method or subString method or any similar method.
But in one of the record string after 200th record is having a string which when you are processing are having length less than 8.
Say : String s = "Correct";
will give StringIndexOutOfBoundsException: String index out of range: 8 as the length is only 7 and you are cheking for char at position 8.
Just check the processing you are doing within the record loop and also the records.
Hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Shabir,
Yes whatever you said is absolutely correct,i have cross checked my application and what you said seems to be correct.
But now how do i overcome this issue?
The stack trace for your information is:
java.lang.StringIndexOutOfBoundsException: String index out of range: 8
at java.lang.String.substring(String.java:1683)
Please help me to resolve this issue.
Thanks and regards,
Chandrashekar.
how many records you have actually ? is that beyond 200?
if so, you can raise an exception if user entered number is greater than records available.
e.g: in records node you are getting values
int size = wdContext.nodeRecords.size();
wdComponentAPI.getMessageManager().raiseException("Record "+size+"does not exists", true);
- nikhiL
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Do you set the max allowed number of returns programatically? Is it ab attribute of the system you are using?
regards
yuval
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.