Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.3.2
-
None
-
Bug is in FetchMail.java
Description
James-fetchmail.xml permits you to set the mail API properies via the JavaMailProperties element e.g:
<javaMailProperties>
<property name="mail.pop3.connectiontimeout" value="0"/>
<property name="mail.pop3.timeout" value="0"/>
<property name="mail.pop3.port" value="2000"/>
</javaMailProperties>
However, the FetchMail class passes a reference to the Systems.getProperties() class into the Service that interacts with the MailAPI, this means that multiple instances of the FetchMail class are actually sharing the same Properties class and prevents different values from being set, e.g. the mail.pop3.port.
A simple fix for this bug is to change FetchMail.computeSession() so a new instance of a PropertiesClass is passed in to create the session instance, using the System Properties as a default, as per the example below:
/**
- Answers a new Session.
- @return Session
*/
protected Session computeSession() { // Make separate properties instance so the // fetchmail.xml <javaMailProperties> can override the // property values without interfering with other fetchmail instances return Session.getInstance( new Properties( System.getProperties()) ); }