Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BD1DD11CFB for ; Tue, 1 Jul 2014 19:27:25 +0000 (UTC) Received: (qmail 56095 invoked by uid 500); 1 Jul 2014 19:27:25 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 56063 invoked by uid 500); 1 Jul 2014 19:27:25 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 56033 invoked by uid 99); 1 Jul 2014 19:27:25 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Jul 2014 19:27:25 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 13BE69920FF; Tue, 1 Jul 2014 19:27:25 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: jake@apache.org To: commits@cassandra.apache.org Date: Tue, 01 Jul 2014 19:27:25 -0000 Message-Id: <6b2940afdda849ada43ae9fe4b376e12@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [1/2] git commit: ninja: Always make a copy in BBU.getArray() Repository: cassandra Updated Branches: refs/heads/cassandra-2.1 c70daa8ed -> a4f2a97ad ninja: Always make a copy in BBU.getArray() Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/6aa81a5b Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/6aa81a5b Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/6aa81a5b Branch: refs/heads/cassandra-2.1 Commit: 6aa81a5b378938bcd9d1201af191685dcbf4a96b Parents: 3958fc4 Author: Jake Luciani Authored: Tue Jul 1 15:25:13 2014 -0400 Committer: Jake Luciani Committed: Tue Jul 1 15:25:13 2014 -0400 ---------------------------------------------------------------------- src/java/org/apache/cassandra/utils/ByteBufferUtil.java | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cassandra/blob/6aa81a5b/src/java/org/apache/cassandra/utils/ByteBufferUtil.java ---------------------------------------------------------------------- diff --git a/src/java/org/apache/cassandra/utils/ByteBufferUtil.java b/src/java/org/apache/cassandra/utils/ByteBufferUtil.java index 420a776..16dbfb7 100644 --- a/src/java/org/apache/cassandra/utils/ByteBufferUtil.java +++ b/src/java/org/apache/cassandra/utils/ByteBufferUtil.java @@ -158,10 +158,7 @@ public class ByteBufferUtil if (buffer.hasArray()) { int boff = buffer.arrayOffset() + buffer.position(); - if (boff == 0 && length == buffer.array().length) - return buffer.array(); - else - return Arrays.copyOfRange(buffer.array(), boff, boff + length); + return Arrays.copyOfRange(buffer.array(), boff, boff + length); } // else, DirectByteBuffer.get() is the fastest route byte[] bytes = new byte[length];