Support Article
Particular Email not captured by Email Listener
SA-22629
Summary
Particular email was not captured by Email Listener in the user environments and the below error is observed in log files.
Error Messages
2016-03-15 12:16:02,159 [fault (self-tuning)'] [ STANDARD] ( services.email.EmailListener) ERROR EMAIL.ABCDCareListener_1.Listener|from([email protected])|sub(Re: Insura) - Caught unexpected exception. Will attempt to mark mail as 'seen'.
java.lang.NullPointerException: charsetName
at java.io.InputStreamReader.<init>(InputStreamReader.java:82)
at com.sun.xml.ws.encoding.StringDataContentHandler.getContent(StringDataContentHandler.java:118)
at javax.activation.DataSourceDataContentHandler.getContent(DataHandler.java:775)
at javax.activation.DataHandler.getContent(DataHandler.java:522)
at javax.mail.internet.MimeBodyPart.getContent(MimeBodyPart.java:652)
at com.pega.pegarules.integration.engine.internal.services.email.EmailListener.readRequestDataPart(EmailListener.java:2895)
at com.pega.pegarules.integration.engine.internal.services.email.EmailListener.extractMessageContent(EmailListener.java:2243)
at com.pega.pegarules.integration.engine.internal.services.email.EmailListener.handleStandardRequest(EmailListener.java:1878)
at com.pega.pegarules.integration.engine.internal.services.email.EmailListener.handleRequest(EmailListener.java:2037)
at com.pega.pegarules.integration.engine.internal.services.email.EmailListener.emailProcess(EmailListener.java:1763)
Steps to Reproduce
1. Mark this particular .eml file as Unread.
2. Run the EmailListener to pick this email.
3. See the error message in logs.
Root Cause
It has been found out that one of the mail part contains content-type as "text/plain" with cp932 charset. CP932 is an extension of Japanese encoding to represent Japanese text, user is unsure why one of the mail part charset is set to cp932 when there are no Japanese characters in email content. cp932 is not listed as a standard format in the supported encodings as per Java API docs.Ideally user would be seeing UnSupportedEncodingException instead of NullPointerException, after inspecting the stack trace this is due to StringDataContentHandler class, which is getting referenced from weblogic app server library glassfish.jaxws.rt_1.3.0.0_2-1-5.jar. And this version of class definition don't have a NPE check on charset.
Resolution
Make the following change to the operating environment:
Upgrade the glassfish.jaxws.rt_1.3.0.0_2-1-5.jar to 2.2.5 version which does contain a NPE check for charset.
User should not be seeing this exception post upgrade of this class.
Published April 29, 2016 - Updated October 8, 2020
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.