Index: source/gnu/inet/util/BASE64.java =================================================================== RCS file: /sources/classpath/inetlib/source/gnu/inet/util/BASE64.java,v retrieving revision 1.10 diff -u -r1.10 BASE64.java --- source/gnu/inet/util/BASE64.java 25 Aug 2005 12:32:03 -0000 1.10 +++ source/gnu/inet/util/BASE64.java 8 Jan 2010 16:48:00 -0000 @@ -82,7 +82,8 @@ public static byte[] encode(byte[] bs) { int si = 0, ti = 0; // source/target array indices - byte[] bt = new byte[((bs.length + 2) * 4) / 3]; // target byte array + /* target byte array */ + byte[] bt = new byte[((bs.length + 2 - ((bs.length + 2) % 3)) * 4) / 3]; for (; si < bs.length; si += 3) { int buflen = bs.length - si; @@ -111,16 +112,10 @@ bt[ti++] = src[b3 & 0x3f]; } } - if (ti < bt.length) - { - byte[] tmp = new byte[ti]; - System.arraycopy(bt, 0, tmp, 0, ti); - bt = tmp; - } - /*while (ti < bt.length) + while (ti < bt.length) { bt[ti++] = 0x3d; - }*/ + } return bt; }