abterrabio / dp-mzml

A java-based streaming parser for mzml files
Apache License 2.0
3 stars 1 forks source link

IllegalArgumentException during base64 decoding #5

Open rudolphi opened 4 years ago

rudolphi commented 4 years ago

Dear Digital Proteomics Team,

when trying to use dp-mzml with the attached file MXPr.mzml.zip the following exception is thrown:

java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Illegal base64 character a at java.util.Base64$Decoder.decode0(Base64.java:714) at java.util.Base64$Decoder.decode(Base64.java:526) at java.util.Base64$Decoder.decode(Base64.java:549) at com.digitalproteomics.oss.parsers.mzml.BinaryDataArray.getDataAsDecodedNumberArray(BinaryDataArray.java:140)

A fix would be to replace byte[] encoded = Base64.getDecoder().decode(this.encodedData.toString()); in com.digitalproteomics.oss.parsers.mzml.BinaryDataArray:140 by byte[] encoded = Base64.getMimeDecoder().decode(this.encodedData.toString()); (and maybe the same in line 180).

Thanks very much!

Felix

l337x911 commented 3 months ago

Apologies for the multi-year delay.

It looks like you found a solution to the illegal base64 character for your mzML file. Unless I'm mistaken, the only difference between the MIME and basic decoder is that the MIME decoder handles \r and \n characters. I'm not sure this makes sense in storing a number array as binary data, so I wonder if this is an issue upstream with how Unifi encodes Waters MS data.