Esempio n. 1
0
 /**
  * Parse the headerValue and delegate to {@link #getMailboxAddress(Mailbox)}
  *
  * <p>If no mailbox name is found an empty String is returned
  *
  * @param headerValue
  * @return mailbox
  */
 public static String getMailboxAddress(String headerValue) {
   AddressList aList = LenientAddressParser.DEFAULT.parseAddressList(headerValue);
   for (Address address : aList) {
     if (address instanceof Mailbox) {
       Mailbox m = (Mailbox) address;
       String mailboxName = m.getLocalPart();
       if (mailboxName == null) {
         mailboxName = "";
       }
       return mailboxName;
     } else if (address instanceof Group) {
       MailboxList mList = ((Group) address).getMailboxes();
       for (int a = 0; a < mList.size(); ) {
         String mailboxName = mList.get(a).getLocalPart();
         if (mailboxName == null) {
           mailboxName = "";
         }
         return mailboxName;
       }
     }
   }
   return "";
 }