Fixed IndexOutOfBoundsException (#4515)
This commit is contained in:
parent
0f85bbd66e
commit
8a50b2f783
|
|
@ -730,8 +730,12 @@ public class Bytes {
|
|||
char pc = code[64];
|
||||
if (str.charAt(off + len - 2) == pc) {
|
||||
size -= 2;
|
||||
--num;
|
||||
rem = 2;
|
||||
} else if (str.charAt(off + len - 1) == pc) {
|
||||
size--;
|
||||
--num;
|
||||
rem = 3;
|
||||
}
|
||||
} else {
|
||||
if (rem == 2) {
|
||||
|
|
|
|||
|
|
@ -90,6 +90,14 @@ public class BytesTest {
|
|||
assertThat(bytes2, is(out2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBase642bCharArrCall() {
|
||||
byte[] stringCall = Bytes.base642bytes("ZHViYm8=", C64);
|
||||
byte[] charArrCall = Bytes.base642bytes("ZHViYm8=", C64.toCharArray());
|
||||
|
||||
assertThat(stringCall, is(charArrCall));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testHex() {
|
||||
String str = Bytes.bytes2hex(b1);
|
||||
|
|
|
|||
Loading…
Reference in New Issue