You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lenya.apache.org by bu...@apache.org on 2005/10/12 16:40:53 UTC
DO NOT REPLY [Bug 37048] New: -
Prevent StringIndexOutOfBounds in Search
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37048>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=37048
Summary: Prevent StringIndexOutOfBounds in Search
Product: Lenya
Version: 1.2.4
Platform: Other
OS/Version: other
Status: NEW
Severity: normal
Priority: P2
Component: Lucene Integration
AssignedTo: dev@lenya.apache.org
ReportedBy: solprovider@gmail.com
The error resulted from the space not being found so end = -1.
FILE: pubs/default/lenya/content/search/search-and-results.xsp
LINE# 515
ADD: the bounds checking code
if(slfield.length() > excerptOffset){
int start = 0;
int end = excerptOffset;
int half = excerptOffset/2;
if(first < half){
end = tmphtmlbody.indexOf(' ', excerptOffset);
}else{
start = tmphtmlbody.indexOf(' ', first - half);
end = tmphtmlbody.indexOf(' ', start +
excerptOffset);
}
//BEGIN: bounds checking (prevents StringIndexOutOfBounds if end = -1)
int tmphtmlbodylength = tmphtmlbody.length();
if(start > tmphtmlbodylength) start =
tmphtmlbodylength - excerptOffset;
if(start < 0) start = 0;
if(end < start) end = start + excerptOffset;
if(end > tmphtmlbodylength) end = tmphtmlbodylength;
//END: bounds checking
tmphtmlbody = tmphtmlbody.substring(start, end);
}
--
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@lenya.apache.org
For additional commands, e-mail: dev-help@lenya.apache.org