Skip to content

Commit

Permalink
Arrays::getLength: include 'from' in exception message
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Artox committed Oct 7, 2017
1 parent 1d47f5c commit 713a413
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/main/java/org/bouncycastle/util/Arrays.java
Original file line number Diff line number Diff line change
Expand Up @@ -895,8 +895,8 @@ private static int getLength(int from, int to)
int newLength = to - from;
if (newLength < 0)
{
StringBuffer sb = new StringBuffer(from);
sb.append(" > ").append(to);
StringBuffer sb = new StringBuffer();
sb.append(from).append(" > ").append(to);
throw new IllegalArgumentException(sb.toString());
}
return newLength;
Expand Down

0 comments on commit 713a413

Please sign in to comment.