Hi team!

Some month ago I was interesting in servicemix-mail component and I began to use servicemix 3.3-snapshot in SM 3.2.1 version.

For now I have 2 notes regarding implementation of component:

1. class MailSenderEndpoint :
   method processInOut and method processInOnly:


  snippet from code:

 ...
 Transport.send(msg);
 ...


Found issue:
  it is not possible to use SMTPS (for example, gmail)

connection: smtps://[EMAIL PROTECTED]


Steps to resolve:

 replace snippet from code with

 ...
Transport transport = session.getTransport();

                transport.connect(
                                MailSenderEndpoint.this.config.getHost(),
                                MailSenderEndpoint.this.config.getPort(),
                                MailSenderEndpoint.this.config.getUsername(),
                                MailSenderEndpoint.this.config.getPassword()
                                );
transport.sendMessage(msg, msg.getAllRecipients());
                transport.close();
...



2. class AbstractMailMarchaller is not thread-safe:


private List<File> temporaryFiles = new ArrayList<File>();


I would to replace it with:

private Map< String, List<File> > temporaryFilesMap = Collections.synchronizedMap(new HashMap<String, List<File> >());


and:

protected final void addTemporaryResource(String id, File tmpFile) {
        if (!this.temporaryFilesMap.containsKey(id))
                this.temporaryFilesMap.put(id, new ArrayList<File>());
        this.temporaryFilesMap.get(id).add(tmpFile);
    }

and:

    public final void cleanUpResources(String id) {
        List<File> list = this.temporaryFilesMap.get(id);
        if (list!=null){                
                for (File f : list) {
                    f.delete();
                }
                list.clear();
                this.temporaryFilesMap.remove(id);
        }
    }


And do necessary changes in code from other classes (also it is needed to update tests to avoid NullPointerException, I mean following: replace InOnly exchange = new InOnlyImpl() with InOnly exchange = new InOnlyImpl("id"))


Can I create JIRA-tasks for this 2 issues?

  Ivan Pryvalov.

Reply via email to