You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by "Stefano Bagnara (JIRA)" <se...@james.apache.org> on 2006/07/08 16:07:29 UTC

[jira] Created: (JAMES-558) MailImpl expose internal representation on getRecipients. This is a bad practice.

MailImpl expose internal representation on getRecipients. This is a bad practice.
---------------------------------------------------------------------------------

         Key: JAMES-558
         URL: http://issues.apache.org/jira/browse/JAMES-558
     Project: James
        Type: Bug

  Components: James Core  
    Reporter: Stefano Bagnara
     Fix For: 3.0


Currently our getRecipients expose the internal collection and it is used that way.
To add recipients we use getRecipients().add(), to store multiple times a single mail to different recipients we get the recipients collection and alter it between store of the mail object (in RemoteDelivery).
All of this seems to me bad practice and we should better encapsulate the recipients list in the mail object.
Maybe the simple way is to return immutable collections so we'll find bugs as soon as possible and add methods to add and remove recipients directly in the mail interface.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Updated: (JAMES-558) MailImpl expose internal representation on getRecipients. This is a bad practice.

Posted by "Stefano Bagnara (JIRA)" <se...@james.apache.org>.
     [ http://issues.apache.org/jira/browse/JAMES-558?page=all ]

Stefano Bagnara updated JAMES-558:
----------------------------------

    Component: Mailet API

> MailImpl expose internal representation on getRecipients. This is a bad practice.
> ---------------------------------------------------------------------------------
>
>          Key: JAMES-558
>          URL: http://issues.apache.org/jira/browse/JAMES-558
>      Project: James
>         Type: Bug

>   Components: Mailet API, James Core
>     Reporter: Stefano Bagnara
>      Fix For: 3.0

>
> Currently our getRecipients expose the internal collection and it is used that way.
> To add recipients we use getRecipients().add(), to store multiple times a single mail to different recipients we get the recipients collection and alter it between store of the mail object (in RemoteDelivery).
> All of this seems to me bad practice and we should better encapsulate the recipients list in the mail object.
> Maybe the simple way is to return immutable collections so we'll find bugs as soon as possible and add methods to add and remove recipients directly in the mail interface.

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


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Resolved: (JAMES-558) MailImpl expose internal representation on getRecipients. This is a bad practice.

Posted by "Norman Maurer (JIRA)" <se...@james.apache.org>.
     [ https://issues.apache.org/jira/browse/JAMES-558?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Norman Maurer resolved JAMES-558.
---------------------------------

    Resolution: Duplicate

Moved to MAILET-5



> MailImpl expose internal representation on getRecipients. This is a bad practice.
> ---------------------------------------------------------------------------------
>
>                 Key: JAMES-558
>                 URL: https://issues.apache.org/jira/browse/JAMES-558
>             Project: James
>          Issue Type: Bug
>          Components: James Core, Mailet API
>            Reporter: Stefano Bagnara
>         Assigned To: Norman Maurer
>             Fix For: Trunk
>
>
> Currently our getRecipients expose the internal collection and it is used that way.
> To add recipients we use getRecipients().add(), to store multiple times a single mail to different recipients we get the recipients collection and alter it between store of the mail object (in RemoteDelivery).
> All of this seems to me bad practice and we should better encapsulate the recipients list in the mail object.
> Maybe the simple way is to return immutable collections so we'll find bugs as soon as possible and add methods to add and remove recipients directly in the mail interface.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Commented: (JAMES-558) MailImpl expose internal representation on getRecipients. This is a bad practice.

Posted by "Norman Maurer (JIRA)" <se...@james.apache.org>.
    [ http://issues.apache.org/jira/browse/JAMES-558?page=comments#action_12461423 ] 
            
Norman Maurer commented on JAMES-558:
-------------------------------------

We should fix this in next james release. The "correct" way whould be to use Collections.unmodifiableCollection(recipientCol); to return the recipients collection. After that we need to add a addRecipient(MailAddress rec) and removeRecipient(MailAddress rec) to the Mail interfaces. 

Any thoughts ?

> MailImpl expose internal representation on getRecipients. This is a bad practice.
> ---------------------------------------------------------------------------------
>
>                 Key: JAMES-558
>                 URL: http://issues.apache.org/jira/browse/JAMES-558
>             Project: James
>          Issue Type: Bug
>          Components: Mailet API, James Core
>            Reporter: Stefano Bagnara
>             Fix For: Trunk
>
>
> Currently our getRecipients expose the internal collection and it is used that way.
> To add recipients we use getRecipients().add(), to store multiple times a single mail to different recipients we get the recipients collection and alter it between store of the mail object (in RemoteDelivery).
> All of this seems to me bad practice and we should better encapsulate the recipients list in the mail object.
> Maybe the simple way is to return immutable collections so we'll find bugs as soon as possible and add methods to add and remove recipients directly in the mail interface.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


[jira] Assigned: (JAMES-558) MailImpl expose internal representation on getRecipients. This is a bad practice.

Posted by "Norman Maurer (JIRA)" <se...@james.apache.org>.
     [ http://issues.apache.org/jira/browse/JAMES-558?page=all ]

Norman Maurer reassigned JAMES-558:
-----------------------------------

    Assignee: Norman Maurer

> MailImpl expose internal representation on getRecipients. This is a bad practice.
> ---------------------------------------------------------------------------------
>
>                 Key: JAMES-558
>                 URL: http://issues.apache.org/jira/browse/JAMES-558
>             Project: James
>          Issue Type: Bug
>          Components: Mailet API, James Core
>            Reporter: Stefano Bagnara
>         Assigned To: Norman Maurer
>             Fix For: Trunk
>
>
> Currently our getRecipients expose the internal collection and it is used that way.
> To add recipients we use getRecipients().add(), to store multiple times a single mail to different recipients we get the recipients collection and alter it between store of the mail object (in RemoteDelivery).
> All of this seems to me bad practice and we should better encapsulate the recipients list in the mail object.
> Maybe the simple way is to return immutable collections so we'll find bugs as soon as possible and add methods to add and remove recipients directly in the mail interface.

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

        

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org