aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/WordComposer.java
diff options
context:
space:
mode:
authorKeisuke Kuroyanagi <ksk@google.com>2014-05-16 15:32:12 +0900
committerKeisuke Kuroyanagi <ksk@google.com>2014-05-16 15:32:12 +0900
commit34873a66f03e0b9945474213fa2bc48cc272a7ca (patch)
tree9bfabd486ac8cb3a03ffd9d3359a762224308873 /java/src/com/android/inputmethod/latin/WordComposer.java
parentd94567d9637aae33905fc7f292a615996df6d3c9 (diff)
downloadlatinime-34873a66f03e0b9945474213fa2bc48cc272a7ca.tar.gz
latinime-34873a66f03e0b9945474213fa2bc48cc272a7ca.tar.xz
latinime-34873a66f03e0b9945474213fa2bc48cc272a7ca.zip
Fix: StringIndexOutOfBoundsException.
Bug: 14985751 Change-Id: I9df2f737555ab02e24e0fbd231a97c1eec26bc57
Diffstat (limited to 'java/src/com/android/inputmethod/latin/WordComposer.java')
-rw-r--r--java/src/com/android/inputmethod/latin/WordComposer.java12
1 files changed, 2 insertions, 10 deletions
diff --git a/java/src/com/android/inputmethod/latin/WordComposer.java b/java/src/com/android/inputmethod/latin/WordComposer.java
index ac6972928..9cf71c7f4 100644
--- a/java/src/com/android/inputmethod/latin/WordComposer.java
+++ b/java/src/com/android/inputmethod/latin/WordComposer.java
@@ -149,7 +149,8 @@ public final class WordComposer {
public int copyCodePointsExceptTrailingSingleQuotesAndReturnCodePointCount(
final int[] destination) {
// lastIndex is exclusive
- final int lastIndex = mTypedWordCache.length() - trailingSingleQuotesCount();
+ final int lastIndex = mTypedWordCache.length()
+ - StringUtils.getTrailingSingleQuotesCount(mTypedWordCache);
if (lastIndex <= 0) {
// The string is empty or contains only single quotes.
return 0;
@@ -331,15 +332,6 @@ public final class WordComposer {
return mIsFirstCharCapitalized;
}
- public int trailingSingleQuotesCount() {
- final int lastIndex = mTypedWordCache.length() - 1;
- int i = lastIndex;
- while (i >= 0 && mTypedWordCache.charAt(i) == Constants.CODE_SINGLE_QUOTE) {
- --i;
- }
- return lastIndex - i;
- }
-
/**
* Whether or not all of the user typed chars are upper case
* @return true if all user typed chars are upper case, false otherwise