From: Markus Scherer Date: Mon, 2 Jun 2014 15:32:42 +0000 (+0000) Subject: ICU-7057 bug fix: make it actually work when assertions are disabled, tested without -ea X-Git-Tag: milestone-59-0-1~1881 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=e91fd1e88e04ddbb78937a254a45ea7d367fa6dd;p=icu ICU-7057 bug fix: make it actually work when assertions are disabled, tested without -ea X-SVN-Rev: 35789 --- diff --git a/icu4j/main/classes/core/src/com/ibm/icu/impl/ICUBinary.java b/icu4j/main/classes/core/src/com/ibm/icu/impl/ICUBinary.java index 57d4c05dea1..764df4a8b1d 100644 --- a/icu4j/main/classes/core/src/com/ibm/icu/impl/ICUBinary.java +++ b/icu4j/main/classes/core/src/com/ibm/icu/impl/ICUBinary.java @@ -218,13 +218,14 @@ public final class ICUBinary try { int avail = is.available(); byte[] bytes = new byte[avail]; - assert avail == is.read(bytes); + int numRead = is.read(bytes); + assert numRead == avail; while((avail = is.available()) != 0) { // TODO Java 6 replace new byte[] and arraycopy(): byte[] newBytes = Arrays.copyOf(bytes, bytes.length + avail); byte[] newBytes = new byte[bytes.length + avail]; System.arraycopy(bytes, 0, newBytes, 0, bytes.length); - int numRead = is.read(newBytes, bytes.length, avail); - assert avail == numRead; + numRead = is.read(newBytes, bytes.length, avail); + assert numRead == avail; bytes = newBytes; } return ByteBuffer.wrap(bytes);