am 6e979246: am 7712baa5: Merge "Fix a possible IOOB"
* commit '6e979246be424db462b594ad2a63b9f9841d39f8': Fix a possible IOOBmain
commit
a3efde54d7
|
@ -367,10 +367,11 @@ public final class FusionDictionary implements Iterable<Word> {
|
||||||
* Helper method to convert a String to an int array.
|
* Helper method to convert a String to an int array.
|
||||||
*/
|
*/
|
||||||
static int[] getCodePoints(final String word) {
|
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.
|
// 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 char[] characters = word.toCharArray();
|
||||||
final int length = characters.length;
|
|
||||||
final int[] codePoints = new int[Character.codePointCount(characters, 0, length)];
|
final int[] codePoints = new int[Character.codePointCount(characters, 0, length)];
|
||||||
int codePoint = Character.codePointAt(characters, 0);
|
int codePoint = Character.codePointAt(characters, 0);
|
||||||
int dsti = 0;
|
int dsti = 0;
|
||||||
|
|
Loading…
Reference in New Issue