commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
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 GMT
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];



Mime
View raw message