]> granicus.if.org Git - icu/commitdiff
ICU-7057 bug fix: make it actually work when assertions are disabled, tested without -ea
authorMarkus Scherer <markus.icu@gmail.com>
Mon, 2 Jun 2014 15:32:42 +0000 (15:32 +0000)
committerMarkus Scherer <markus.icu@gmail.com>
Mon, 2 Jun 2014 15:32:42 +0000 (15:32 +0000)
X-SVN-Rev: 35789

icu4j/main/classes/core/src/com/ibm/icu/impl/ICUBinary.java

index 57d4c05dea18de69ae3aa07f3d0072aa9bd43ff4..764df4a8b1d01341aff7ccfd36a8df63a90cfd78 100644 (file)
@@ -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);