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 F180DD37D for ; Sun, 9 Sep 2012 13:11:22 +0000 (UTC) Received: (qmail 33154 invoked by uid 500); 9 Sep 2012 13:11:22 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 33097 invoked by uid 500); 9 Sep 2012 13:11:22 -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 33090 invoked by uid 99); 9 Sep 2012 13:11:22 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 09 Sep 2012 13:11:22 +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; Sun, 09 Sep 2012 13:11:21 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 928BA23889B8 for ; Sun, 9 Sep 2012 13:10:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1382490 - /commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java Date: Sun, 09 Sep 2012 13:10:38 -0000 To: commits@commons.apache.org From: sebb@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120909131038.928BA23889B8@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: sebb Date: Sun Sep 9 13:10:38 2012 New Revision: 1382490 URL: http://svn.apache.org/viewvc?rev=1382490&view=rev Log: Don't create Context if it is not needed. Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java Modified: commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java URL: http://svn.apache.org/viewvc/commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java?rev=1382490&r1=1382489&r2=1382490&view=diff ============================================================================== --- commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java (original) +++ commons/proper/codec/trunk/src/main/java/org/apache/commons/codec/binary/BaseNCodec.java Sun Sep 9 13:10:38 2012 @@ -377,10 +377,10 @@ public abstract class BaseNCodec impleme */ @Override public byte[] decode(byte[] pArray) { - Context context = new Context(); if (pArray == null || pArray.length == 0) { return pArray; } + Context context = new Context(); decode(pArray, 0, pArray.length, context); decode(pArray, 0, EOF, context); // Notify decoder of EOF. byte[] result = new byte[context.pos]; @@ -397,10 +397,10 @@ public abstract class BaseNCodec impleme */ @Override public byte[] encode(byte[] pArray) { - Context context = new Context(); if (pArray == null || pArray.length == 0) { return pArray; } + Context context = new Context(); encode(pArray, 0, pArray.length, context); encode(pArray, 0, EOF, context); // Notify encoder of EOF. byte[] buf = new byte[context.pos - context.readPos];