0

I used both javax.xml.bind.DatatypeConverter and sun.misc.BASE64Decoder. But when i give nonBase 64 strings i get no exceptions with BASE64Decoder

so

public static void main(String[] args) throws IOException{
    BASE64Decoder decoder = new BASE64Decoder();
    decoder.decodeBuffer("Asdghäö'¨öä'");
}

This throws no exceptions

and this,

DatatypeConverter.parseBase64Binary("ÖSaAA&&%¤");

Throws IndexOutOfBounds

but

   DatatypeConverter.parseBase64Binary("ASDGW&&");

doesn't give anything at all where i expect an IllegalArgumentException as it stated here

Does anyone encountered this before? and what do you suggest?

Thanks

add9
  • 1,503
  • 3
  • 17
  • 31
  • 1
    I see what you mean, I get the same behavior. If you were to look at the source for DatatypeConverter.java [like this](http://www.jarvana.com/jarvana/view/jaxme/jaxmeapi-src/0.5/jaxmeapi-src-0.5.distribution-zip!/javax/xml/bind/DatatypeConverter.java?format=ok), you would see it calls some provider's implementation of DatatypeConverter methods. It is possible that the reference implementation does not deal with this Exception? – demongolem Sep 10 '12 at 19:45
  • yeah it doesnt deal with it at all, and i really dont understand why to be honest... I ended up writing my own validation method for this. – add9 Sep 11 '12 at 09:05

0 Answers0