vendredi 31 juillet 2015

During conversion getting arrayindexoutofboundsexception

I am trying to convert String to byte using below code.

ec = "some html contents";
private String MyMethod(String ec){
  byte[] ecByte = DatatypeConverter.parseBase64Binary(ec);
  return new String(ecByte, "iso-8859-1");
}

while calling MyMethod, Getting arrayindexoutofboundsexception Error.

java.lang.ArrayIndexOutOfBoundsException: 146
    at javax.xml.bind.DatatypeConverterImpl._parseBase64Binary(DatatypeConverterImpl.java:576)
    at javax.xml.bind.DatatypeConverterImpl.parseBase64Binary(DatatypeConverterImpl.java:323)
    at javax.xml.bind.DatatypeConverter.parseBase64Binary(DatatypeConverter.java:296)

I don't know what to do. Please help me on fixing this error.

Thanks in advance.

Aucun commentaire:

Enregistrer un commentaire