Return-Path: X-Original-To: apmail-commons-commits-archive@minotaur.apache.org Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id CDB58107AF for ; Fri, 28 Feb 2014 19:29:38 +0000 (UTC) Received: (qmail 65356 invoked by uid 500); 28 Feb 2014 19:29:36 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 65295 invoked by uid 500); 28 Feb 2014 19:29:36 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 65288 invoked by uid 99); 28 Feb 2014 19:29:35 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Feb 2014 19:29:35 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Feb 2014 19:29:33 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 8C51323888D7; Fri, 28 Feb 2014 19:29:12 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1573038 - /commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java Date: Fri, 28 Feb 2014 19:29:12 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140228192912.8C51323888D7@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sebb Date: Fri Feb 28 19:29:12 2014 New Revision: 1573038 URL: http://svn.apache.org/r1573038 Log: Arrays#copyOfRange is Java 1.6+; replace with basic local implementation Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java Modified: commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java URL: http://svn.apache.org/viewvc/commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java?rev=1573038&r1=1573037&r2=1573038&view=diff ============================================================================== --- commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java (original) +++ commons/proper/compress/trunk/src/test/java/org/apache/commons/compress/compressors/bzip2/PythonTruncatedBzip2Test.java Fri Feb 28 19:29:12 2014 @@ -57,7 +57,7 @@ public class PythonTruncatedBzip2Test { DATA = out.toByteArray(); // Drop the eos_magic field (6 bytes) and CRC (4 bytes). - TRUNCATED_DATA = Arrays.copyOfRange(DATA, 0, DATA.length - 10); + TRUNCATED_DATA = copyOfRange(DATA, 0, DATA.length - 10); } @Before @@ -91,7 +91,7 @@ public class PythonTruncatedBzip2Test { ByteBuffer buffer = ByteBuffer.allocate(length); bz2Channel.read(buffer); - assertArrayEquals(Arrays.copyOfRange(TEXT.getBytes(), 0, length), + assertArrayEquals(copyOfRange(TEXT.getBytes(), 0, length), buffer.array()); // subsequent read should throw @@ -110,4 +110,13 @@ public class PythonTruncatedBzip2Test { return Channels.newChannel(bZin); } + + // Helper method since Arrays#copyOfRange is Java 1.6+ + // Does not check parameters, so may fail if they are incompatible + private static byte[] copyOfRange(byte[] original, int from, int to) { + int length = to - from; + byte buff[] = new byte[length]; + System.arraycopy(original, from, buff, 0, length); + return buff; + } }