## Monday, November 19, 2007

### NPE when sending mail (JavaMail 1.4) in Ubuntu

Never noticed this before, but it came up today. I tried to send some mail, and got this nasty exception:

org.springframework.web.util.NestedServletException: Request processing failed;
nested exception is java.lang.NullPointerException
Caused by: java.lang.NullPointerException
at java.lang.String.concat(String.java:1503)
at com.sun.activation.registries.MailcapFile.parseLine(MailcapFile.java:235)
at com.sun.activation.registries.MailcapFile.parse(MailcapFile.java:197)
at com.sun.activation.registries.MailcapFile.createMailcapHash(MailcapFile.java:157)
at com.sun.activation.registries.MailcapFile.<init>(MailcapFile.java:40)
at javax.activation.MailcapCommandMap.loadFile(MailcapCommandMap.java:276)
at javax.activation.MailcapCommandMap.<init>(MailcapCommandMap.java:128)


Curiously, this didn't occur until I started Mavenizing the project I was working on, though I was using the same version of JavaMail as before. The fix? Apparently it only happens if you're using Ubuntu. Open up ~/.mailcap and delete the -e at the top of the file.