[jbossseam-issues] [JBoss JIRA] Created: (JBSEAM-4176) MailSession can't be set to use auth in one environment and not in another

Devon Hillard (JIRA) jira-events at lists.jboss.org
Thu May 14 13:00:58 EDT 2009


MailSession can't be set to use auth in one environment and not in another
--------------------------------------------------------------------------

                 Key: JBSEAM-4176
                 URL: https://jira.jboss.org/jira/browse/JBSEAM-4176
             Project: Seam
          Issue Type: Bug
          Components: Core
    Affects Versions: 2.1.1.GA
            Reporter: Devon Hillard
            Priority: Minor


(Summary could be worded better)

If you define MailSession in components.xml like this:

<mail:mail-session host="@mailhost@" port="@mailport@" username="@mailusername@" password="@mailpassword@" />

And set the mailusername and mailpassword in the environment specific components.properties files, you can't use a mail server without authentication in any environment.

Putting this in a components.properties:

mailusername=

seems to set an empty string into the property, which passes the "(getUsername() != null" test in MailSession.java used to determine if it should authenticate with the mail server.

Therefore it tries to authenticate with empty username and password, which typically fails on a system that doesn't not require auth for outgoing mail (from internal servers for instance).

In this scenario our dev environment needs to use a mail server that does require auth, but in production, it needs to use a mail server without auth.  Currently this is requiring us to manually change the components.xml to have:

<mail:mail-session host="@mailhost@" port="@mailport@" />

in the production ear.

A simple fix would be to change the logic in MailSession to do:

getUsername() != null && getUsername().trim().length() > 0 instead of the current null check.

The relevant lines to change are 105, 109, and 152.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        



More information about the seam-issues mailing list