views:

43

answers:

1

This is in an application I am using called Mirth, but it appears to be coming from inside an Apache Commons library from a method that checks if something is indeed Base64 encoded or not. All of the docs say the only return is true or false, so how am I getting -61?

-61
org.apache.commons.codec.binary.Base64.isBase64(Base64.java:137)
org.apache.commons.codec.binary.Base64.discardNonBase64(Base64.java:478)
org.apache.commons.codec.binary.Base64.decodeBase64(Base64.java:374)
org.apache.commons.codec.binary.Base64.decode(Base64.java:220)
com.webreach.mirth.plugins.pdfviewer.PDFViewer.viewAttachments(PDFViewer.java:51)
com.webreach.mirth.client.ui.browsers.message.MessageBrowser$16.doInBackground(MessageBrowser.java:1429)
com.webreach.mirth.client.ui.browsers.message.MessageBrowser$16.doInBackground(MessageBrowser.java:1426)
org.jdesktop.swingworker.SwingWorker$1.call(SwingWorker.java:276)
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
java.util.concurrent.FutureTask.run(FutureTask.java:138)
org.jdesktop.swingworker.SwingWorker.run(SwingWorker.java:315)
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
java.lang.Thread.run(Thread.java:637)
+1  A: 

It's likely an ArrayIndexOutOfBoundsException. The -61 is supposedly the index.

From http://kickjava.com/src/org/apache/commons/codec/binary/Base64.java.htm:

134     private  static boolean isBase64(byte octect) {
135         if (octect == PAD) {
136             return true;
137         } else if (base64Alphabet[octect] == -1) { // <---
138             return false;
139         } else {
140             return true;
141         }
142     }

Apparently the input isn't Base64 encoded.

BalusC