title: JavaMail attachment nullPointer
body: <p>I have test code for my mail sending method. Sending only with html work fine, but I try to add attachment (local file, so "file://..."), and i get that. : </p>
  
  <blockquote>
    <p>java.lang.NullPointerException at
    javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:226)</p>
  </blockquote>
  
  <p>My code  :</p>
  
  <pre><code>@Inject
  private JavaMailSender mailSender;
  
  ...
  
  MimeMessage message = mailSender.createMimeMessage();
  Multipart multipart = new MimeMultipart();
  
  // html
  MimeBodyPart htmlPart = new MimeBodyPart();
  htmlPart.setText(SomeHtml, "text/html; charset=\"UTF-8\"");
  multipart.addBodyPart(htmlPart);
  
  // image
  MimeBodyPart imageBodyPart = new MimeBodyPart();
  String fileName = ClassLoader.getSystemResource("chat1.jpg").toString();
  DataSource source = new FileDataSource(fileName);
  imageBodyPart.setDataHandler(new DataHandler(source));
  imageBodyPart.setFileName(fileName);
  multipart.addBodyPart(imageBodyPart);
  
  message.setContent(multipart);
  mailSender.send(message);
  </code></pre>
  
  <p>I've tried to use <code>MimeMessageHelper</code>, but i've got same result.
  I've tried <code>source.getInputStream().close()</code>, i've got <code>java.io.FileNotFoundException</code> (but i can find my image when i paste path into browser or explorer)</p>
  
  <p>I don't understand, Any idea ?
  Thanks !</p>