Hi,

First of all, thanks for taking a look at the patch.  Regarding this:

>>> 1. Ability to decode base64 streams which are missing the final
>>> padding characters.
>>
>> That changes the behaviour; there may be some applications that rely
>> on detecting invalid Base64 data.
>>
>> IMO this new behaviour needs to be optional.
>>
>
> +1


I tested on codec-1.3, codec-1.2 and codec-1.1, and I can't imagine
how any existing apps would depend on the current behaviour.  None of
the codec versions threw any exceptions.  They just return byte[]
arrays which are presumably useless to the calling application.



import org.apache.commons.codec.binary.*;

public class Test {

public static void main(String[] args) throws Exception {

   System.out.println(new
String(Hex.encodeHex(Base64.decodeBase64("/3+PwBzbRxqMi1qTBhg/6A==".getBytes("UTF-8")))));
   System.out.println(new
String(Hex.encodeHex(Base64.decodeBase64("/3+PwBzbRxqMi1qTBhg/6A=".getBytes("UTF-8")))));
   System.out.println(new
String(Hex.encodeHex(Base64.decodeBase64("/3+PwBzbRxqMi1qTBhg/6A".getBytes("UTF-8")))));
}
}


$ java -cp commons-codec-1.4-dev.jar:.  Test
ff7f8fc01cdb471a8c8b5a9306183fe8
ff7f8fc01cdb471a8c8b5a9306183fe8
ff7f8fc01cdb471a8c8b5a9306183fe8

$ java -cp commons-codec-1.3.jar:.  Test
ff7f8fc01cdb471a8c8b5a9306183fe8
ff7f8fc01cdb471a8c8b5a9306183f0000
ff7f8fc01cdb471a8c8b5a9306183f0000

$ java -cp commons-codec-1.2.jar:.  Test
ff7f8fc01cdb471a8c8b5a9306183fe8
ff7f8fc01cdb471a8c8b5a9306183f0000
ff7f8fc01cdb471a8c8b5a9306183f0000

$ java -cp commons-codec-1.1.jar:.  Test
ff7f8fc01cdb471a8c8b5a9306183fe8
ff7f8fc01cdb471a8c8b5a9306183f0000
ff7f8fc01cdb471a8c8b5a9306183f0000



-- 
yours,

Julius Davies
250-592-2284 (Home)
250-893-4579 (Mobile)
http://juliusdavies.ca/

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to