Fixed ArrayTrie to not throw if passed a unicode character.
This commit is contained in:
parent
16241d7fcb
commit
8bd4a9fad8
|
@ -337,6 +337,9 @@ public class HttpURITest
|
|||
{"%2f/info", "//info", true},
|
||||
{"%2F/info", "//info", true},
|
||||
|
||||
// Non ascii characters
|
||||
{"http://localhost:9000/x\uD83C\uDF32\uD83C\uDF32\uD83C\uDF32\uD83C\uDF32\uD83C\uDF32", "/x\uD83C\uDF32\uD83C\uDF32\uD83C\uDF32\uD83C\uDF32\uD83C\uDF32", false},
|
||||
{"http://localhost:9000/\uD83C\uDF32\uD83C\uDF32\uD83C\uDF32\uD83C\uDF32\uD83C\uDF32", "/\uD83C\uDF32\uD83C\uDF32\uD83C\uDF32\uD83C\uDF32\uD83C\uDF32", false},
|
||||
}).map(Arguments::of);
|
||||
}
|
||||
|
||||
|
|
|
@ -204,6 +204,8 @@ public class ArrayTrie<V> extends AbstractTrie<V>
|
|||
for (int i = 0; i < len; i++)
|
||||
{
|
||||
char c = s.charAt(offset + i);
|
||||
if (c > 0x7f)
|
||||
return null;
|
||||
int index = __lookup[c & 0x7f];
|
||||
if (index >= 0)
|
||||
{
|
||||
|
@ -217,7 +219,7 @@ public class ArrayTrie<V> extends AbstractTrie<V>
|
|||
char[] big = _bigIndex == null ? null : _bigIndex[t];
|
||||
if (big == null)
|
||||
return null;
|
||||
t = big[c];
|
||||
t = big[c & 0x7f];
|
||||
if (t == 0)
|
||||
return null;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue