Skip to content

Commit 713a413

Browse files
committed
Arrays::getLength: include 'from' in exception message
Use append to add 'from' value to the ByteBuffer. This avoids accidentally interpreting it as initial buffer capacity in the constructor. Signed-off-by: Josua Mayer <[email protected]>
1 parent 1d47f5c commit 713a413

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

core/src/main/java/org/bouncycastle/util/Arrays.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -895,8 +895,8 @@ private static int getLength(int from, int to)
895895
int newLength = to - from;
896896
if (newLength < 0)
897897
{
898-
StringBuffer sb = new StringBuffer(from);
899-
sb.append(" > ").append(to);
898+
StringBuffer sb = new StringBuffer();
899+
sb.append(from).append(" > ").append(to);
900900
throw new IllegalArgumentException(sb.toString());
901901
}
902902
return newLength;

0 commit comments

Comments
 (0)