DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT <http://issues.apache.org/bugzilla/show_bug.cgi?id=30483>. ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND INSERTED IN THE BUG DATABASE.
http://issues.apache.org/bugzilla/show_bug.cgi?id=30483 Base64 decoder cast exception if byte sent in < 0 Summary: Base64 decoder cast exception if byte sent in < 0 Product: Commons Version: 1.0 Alpha Platform: All OS/Version: All Status: NEW Severity: Normal Priority: Other Component: Codec AssignedTo: [EMAIL PROTECTED] ReportedBy: [EMAIL PROTECTED] RFC 2045 stipulates that any unknown byte encountered during decoding should be disregarded. All negative bytes sent to the decoder will produce the following error though: java.lang.ArrayIndexOutOfBoundsException: -62 at org.apache.commons.codec.binary.Base64.isBase64(Base64.java:137) at org.apache.commons.codec.binary.Base64.discardNonBase64(Base64.java:478) at org.apache.commons.codec.binary.Base64.decodeBase64(Base64.java:374) at TestCase.main(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl. invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:78) Cuurent method: private static boolean isBase64(byte octect) { if (octect == PAD) { return true; } else if (base64Alphabet[octect] == -1) { return false; } else { return true; } } Fixed method: private static boolean isBase64(byte octect) { if (octect == PAD) { return true; } else if (octect < 0 || base64Alphabet[octect] == -1) { return false; } else { return true; } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
