com.sun.mail.util.DecodingException: BASE64Decoder: Error in encoded stream: needed at least 2 valid base64 characters, but only got 1 before padding character (=), the 10 most recent characters were: "peg; name="

Atlassian JIRA | Nicolas Bouchet | 3 years ago
  1. 0

    Hi everyone, I'm currently facing a problematic of non parsing incoming mail to jira. Mail handler configuration was done and it worked for weeks without any problems. I encountered a problem with a first mail and then all following ones are not correctly parsed. Issue is created, subject is correctly set but the description contains the mail header, as raw data (attached screenshots) I tried restarting jira, we deleted the mail handler and recreated it and none worked so far. We were not able to reproduce that problematic on the test environment that features the same jira setup and configuration. Both servers use the same mail server but different accounts. In the logs, not much I'm afraid, we once had a : com.sun.mail.util.DecodingException: BASE64Decoder: Error in encoded stream: needed at least 2 valid base64 characters, but only got 1 before padding character (=), the 10 most recent characters were: "peg; name=" at com.sun.mail.util.BASE64DecoderStream.decode(BASE64DecoderStream.java:266) at com.sun.mail.util.BASE64DecoderStream.read(BASE64DecoderStream.java:144) at java.io.FilterInputStream.read(FilterInputStream.java:107) at javax.activation.DataHandler.writeTo(DataHandler.java:308) at com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler.getFileFromPart(AbstractMessageHandler.java:1182) I'm attaching the atlassian-jira.log if that helps. I'm currently asking for recommendations and your assistance. Thanks in advance.

    Atlassian JIRA | 3 years ago | Nicolas Bouchet
    com.sun.mail.util.DecodingException: BASE64Decoder: Error in encoded stream: needed at least 2 valid base64 characters, but only got 1 before padding character (=), the 10 most recent characters were: "peg; name="
  2. 0

    Hi everyone, I'm currently facing a problematic of non parsing incoming mail to jira. Mail handler configuration was done and it worked for weeks without any problems. I encountered a problem with a first mail and then all following ones are not correctly parsed. Issue is created, subject is correctly set but the description contains the mail header, as raw data (attached screenshots) I tried restarting jira, we deleted the mail handler and recreated it and none worked so far. We were not able to reproduce that problematic on the test environment that features the same jira setup and configuration. Both servers use the same mail server but different accounts. In the logs, not much I'm afraid, we once had a : com.sun.mail.util.DecodingException: BASE64Decoder: Error in encoded stream: needed at least 2 valid base64 characters, but only got 1 before padding character (=), the 10 most recent characters were: "peg; name=" at com.sun.mail.util.BASE64DecoderStream.decode(BASE64DecoderStream.java:266) at com.sun.mail.util.BASE64DecoderStream.read(BASE64DecoderStream.java:144) at java.io.FilterInputStream.read(FilterInputStream.java:107) at javax.activation.DataHandler.writeTo(DataHandler.java:308) at com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler.getFileFromPart(AbstractMessageHandler.java:1182) I'm attaching the atlassian-jira.log if that helps. I'm currently asking for recommendations and your assistance. Thanks in advance.

    Atlassian JIRA | 3 years ago | Nicolas Bouchet
    com.sun.mail.util.DecodingException: BASE64Decoder: Error in encoded stream: needed at least 2 valid base64 characters, but only got 1 before padding character (=), the 10 most recent characters were: "peg; name="
  3. 0

    Alternate Java Client library to JavaMail?

    Stack Overflow | 3 years ago | tbeernot
    com.sun.mail.util.DecodingException: BASE64Decoder: Error in encoded stream: found valid base64 character after a padding character (=), the 10 most recent characters were: "am; name=9"
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    The exception below occurs 1-2 times a day on a server handling between a few hundred and a few thousands of messages per day. I took a short look at the code, and it looks like there's a MimeMessageCopyOnWriteProxy wrapping a null message. A few possible causes: - MessageReferenceTracker.getWrapped() should be synchronized, as the field is neither final nor volatile and so it's possible that a thread other than the one which creates it will see a null wrapped message. - the refCount field is not properly synchronized nor volatile so methods which set/replace its value (private constructor, getWrappedMessageForWriting) may cause some threads to see the new instance and some the old one. this can result in buggy reference counting, which can result in the wrapped message being set to null (when reference count is decreased too much) and then being accessed. - a MailImpl is being constructed (or copy-constructed) somewhere with a null message (which is passed on to the proxy class). - something completely different. The stacktrace from spoolmanager log: 25/04/09 02:00:58 ERROR spoolmanager.transport: Exception calling LocalDelivery: Exception spooling message: Exception caught while storing mail Container: javax.mail.MessagingException: Exception spooling message: Exception caught while storing mail Container: ; nested exception is: javax.mail.MessagingException: Exception caught while storing mail Container: ; nested exception is: java.lang.NullPointerException at org.apache.james.James.sendMail(James.java:501) at org.apache.james.James.sendMail(James.java:454) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:134) at $Proxy9.sendMail(Unknown Source) at org.apache.james.transport.mailets.ToMultiRepository.service(ToMultiRepository.java:183) at org.apache.james.transport.mailets.LocalDelivery.service(LocalDelivery.java:66) at org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:424) at org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:405) at org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:309) at java.lang.Thread.run(Unknown Source) Caused by: javax.mail.MessagingException: Exception caught while storing mail Container: ; nested exception is: java.lang.NullPointerException at org.apache.james.mailrepository.JDBCMailRepository.store(JDBCMailRepository.java:764) at org.apache.james.mailrepository.JDBCSpoolRepository.store(JDBCSpoolRepository.java:240) at org.apache.james.mailrepository.MailStoreSpoolRepository.store(MailStoreSpoolRepository.java:126) at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:134) at $Proxy5.store(Unknown Source) at org.apache.james.James.sendMail(James.java:493) ... 13 more Caused by: java.lang.NullPointerException at org.apache.james.core.MimeMessageUtil.calculateMessageSize(MimeMessageUtil.java:277) at org.apache.james.core.MimeMessageUtil.getMessageSize(MimeMessageUtil.java:261) at org.apache.james.core.MimeMessageCopyOnWriteProxy.getMessageSize(MimeMessageCopyOnWriteProxy.java:745) at org.apache.james.core.MimeMessageUtil.getMessageSize(MimeMessageUtil.java:257) at org.apache.james.core.MailImpl.getMessageSize(MailImpl.java:372) at org.apache.james.mailrepository.MessageInputStream.<init>(MessageInputStream.java:53) at org.apache.james.mailrepository.JDBCMailRepository.store(JDBCMailRepository.java:718) ... 21 more javax.mail.MessagingException: Exception caught while storing mail Container: ; nested exception is: java.lang.NullPointerException at org.apache.james.mailrepository.JDBCMailRepository.store(JDBCMailRepository.java:764) at org.apache.james.mailrepository.JDBCSpoolRepository.store(JDBCSpoolRepository.java:240) at org.apache.james.mailrepository.MailStoreSpoolRepository.store(MailStoreSpoolRepository.java:126) at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:134) at $Proxy5.store(Unknown Source) at org.apache.james.James.sendMail(James.java:493) at org.apache.james.James.sendMail(James.java:454) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:134) at $Proxy9.sendMail(Unknown Source) at org.apache.james.transport.mailets.ToMultiRepository.service(ToMultiRepository.java:183) at org.apache.james.transport.mailets.LocalDelivery.service(LocalDelivery.java:66) at org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:424) at org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:405) at org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:309) at java.lang.Thread.run(Unknown Source) Caused by: java.lang.NullPointerException at org.apache.james.core.MimeMessageUtil.calculateMessageSize(MimeMessageUtil.java:277) at org.apache.james.core.MimeMessageUtil.getMessageSize(MimeMessageUtil.java:261) at org.apache.james.core.MimeMessageCopyOnWriteProxy.getMessageSize(MimeMessageCopyOnWriteProxy.java:745) at org.apache.james.core.MimeMessageUtil.getMessageSize(MimeMessageUtil.java:257) at org.apache.james.core.MailImpl.getMessageSize(MailImpl.java:372) at org.apache.james.mailrepository.MessageInputStream.<init>(MessageInputStream.java:53) at org.apache.james.mailrepository.JDBCMailRepository.store(JDBCMailRepository.java:718) ... 21 more java.lang.NullPointerException at org.apache.james.core.MimeMessageUtil.calculateMessageSize(MimeMessageUtil.java:277) at org.apache.james.core.MimeMessageUtil.getMessageSize(MimeMessageUtil.java:261) at org.apache.james.core.MimeMessageCopyOnWriteProxy.getMessageSize(MimeMessageCopyOnWriteProxy.java:745) at org.apache.james.core.MimeMessageUtil.getMessageSize(MimeMessageUtil.java:257) at org.apache.james.core.MailImpl.getMessageSize(MailImpl.java:372) at org.apache.james.mailrepository.MessageInputStream.<init>(MessageInputStream.java:53) at org.apache.james.mailrepository.JDBCMailRepository.store(JDBCMailRepository.java:718) at org.apache.james.mailrepository.JDBCSpoolRepository.store(JDBCSpoolRepository.java:240) at org.apache.james.mailrepository.MailStoreSpoolRepository.store(MailStoreSpoolRepository.java:126) at sun.reflect.GeneratedMethodAccessor10.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:134) at $Proxy5.store(Unknown Source) at org.apache.james.James.sendMail(James.java:493) at org.apache.james.James.sendMail(James.java:454) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at org.apache.avalon.phoenix.components.application.BlockInvocationHandler.invoke(BlockInvocationHandler.java:134) at $Proxy9.sendMail(Unknown Source) at org.apache.james.transport.mailets.ToMultiRepository.service(ToMultiRepository.java:183) at org.apache.james.transport.mailets.LocalDelivery.service(LocalDelivery.java:66) at org.apache.james.transport.LinearProcessor.service(LinearProcessor.java:424) at org.apache.james.transport.JamesSpoolManager.process(JamesSpoolManager.java:405) at org.apache.james.transport.JamesSpoolManager.run(JamesSpoolManager.java:309) at java.lang.Thread.run(Unknown Source)

    Apache's JIRA Issue Tracker | 8 years ago | Amichai Rothman
    com.sun.mail.util.DecodingException: BASE64Decoder: Error in encoded stream: needed 4 valid base64 characters but only got 2 before EOF, the 10 most recent characters were: "\130\190\130\179\130\162\129B\r\n"
  6. 0

    Bug 965 – base64 decoding of multipart mime text checks for error too soon

    kenai.com | 9 months ago
    com.sun.mail.util.DecodingException: BASE64Decoder: Error in encoded stream: needed at least 2 valid base64 characters, but only got 0 before padding character (=), the 10 most recent characters were: "IGFyZSEi\n="

    1 unregistered visitors
    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. com.sun.mail.util.DecodingException

      BASE64Decoder: Error in encoded stream: needed at least 2 valid base64 characters, but only got 1 before padding character (=), the 10 most recent characters were: "peg; name="

      at com.sun.mail.util.BASE64DecoderStream.decode()
    2. JavaMail API (compat)
      BASE64DecoderStream.read
      1. com.sun.mail.util.BASE64DecoderStream.decode(BASE64DecoderStream.java:266)
      2. com.sun.mail.util.BASE64DecoderStream.read(BASE64DecoderStream.java:144)
      2 frames
    3. Java RT
      DataHandler.writeTo
      1. java.io.FilterInputStream.read(FilterInputStream.java:107)
      2. javax.activation.DataHandler.writeTo(DataHandler.java:308)
      2 frames
    4. com.atlassian.jira
      AbstractMessageHandler.getFileFromPart
      1. com.atlassian.jira.plugins.mail.handlers.AbstractMessageHandler.getFileFromPart(AbstractMessageHandler.java:1182)
      1 frame