[jboss-jira] [JBoss JIRA] Created: (JBMAIL-250) MailUserImpl.getAliases(..) throws an NPE if there is no mailbox for a given alias to check.
David Fuelling (JIRA)
jira-events at jboss.com
Thu Sep 28 09:07:41 EDT 2006
MailUserImpl.getAliases(..) throws an NPE if there is no mailbox for a given alias to check.
--------------------------------------------------------------------------------------------
Key: JBMAIL-250
URL: http://jira.jboss.com/jira/browse/JBMAIL-250
Project: JBoss Mail
Issue Type: Patch
Security Level: Public (Everyone can see)
Components: Mail Server APIs
Affects Versions: 1.0-M5, 1.0-RC1
Environment: WinXp, Jdk 1.5
Reporter: David Fuelling
Assigned To: Andrew Oliver
Priority: Minor
MailUserImpl.getAliases(..) throws an NPE if there is no mailbox for a given alias to check. Instead, the function should simply check if the mbox is null, and if so, simply return an empty list of aliases (i.e., there are no aliases for this user).
Here is my patch:
Index: MailSenderImpl.java
===================================================================
RCS file: /cvsroot/jboss/jboss-mail/src/java/org/jboss/mail/userapi/MailSenderImpl.java,v
retrieving revision 1.13
diff -u -r1.13 MailSenderImpl.java
--- MailSenderImpl.java 13 Jun 2006 23:53:04 -0000 1.13
+++ MailSenderImpl.java 28 Sep 2006 13:05:06 -0000
@@ -273,6 +273,9 @@
@Tx(TxType.REQUIRED)
public List<String> getAliases(String user) {
Mailbox box = this.mailboxService.getMailboxByAlias(user);
+ if(box == null)
+ return new ArrayList<String>(); //No Aliases exist for this user.
+
Collection<Alias> a = box.getAliases();
List<String> l = new ArrayList<String>(a.size());
Iterator<Alias> i = a.iterator();
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list