Details
-
Bug
-
Resolution: Fixed
-
Low
-
3.0
-
None
Description
I've been having problems with CEO.getExcerpt() and it stripping the first character, so I decided to go on a hunt for the cause of it and I found this ... looks like someone forgot that in java both arrays and strings start at 0
public static String summariseWithoutStrippingWikiCharacters(String content) { if (!TextUtils.stringSet(content)) return content; StringTokenizer st = new StringTokenizer(content, " "); if (st.countTokens() == 1) //if it's but one word, exceeding 50 char.s, { //the length should be 46, plus a trailing space and ellipse. if (content != null && content.length() > 50) { content = content.substring(1, 46); content = content.concat(" ..."); } } else if (content != null && content.length() > 255) { content = TextUtils.trimToEndingChar(content, 251) + "..."; } return content; }
content = content.substring(1, 46);
should probably be
content = content.substring(0, 46);