Never use default instance, always create a new one because it can happen that upon bundle reinstall the session context has changed and the authenticator will deny access because object id will have changed

This commit is contained in:
Simon Pamies committed 2013-03-06 08:20:30 +01:00
1 parent 11ba82489c
commit d6a87b3301
1 file changed
+1 -1
@@ -112,7 +112,7 @@ public class OSGiRestartingPortMonitor extends AbstractPortMonitor {
private void sendMail(Endpoint endpoint, final String subject, String content) throws MessagingException, AddressException,
NoSuchProviderException {
Session session = Session.getDefaultInstance(this.properties, new SMTPAuthenticator());
Session session = Session.getInstance(this.properties, new SMTPAuthenticator());
MimeMessage msg = new MimeMessage(session);
msg.setFrom(new InternetAddress("root@sapsailing.com"));
msg.setSubject(subject);