mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8234377: new BitArray(0).toString() throws ArrayIndexOutOfBoundsException
Reviewed-by: mullan, wetmore
This commit is contained in:
parent
f4a087036a
commit
d5b423d17c
2 changed files with 42 additions and 1 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
|
@ -241,6 +241,10 @@ public class BitArray {
|
|||
* Returns a string representation of this BitArray.
|
||||
*/
|
||||
public String toString() {
|
||||
if (length == 0) {
|
||||
return "";
|
||||
}
|
||||
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
|
||||
for (int i = 0; i < repn.length - 1; i++) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue