am a3efde54: am 6e979246: am 7712baa5: Merge "Fix a possible IOOB"

* commit 'a3efde54d75f05145f1c4a085ef569e7c970fa7f':
  Fix a possible IOOB
main
Jean Chalard 2013-10-09 21:26:18 -07:00 committed by Android Git Automerger
commit 83305e5338
1 changed files with 3 additions and 2 deletions

View File

@ -367,10 +367,11 @@ public final class FusionDictionary implements Iterable<Word> {
* Helper method to convert a String to an int array.
*/
static int[] getCodePoints(final String word) {
// TODO: this is a copy-paste of the contents of StringUtils.toCodePointArray,
// TODO: this is a copy-paste of the old contents of StringUtils.toCodePointArray,
// which is not visible from the makedict package. Factor this code.
final int length = word.length();
if (length <= 0) return new int[] {};
final char[] characters = word.toCharArray();
final int length = characters.length;
final int[] codePoints = new int[Character.codePointCount(characters, 0, length)];
int codePoint = Character.codePointAt(characters, 0);
int dsti = 0;