commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ep...@apache.org
Subject cvs commit: jakarta-commons/email/xdocs changes.xml
Date Mon, 29 Nov 2004 17:33:12 GMT
epugh       2004/11/29 09:33:12

  Modified:    email/src/test/org/apache/commons/mail HtmlEmailTest.java
                        EmailTest.java SendWithAttachmentsTest.java
                        MultiPartEmailTest.java SimpleEmailTest.java
               email/src/java/org/apache/commons/mail MultiPartEmail.java
                        SimpleEmail.java Email.java HtmlEmail.java
               email/src/test/org/apache/commons/mail/mocks
                        MockEmailConcrete.java
               email/xdocs changes.xml
  Added:       email/src/java/org/apache/commons/mail EmailException.java
  Log:
  Wrap all exceptions in EmailException.
  
  Revision  Changes    Path
  1.3       +109 -162  jakarta-commons/email/src/test/org/apache/commons/mail/HtmlEmailTest.java
  
  Index: HtmlEmailTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/email/src/test/org/apache/commons/mail/HtmlEmailTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- HtmlEmailTest.java	29 Nov 2004 09:59:11 -0000	1.2
  +++ HtmlEmailTest.java	29 Nov 2004 17:33:12 -0000	1.3
  @@ -17,11 +17,8 @@
   
   import java.io.File;
   import java.io.IOException;
  -import java.net.MalformedURLException;
   import java.net.URL;
   
  -import javax.mail.MessagingException;
  -
   import org.apache.commons.mail.mocks.MockHtmlEmailConcrete;
   import org.apache.commons.mail.settings.EmailConfiguration;
   
  @@ -67,9 +64,9 @@
                   assertEquals(testCharsValid[i], this.email.getTextMsg());
               }
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
  -            e.printStackTrace();
  +            fail("Shoudn't have thrown exception");
           }
   
           // ====================================================================
  @@ -82,13 +79,12 @@
                   this.email.setTextMsg(this.testCharsNotValid[i]);
                   fail("Should have thrown an exception");
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   assertTrue(true);
               }
               catch (Exception e)
               {
  -                e.printStackTrace();
                   fail("Unexpected exception thrown");
               }
           }
  @@ -109,9 +105,9 @@
                   assertEquals(testCharsValid[i], this.email.getHtmlMsg());
               }
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
  -            e.printStackTrace();
  +            fail("Shoudn't have thrown exception");
           }
   
           // ====================================================================
  @@ -124,13 +120,12 @@
                   this.email.setHtmlMsg(this.testCharsNotValid[i]);
                   fail("Should have thrown an exception");
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   assertTrue(true);
               }
               catch (Exception e)
               {
  -                e.printStackTrace();
                   fail("Unexpected exception thrown");
               }
           }
  @@ -154,9 +149,9 @@
                       this.email.getHtmlMsg().indexOf(testCharsValid[i]) != -1);
               }
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
  -            e.printStackTrace();
  +            fail("Shoudn't have thrown exception");
           }
   
           // ====================================================================
  @@ -169,13 +164,12 @@
                   this.email.setMsg(this.testCharsNotValid[i]);
                   fail("Should have thrown an exception");
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   assertTrue(true);
               }
               catch (Exception e)
               {
  -                e.printStackTrace();
                   fail("Unexpected exception thrown");
               }
           }
  @@ -183,28 +177,16 @@
       }
   
       /** */
  -    public void testEmbed()
  +    public void testEmbed() throws Exception
       {
           // ====================================================================
           // Test Success
           // ====================================================================
  -        try
  -        {
  -            String strEmbed =
  -                this.email.embed(new URL(this.strTestURL), "Test name");
  -            assertNotNull(strEmbed);
  -            assertEquals(HtmlEmail.CID_LENGTH, strEmbed.length());
  -        }
  -        catch (MessagingException e)
  -        {
  -            e.printStackTrace();
  -            fail("Unexpected exception thrown");
  -        }
  -        catch (MalformedURLException e)
  -        {
  -            e.printStackTrace();
  -            fail("Unexpected exception thrown");
  -        }
  +
  +        String strEmbed =
  +            this.email.embed(new URL(this.strTestURL), "Test name");
  +        assertNotNull(strEmbed);
  +        assertEquals(HtmlEmail.CID_LENGTH, strEmbed.length());
   
           // ====================================================================
           // Test Exceptions
  @@ -215,13 +197,12 @@
               this.email.embed(new URL("http://bad.url"), "Test name");
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
           catch (Exception e)
           {
  -            e.printStackTrace();
               fail("Unexpected exception thrown");
           }
       }
  @@ -239,7 +220,6 @@
           }
           catch (IOException e)
           {
  -            e.printStackTrace();
               fail("Test file cannot be found");
           }
   
  @@ -314,21 +294,10 @@
                   this.email.getBccList(),
                   false);
           }
  -        catch (MessagingException e)
  +        catch (Exception e)
           {
  -            e.printStackTrace();
               fail("Unexpected exception thrown");
           }
  -        catch (MalformedURLException e)
  -        {
  -            e.printStackTrace();
  -            fail("Unexpected exception thrown");
  -        }
  -        catch (IOException e)
  -        {
  -            e.printStackTrace();
  -            fail("Failed to save email to output file");
  -        }
   
           try
           {
  @@ -364,134 +333,112 @@
                   this.email.getBccList(),
                   true);
           }
  -        catch (MessagingException e)
  +
  +        catch (IOException e)
           {
  -            e.printStackTrace();
  -            fail("Unexpected exception thrown");
  +            fail("Failed to save email to output file");
           }
  -        catch (IOException e)
  +        catch (Exception e)
           {
               e.printStackTrace();
  -            fail("Failed to save email to output file");
  +            fail("Unexpected exception thrown");
           }
       }
   
       /** */
  -    public void testSend2()
  +    public void testSend2() throws Exception
       {
           // ====================================================================
           // Test Success
           // ====================================================================
  -        try
  -        {
  -            this.getMailServer();
  -
  -            this.email = new MockHtmlEmailConcrete();
  -            this.email.setHostName(this.strTestMailServer);
  -            this.email.setSmtpPort(this.intTestMailServerPort);
  -            this.email.setFrom(this.strTestMailFrom);
  -            this.email.addTo(this.strTestMailTo);
  -
  -            if (this.strTestUser != null && this.strTestPasswd != null)
  -            {
  -                this.email.setAuthentication(
  -                    this.strTestUser,
  -                    this.strTestPasswd);
  -            }
   
  -            String strSubject = "Test HTML Send #2 Subject (wo charset)";
  -            this.email.setSubject(strSubject);
  -            this.email.setMsg("Test txt msg");
  +        this.getMailServer();
   
  -            this.email.send();
  -            this.fakeMailServer.stop();
  -            // validate txt message
  -            validateSend(
  -                this.fakeMailServer,
  -                strSubject,
  -                this.email.getTextMsg(),
  -                this.email.getFromAddress(),
  -                this.email.getToList(),
  -                this.email.getCcList(),
  -                this.email.getBccList(),
  -                true);
  -
  -            // validate html message
  -            validateSend(
  -                this.fakeMailServer,
  -                strSubject,
  -                this.email.getHtmlMsg(),
  -                this.email.getFromAddress(),
  -                this.email.getToList(),
  -                this.email.getCcList(),
  -                this.email.getBccList(),
  -                false);
  -        }
  -        catch (MessagingException e)
  -        {
  -            e.printStackTrace();
  -            fail("Unexpected exception thrown");
  -        }
  -        catch (IOException e1)
  -        {
  -            e1.printStackTrace();
  -        }
  -
  -        try
  -        {
  -            this.getMailServer();
  -
  -            this.email = new MockHtmlEmailConcrete();
  -            this.email.setHostName(this.strTestMailServer);
  -            this.email.setFrom(this.strTestMailFrom);
  -            this.email.setSmtpPort(this.intTestMailServerPort);
  -            this.email.addTo(this.strTestMailTo);
  -
  -            if (this.strTestUser != null && this.strTestPasswd != null)
  -            {
  -                this.email.setAuthentication(
  -                    this.strTestUser,
  -                    this.strTestPasswd);
  -            }
  -
  -            String strSubject = "Test HTML Send #2 Subject (w charset)";
  -            this.email.setCharset(Email.ISO_8859_1);
  -            this.email.setSubject(strSubject);
  -            this.email.setMsg("Test txt msg");
  -
  -            this.email.send();
  -            this.fakeMailServer.stop();
  -            // validate txt message
  -            validateSend(
  -                this.fakeMailServer,
  -                strSubject,
  -                this.email.getTextMsg(),
  -                this.email.getFromAddress(),
  -                this.email.getToList(),
  -                this.email.getCcList(),
  -                this.email.getBccList(),
  -                true);
  +        this.email = new MockHtmlEmailConcrete();
  +        this.email.setHostName(this.strTestMailServer);
  +        this.email.setSmtpPort(this.intTestMailServerPort);
  +        this.email.setFrom(this.strTestMailFrom);
  +        this.email.addTo(this.strTestMailTo);
  +
  +        if (this.strTestUser != null && this.strTestPasswd != null)
  +        {
  +            this.email.setAuthentication(
  +                this.strTestUser,
  +                this.strTestPasswd);
  +        }
  +
  +        String strSubject = "Test HTML Send #2 Subject (wo charset)";
  +        this.email.setSubject(strSubject);
  +        this.email.setMsg("Test txt msg");
  +
  +        this.email.send();
  +        this.fakeMailServer.stop();
  +        // validate txt message
  +        validateSend(
  +            this.fakeMailServer,
  +            strSubject,
  +            this.email.getTextMsg(),
  +            this.email.getFromAddress(),
  +            this.email.getToList(),
  +            this.email.getCcList(),
  +            this.email.getBccList(),
  +            true);
  +
  +        // validate html message
  +        validateSend(
  +            this.fakeMailServer,
  +            strSubject,
  +            this.email.getHtmlMsg(),
  +            this.email.getFromAddress(),
  +            this.email.getToList(),
  +            this.email.getCcList(),
  +            this.email.getBccList(),
  +            false);
  +   
  +        this.getMailServer();
   
  -            // validate html message
  -            validateSend(
  -                this.fakeMailServer,
  -                strSubject,
  -                this.email.getHtmlMsg(),
  -                this.email.getFromAddress(),
  -                this.email.getToList(),
  -                this.email.getCcList(),
  -                this.email.getBccList(),
  -                false);
  -        }
  -        catch (MessagingException e)
  -        {
  -            e.printStackTrace();
  -            fail("Unexpected exception thrown");
  -        }
  -        catch (IOException e1)
  -        {
  -            e1.printStackTrace();
  -        }
  +        this.email = new MockHtmlEmailConcrete();
  +        this.email.setHostName(this.strTestMailServer);
  +        this.email.setFrom(this.strTestMailFrom);
  +        this.email.setSmtpPort(this.intTestMailServerPort);
  +        this.email.addTo(this.strTestMailTo);
  +
  +        if (this.strTestUser != null && this.strTestPasswd != null)
  +        {
  +            this.email.setAuthentication(
  +                this.strTestUser,
  +                this.strTestPasswd);
  +        }
  +
  +        strSubject = "Test HTML Send #2 Subject (w charset)";
  +        this.email.setCharset(Email.ISO_8859_1);
  +        this.email.setSubject(strSubject);
  +        this.email.setMsg("Test txt msg");
  +
  +        this.email.send();
  +        this.fakeMailServer.stop();
  +        // validate txt message
  +        validateSend(
  +            this.fakeMailServer,
  +            strSubject,
  +            this.email.getTextMsg(),
  +            this.email.getFromAddress(),
  +            this.email.getToList(),
  +            this.email.getCcList(),
  +            this.email.getBccList(),
  +            true);
  +
  +        // validate html message
  +        validateSend(
  +            this.fakeMailServer,
  +            strSubject,
  +            this.email.getHtmlMsg(),
  +            this.email.getFromAddress(),
  +            this.email.getToList(),
  +            this.email.getCcList(),
  +            this.email.getBccList(),
  +            false);
  +   
       }
   
   }
  
  
  
  1.2       +61 -93    jakarta-commons/email/src/test/org/apache/commons/mail/EmailTest.java
  
  Index: EmailTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/email/src/test/org/apache/commons/mail/EmailTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EmailTest.java	25 Nov 2004 11:14:53 -0000	1.1
  +++ EmailTest.java	29 Nov 2004 17:33:12 -0000	1.2
  @@ -24,7 +24,6 @@
   import java.util.Properties;
   
   import javax.mail.Authenticator;
  -import javax.mail.MessagingException;
   import javax.mail.Session;
   import javax.mail.internet.InternetAddress;
   import javax.mail.internet.MimeMultipart;
  @@ -80,29 +79,23 @@
       }
   
       /** */
  -    public void testGetSetSession()
  +    public void testGetSetSession() throws Exception
       {
  -        try
  -        {
  -            Properties properties = new Properties(System.getProperties());
  -            properties.setProperty(Email.MAIL_TRANSPORT_PROTOCOL, Email.SMTP);
   
  -            properties.setProperty(
  -                Email.MAIL_PORT,
  -                String.valueOf(this.intTestMailServerPort));
  -            properties.setProperty(Email.MAIL_HOST, this.strTestMailServer);
  -            properties.setProperty(Email.MAIL_DEBUG, String.valueOf(false));
  +        Properties properties = new Properties(System.getProperties());
  +        properties.setProperty(Email.MAIL_TRANSPORT_PROTOCOL, Email.SMTP);
   
  -            Session mySession = Session.getInstance(properties, null);
  +        properties.setProperty(
  +            Email.MAIL_PORT,
  +            String.valueOf(this.intTestMailServerPort));
  +        properties.setProperty(Email.MAIL_HOST, this.strTestMailServer);
  +        properties.setProperty(Email.MAIL_DEBUG, String.valueOf(false));
   
  -            this.email.setMailSession(mySession);
  -            assertEquals(mySession, this.email.getMailSession());
  -        }
  -        catch (MessagingException e)
  -        {
  -            e.printStackTrace();
  -            fail("Unexpected exception thrown");
  -        }
  +        Session mySession = Session.getInstance(properties, null);
  +
  +        this.email.setMailSession(mySession);
  +        assertEquals(mySession, this.email.getMailSession());
  +      
       }
   
       /** */
  @@ -283,7 +276,7 @@
       }
   
       /** */
  -    public void testSetFrom()
  +    public void testSetFrom() throws Exception
       {
           // ====================================================================
           // Test Success
  @@ -310,32 +303,23 @@
   
           for (int i = 0; i < ARR_VALID_EMAILS.length; i++)
           {
  -            try
  -            {
  -                // set from 
  -                this.email.setFrom(ARR_VALID_EMAILS[i]);
   
  -                // retrieve and verify
  -                assertEquals(arrExpected.get(i), this.email.getFromAddress());
  -            }
  -            catch (MessagingException e)
  -            {
  -                e.printStackTrace();
  -                fail("Unexpected exception thrown");
  -            }
  +            // set from 
  +            this.email.setFrom(ARR_VALID_EMAILS[i]);
  +
  +            // retrieve and verify
  +            assertEquals(arrExpected.get(i), this.email.getFromAddress());
           }
       }
   
       /** */
  -    public void testSetFromWithEnconding()
  +    public void testSetFromWithEnconding() throws Exception
       {
           // ====================================================================
           // Test Success (with charset set)
           // ====================================================================
           String testValidEmail = "me@home.com";
   
  -        try
  -        {
               InternetAddress inetExpected =
                   new InternetAddress("me@home.com", "me@home.com");
   
  @@ -345,21 +329,11 @@
   
               // retrieve and verify
               assertEquals(inetExpected, this.email.getFromAddress());
  -        }
  -        catch (UnsupportedEncodingException e)
  -        {
  -            e.printStackTrace();
  -            fail("Unexpected exception thrown");
  -        }
  -        catch (MessagingException e)
  -        {
  -            e.printStackTrace();
  -            fail("Unexpected exception thrown");
  -        }
  +
       }
   
       /** */
  -    public void testSetFrom2()
  +    public void testSetFrom2() throws Exception
       {
           // ====================================================================
           // Test Success
  @@ -391,19 +365,12 @@
   
           for (int i = 0; i < testEmails.length; i++)
           {
  -            try
  -            {
  -                // set from 
  -                this.email.setFrom(testEmails[i], testEmailNames[i]);
  +            // set from 
  +            this.email.setFrom(testEmails[i], testEmailNames[i]);
  +
  +            // retrieve and verify
  +            assertEquals(arrExpected.get(i), this.email.getFromAddress());
   
  -                // retrieve and verify
  -                assertEquals(arrExpected.get(i), this.email.getFromAddress());
  -            }
  -            catch (MessagingException e)
  -            {
  -                e.printStackTrace();
  -                fail("Unexpected exception thrown");
  -            }
           }
   
           // ====================================================================
  @@ -422,7 +389,7 @@
                   "\t.bad.personal.name.\uc5ec\n");
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
  @@ -466,7 +433,7 @@
                   // set from 
                   this.email.addTo(ARR_VALID_EMAILS[i]);
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   e.printStackTrace();
                   fail("Unexpected exception thrown");
  @@ -512,7 +479,7 @@
                   // set from 
                   this.email.addTo(ARR_VALID_EMAILS[i]);
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   e.printStackTrace();
                   fail("Unexpected exception thrown");
  @@ -559,7 +526,7 @@
                   // set from 
                   this.email.addTo(ARR_VALID_EMAILS[i], testEmailNames[i]);
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   e.printStackTrace();
                   fail("Unexpected exception thrown");
  @@ -584,7 +551,7 @@
               anotherEmail.addTo("me@home.com", "\t.bad.name.\uc5ec\n");
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
  @@ -630,7 +597,7 @@
                   testEmailValid2.toString(),
                   this.email.getToList().toString());
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               e.printStackTrace();
               fail("Unexpected exception thrown");
  @@ -644,7 +611,7 @@
               this.email.setTo(null);
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
  @@ -662,7 +629,7 @@
               this.email.setTo(new ArrayList());
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
  @@ -706,7 +673,7 @@
                   // set from 
                   this.email.addCc(ARR_VALID_EMAILS[i]);
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   e.printStackTrace();
                   fail("Unexpected exception thrown");
  @@ -752,7 +719,7 @@
                   // set from 
                   this.email.addCc(ARR_VALID_EMAILS[i]);
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   e.printStackTrace();
                   fail("Unexpected exception thrown");
  @@ -799,7 +766,7 @@
                   // set from 
                   this.email.addCc(ARR_VALID_EMAILS[i], testEmailNames[i]);
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   e.printStackTrace();
                   fail("Unexpected exception thrown");
  @@ -824,7 +791,7 @@
               anotherEmail.addCc("me@home.com", "\t.bad.name.\uc5ec\n");
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
  @@ -852,7 +819,7 @@
               this.email.setCc(testEmailValid2);
               assertEquals(testEmailValid2, this.email.getCcList());
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               e.printStackTrace();
               fail("Unexpected exception thrown");
  @@ -866,7 +833,7 @@
               this.email.setCc(null);
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
  @@ -884,7 +851,7 @@
               this.email.setCc(new ArrayList());
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
  @@ -928,7 +895,7 @@
                   // set from 
                   this.email.addBcc(ARR_VALID_EMAILS[i]);
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   e.printStackTrace();
                   fail("Unexpected exception thrown");
  @@ -976,7 +943,7 @@
                   // set from 
                   this.email.addBcc(ARR_VALID_EMAILS[i]);
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   e.printStackTrace();
                   fail("Unexpected exception thrown");
  @@ -1025,7 +992,7 @@
                   // set from 
                   this.email.addBcc(ARR_VALID_EMAILS[i], testEmailNames[i]);
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   e.printStackTrace();
                   fail("Unexpected exception thrown");
  @@ -1052,7 +1019,7 @@
               anotherEmail.addBcc("me@home.com", "\t.bad.name.\uc5ec\n");
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
  @@ -1093,7 +1060,7 @@
               this.email.setBcc(testInetEmailValid);
               assertEquals(testInetEmailValid, this.email.getBccList());
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               e.printStackTrace();
               fail("Unexpected exception thrown");
  @@ -1107,7 +1074,7 @@
               this.email.setBcc(null);
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
  @@ -1125,7 +1092,7 @@
               this.email.setBcc(new ArrayList());
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
  @@ -1169,7 +1136,7 @@
                   // set from 
                   this.email.addReplyTo(ARR_VALID_EMAILS[i]);
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   e.printStackTrace();
                   fail("Unexpected exception thrown");
  @@ -1217,7 +1184,7 @@
                   // set from 
                   this.email.addReplyTo(ARR_VALID_EMAILS[i]);
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   e.printStackTrace();
                   fail("Unexpected exception thrown");
  @@ -1266,7 +1233,7 @@
                   // set from 
                   this.email.addReplyTo(ARR_VALID_EMAILS[i], testEmailNames[i]);
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   e.printStackTrace();
                   fail("Unexpected exception thrown");
  @@ -1293,7 +1260,7 @@
               anotherEmail.addReplyTo("me@home.com", "\t.bad.name.\uc5ec\n");
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
  @@ -1456,7 +1423,7 @@
               this.email.send();
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               this.fakeMailServer.stop();
               assertTrue(true);
  @@ -1488,8 +1455,9 @@
               this.email.send();
               fail("Should have thrown an exception");
           }
  -        catch (ParseException e)
  +        catch (EmailException e)
           {
  +            assertTrue(e.getCause() instanceof ParseException);
               this.fakeMailServer.stop();
               assertTrue(true);
           }
  @@ -1514,7 +1482,7 @@
               this.email.send();
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               this.fakeMailServer.stop();
               assertTrue(true);
  @@ -1537,7 +1505,7 @@
               this.email.send();
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               this.fakeMailServer.stop();
               assertTrue(true);
  @@ -1562,7 +1530,7 @@
               this.email.send();
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               this.fakeMailServer.stop();
               assertTrue(true);
  @@ -1615,7 +1583,7 @@
               e.printStackTrace();
               fail("Unexpected exception thrown");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               e.printStackTrace();
               fail("Unexpected exception thrown");
  
  
  
  1.3       +13 -13    jakarta-commons/email/src/test/org/apache/commons/mail/SendWithAttachmentsTest.java
  
  Index: SendWithAttachmentsTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/email/src/test/org/apache/commons/mail/SendWithAttachmentsTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SendWithAttachmentsTest.java	29 Nov 2004 09:59:11 -0000	1.2
  +++ SendWithAttachmentsTest.java	29 Nov 2004 17:33:12 -0000	1.3
  @@ -20,8 +20,6 @@
   import java.net.MalformedURLException;
   import java.net.URL;
   
  -import javax.mail.MessagingException;
  -
   import org.apache.commons.mail.mocks.MockHtmlEmailConcrete;
   import org.apache.commons.mail.settings.EmailConfiguration;
   
  @@ -108,11 +106,7 @@
                   this.email.getBccList(),
                   false);
           }
  -        catch (MessagingException e)
  -        {
  -            e.printStackTrace();
  -            fail("Unexpected exception thrown");
  -        }
  +
           catch (MalformedURLException e)
           {
               e.printStackTrace();
  @@ -123,6 +117,11 @@
               e.printStackTrace();
               fail("Failed to save email to output file");
           }
  +        catch (Exception e)
  +        {
  +            e.printStackTrace();
  +            fail("Unexpected exception thrown");
  +        }
   
       }
   
  @@ -214,11 +213,7 @@
   				this.email.getBccList(),
   				false);
   		}
  -		catch (MessagingException e)
  -		{
  -			e.printStackTrace();
  -			fail("Unexpected exception thrown");
  -		}
  +
   		catch (MalformedURLException e)
   		{
   			e.printStackTrace();
  @@ -228,6 +223,11 @@
   		{
   			e.printStackTrace();
   			fail("Failed to save email to output file");
  +		}
  +		catch (Exception e)
  +		{
  +			e.printStackTrace();
  +			fail("Unexpected exception thrown");
   		}
       }
   
  
  
  
  1.3       +62 -81    jakarta-commons/email/src/test/org/apache/commons/mail/MultiPartEmailTest.java
  
  Index: MultiPartEmailTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/email/src/test/org/apache/commons/mail/MultiPartEmailTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MultiPartEmailTest.java	29 Nov 2004 09:59:11 -0000	1.2
  +++ MultiPartEmailTest.java	29 Nov 2004 17:33:12 -0000	1.3
  @@ -22,7 +22,6 @@
   import java.util.Hashtable;
   
   import javax.activation.URLDataSource;
  -import javax.mail.MessagingException;
   import javax.mail.internet.MimeMultipart;
   
   import org.apache.commons.lang.StringUtils;
  @@ -81,9 +80,8 @@
                   this.email.setMsg(testCharsValid[i]);
                   assertEquals(testCharsValid[i], this.email.getMsg());
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
  -                e.printStackTrace();
                   fail("Unexpected exception thrown");
               }
           }
  @@ -97,9 +95,8 @@
                   this.email.setMsg(testCharsValid[i]);
                   assertEquals(testCharsValid[i], this.email.getMsg());
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
  -                e.printStackTrace();
                   fail("Unexpected exception thrown");
               }
           }
  @@ -115,7 +112,7 @@
                   this.email.setMsg(testCharsNotValid[i]);
                   fail("Should have thrown an exception");
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   assertTrue(true);
               }
  @@ -198,17 +195,18 @@
                   testEmail.getBccList(),
                   false);
           }
  -        catch (MessagingException e)
  +
  +        catch (IOException e)
           {
               e.printStackTrace();
  -            fail("Unexpected exception thrown");
  +            fail("Failed to save email to output file");
           }
  -        catch (IOException e)
  +        catch (Exception e)
           {
               e.printStackTrace();
  -            fail("Failed to save email to output file");
  +            fail("Unexpected exception thrown");
           }
  -
  +        
           // ====================================================================
           // Test Exceptions
           // ====================================================================
  @@ -219,7 +217,7 @@
               this.email.send();
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               this.fakeMailServer.stop();
               assertTrue(true);
  @@ -246,9 +244,8 @@
               attachment.setPath(testFile.getAbsolutePath());
               this.email.attach(attachment);
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
  -            e.printStackTrace();
               fail("Unexpected exception thrown");
           }
   
  @@ -263,7 +260,7 @@
               attachment.setURL(new URL(this.strTestURL));
               this.email.attach(attachment);
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               e.printStackTrace();
               fail("Unexpected exception thrown");
  @@ -283,7 +280,7 @@
               this.email.attach(null);
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
  @@ -301,7 +298,7 @@
               this.email.attach(attachment);
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
  @@ -319,7 +316,7 @@
               this.email.attach(attachment);
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
  @@ -343,7 +340,7 @@
                   "Test Attachment",
                   "Test Attachment Desc");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               e.printStackTrace();
               fail("Unexpected exception thrown");
  @@ -362,7 +359,7 @@
                   null,
                   "Test Attachment Desc");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               e.printStackTrace();
               fail("Unexpected exception thrown");
  @@ -387,7 +384,7 @@
                   "Test Attachment",
                   "Test Attachment Desc");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               e.printStackTrace();
               fail("Unexpected exception thrown");
  @@ -408,7 +405,7 @@
               this.email.attach(urlDs, "Test Attachment", "Test Attachment Desc");
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
  @@ -425,7 +422,7 @@
               this.email.attach(urlDs, "Test Attachment", "Test Attachment Desc");
               fail("Should have thrown an exception");
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               assertTrue(true);
           }
  @@ -437,70 +434,54 @@
       }
   
       /** */
  -    public void testAddPart()
  +    public void testAddPart() throws Exception
       {
  -        try
  -        {
  -            // setup
  -            this.email = new MockMultiPartEmailConcrete();
  -            String strMessage = "hello";
  -            String strContentType = "text/plain";
   
  -            // add part
  -            this.email.addPart(strMessage, strContentType);
  +        // setup
  +        this.email = new MockMultiPartEmailConcrete();
  +        String strMessage = "hello";
  +        String strContentType = "text/plain";
   
  -            // validate
  -            assertEquals(
  -                strContentType,
  -                this.email.getContainer().getBodyPart(0).getContentType());
  -            assertEquals(
  -                strMessage,
  -                this
  -                    .email
  -                    .getContainer()
  -                    .getBodyPart(0)
  -                    .getDataHandler()
  -                    .getContent());
  -        }
  -        catch (MessagingException e)
  -        {
  -            e.printStackTrace();
  -            fail("Unexpected exception thrown");
  -        }
  -        catch (IOException e1)
  -        {
  -            e1.printStackTrace();
  -        }
  +        // add part
  +        this.email.addPart(strMessage, strContentType);
  +
  +        // validate
  +        assertEquals(
  +            strContentType,
  +            this.email.getContainer().getBodyPart(0).getContentType());
  +        assertEquals(
  +            strMessage,
  +            this
  +                .email
  +                .getContainer()
  +                .getBodyPart(0)
  +                .getDataHandler()
  +                .getContent());
  +   
       }
   
       /** */
  -    public void testAddPart2()
  +    public void testAddPart2() throws Exception
       {
  -        try
  -        {
  -            // setup
  -            this.email = new MockMultiPartEmailConcrete();
  -            String strSubtype = "subtype/abc123";
  -
  -            // add part
  -            this.email.addPart(new MimeMultipart(strSubtype));
  -
  -            // validate
  -            assertTrue(
  -                this
  -                    .email
  -                    .getContainer()
  -                    .getBodyPart(0)
  -                    .getDataHandler()
  -                    .getContentType()
  -                    .indexOf(strSubtype)
  -                    != -1);
  -        }
  -        catch (MessagingException e)
  -        {
  -            e.printStackTrace();
  -            fail("Unexpected exception thrown");
  -        }
  +
  +        // setup
  +        this.email = new MockMultiPartEmailConcrete();
  +        String strSubtype = "subtype/abc123";
  +
  +        // add part
  +        this.email.addPart(new MimeMultipart(strSubtype));
  +
  +        // validate
  +        assertTrue(
  +            this
  +                .email
  +                .getContainer()
  +                .getBodyPart(0)
  +                .getDataHandler()
  +                .getContentType()
  +                .indexOf(strSubtype)
  +                != -1);
  +   
       }
   
       /** @todo implement test for GetContainer */
  
  
  
  1.3       +8 -9      jakarta-commons/email/src/test/org/apache/commons/mail/SimpleEmailTest.java
  
  Index: SimpleEmailTest.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/email/src/test/org/apache/commons/mail/SimpleEmailTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SimpleEmailTest.java	29 Nov 2004 09:59:11 -0000	1.2
  +++ SimpleEmailTest.java	29 Nov 2004 17:33:12 -0000	1.3
  @@ -17,8 +17,6 @@
   
   import java.io.IOException;
   
  -import javax.mail.MessagingException;
  -
   import org.apache.commons.mail.mocks.MockSimpleEmail;
   
   /**
  @@ -61,7 +59,7 @@
                   assertEquals(testCharsValid[i], this.email.getMsg());
               }
           }
  -        catch (MessagingException e)
  +        catch (EmailException e)
           {
               e.printStackTrace();
               fail("Unexpected exception thrown");
  @@ -77,7 +75,7 @@
                   this.email.setMsg(this.testCharsNotValid[i]);
                   fail("Should have thrown an exception");
               }
  -            catch (MessagingException e)
  +            catch (EmailException e)
               {
                   assertTrue(true);
               }
  @@ -136,15 +134,16 @@
                   this.email.getBccList(),
                   true);
           }
  -        catch (MessagingException e)
  +
  +        catch (IOException e)
           {
               e.printStackTrace();
  -            fail("Unexpected exception thrown");
  +            fail("failed to save email to output file");
           }
  -        catch (IOException e)
  +        catch (Exception e)
           {
               e.printStackTrace();
  -            fail("failed to save email to output file");
  +            fail("Unexpected exception thrown");
           }
       }
   }
  
  
  
  1.2       +94 -69    jakarta-commons/email/src/java/org/apache/commons/mail/MultiPartEmail.java
  
  Index: MultiPartEmail.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/email/src/java/org/apache/commons/mail/MultiPartEmail.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MultiPartEmail.java	25 Nov 2004 09:56:56 -0000	1.1
  +++ MultiPartEmail.java	29 Nov 2004 17:33:12 -0000	1.2
  @@ -86,15 +86,20 @@
        * @param content The content.
        * @param contentType The content type.
        * @return An Email.
  -     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     * @throws EmailException see javax.mail.internet.MimeBodyPart
        *  for defintions
        */
       public Email addPart(String content, String contentType)
  -        throws MessagingException
  +        throws EmailException
       {
           MimeBodyPart bodyPart = new MimeBodyPart();
  -        bodyPart.setContent(content, contentType);
  -        getContainer().addBodyPart(bodyPart);
  +        try {
  +            bodyPart.setContent(content, contentType);
  +            getContainer().addBodyPart(bodyPart);
  +        }
  +        catch (MessagingException me){
  +            throw new EmailException(me);
  +        }
   
           return this;
       }
  @@ -103,14 +108,19 @@
        * Add a new part to the email.
        * @param multipart The MimeMultipart.
        * @return An Email.
  -     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     * @throws EmailException see javax.mail.internet.MimeBodyPart
        *  for defintions
        */
  -    public Email addPart(MimeMultipart multipart) throws MessagingException
  +    public Email addPart(MimeMultipart multipart) throws EmailException
       {
           MimeBodyPart bodyPart = new MimeBodyPart();
  -        bodyPart.setContent(multipart);
  -        getContainer().addBodyPart(bodyPart);
  +        try {
  +            bodyPart.setContent(multipart);
  +            getContainer().addBodyPart(bodyPart);
  +        }
  +        catch (MessagingException me){
  +            throw new EmailException(me);
  +        }            
   
           return this;
       }
  @@ -118,10 +128,10 @@
       /**
        * Initialize the multipart email.
        *
  -     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     * @throws EmailException see javax.mail.internet.MimeBodyPart
        *  for defintions
        */
  -    protected void init() throws MessagingException
  +    protected void init()
       {
           if (initialized)
           {
  @@ -139,62 +149,71 @@
        *
        * @param msg A String.
        * @return An Email.
  -     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     * @throws EmailException see javax.mail.internet.MimeBodyPart
        *  for defintions
        */
  -    public Email setMsg(String msg) throws MessagingException
  +    public Email setMsg(String msg) throws EmailException
       {
           // throw exception on null message
           if (StringUtils.isEmpty(msg))
           {
  -            throw new MessagingException("Invalid message supplied");
  +            throw new EmailException("Invalid message supplied");
           }
  -
  -        if (StringUtils.isNotEmpty(charset))
  -        {
  -            getPrimaryBodyPart().setText(msg, charset);
  -        }
  -        else
  -        {
  -            getPrimaryBodyPart().setText(msg);
  +        try {
  +            if (StringUtils.isNotEmpty(charset))
  +            {
  +                getPrimaryBodyPart().setText(msg, charset);
  +            }
  +            else
  +            {
  +                getPrimaryBodyPart().setText(msg);
  +            }
           }
  +        catch (MessagingException me){
  +            throw new EmailException(me);
  +        }  
           return this;
       }
   
       /**
        * Sends the mail message
        *
  -     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     * @throws EmailException see javax.mail.internet.MimeBodyPart
        *  for defintions
        */
  -    public void send() throws MessagingException
  +    public void send() throws EmailException
       {
  -        if (primaryBodyPart != null)
  -        {
  -            // before a multipart message can be sent, we must make sure that
  -            // the content for the main body part was actually set.  If not,
  -            // an IOException will be thrown during super.send().
  -
  -            MimeBodyPart body = this.getPrimaryBodyPart();
  -            Object content = null;
  -            try
  +        try {
  +            if (primaryBodyPart != null)
               {
  -                content = body.getContent();
  +                // before a multipart message can be sent, we must make sure that
  +                // the content for the main body part was actually set.  If not,
  +                // an IOException will be thrown during super.send().
  +    
  +                MimeBodyPart body = this.getPrimaryBodyPart();
  +                Object content = null;
  +                try
  +                {
  +                    content = body.getContent();
  +                }
  +                catch (IOException e)
  +                {
  +                    // do nothing here.  content will be set to an empty string
  +                    // as a result.
  +                    content = null;
  +                }
               }
  -            catch (IOException e)
  +    
  +            if (subType != null)
               {
  -                // do nothing here.  content will be set to an empty string
  -                // as a result.
  -                content = null;
  +                getContainer().setSubType(subType);
               }
  +    
  +            super.send();
           }
  -
  -        if (subType != null)
  -        {
  -            getContainer().setSubType(subType);
  +        catch (MessagingException me){
  +            throw new EmailException(me);
           }
  -
  -        super.send();
       }
   
       /**
  @@ -202,17 +221,17 @@
        *
        * @param attachment An EmailAttachment.
        * @return A MultiPartEmail.
  -     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     * @throws EmailException see javax.mail.internet.MimeBodyPart
        *  for defintions
        */
       public MultiPartEmail attach(EmailAttachment attachment)
  -        throws MessagingException
  +        throws EmailException
       {
           MultiPartEmail result = null;
   
           if (attachment == null)
           {
  -            throw new MessagingException("Invalid attachment supplied");
  +            throw new EmailException("Invalid attachment supplied");
           }
   
           URL url = attachment.getURL();
  @@ -238,7 +257,7 @@
               }
               catch (Exception e)
               {
  -                throw new MessagingException(
  +                throw new EmailException(
                       "Cannot attach file \"" + fileName + "\"",
                       e);
               }
  @@ -264,11 +283,11 @@
        * @param name The name field for the attachment.
        * @param description A description for the attachment.
        * @return A MultiPartEmail.
  -     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     * @throws EmailException see javax.mail.internet.MimeBodyPart
        *  for defintions
        */
       public MultiPartEmail attach(URL url, String name, String description)
  -        throws MessagingException
  +        throws EmailException
       {
           return attach(url, name, description, EmailAttachment.ATTACHMENT);
       }
  @@ -281,7 +300,7 @@
        * @param description A description for the attachment.
        * @param disposition Either mixed or inline.
        * @return A MultiPartEmail.
  -     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     * @throws EmailException see javax.mail.internet.MimeBodyPart
        *  for defintions
        */
       public MultiPartEmail attach(
  @@ -289,7 +308,7 @@
           String name,
           String description,
           String disposition)
  -        throws MessagingException
  +        throws EmailException
       {
           // verify that the URL is valid
          try
  @@ -299,7 +318,7 @@
          }
          catch (IOException e)
          {
  -           throw new MessagingException("Invalid URL set");
  +           throw new EmailException("Invalid URL set");
          }
   
          return attach(new URLDataSource(url), name, description, disposition);
  @@ -312,26 +331,26 @@
        * @param name The name field for the attachment.
        * @param description A description for the attachment.
        * @return A MultiPartEmail.
  -     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     * @throws EmailException see javax.mail.internet.MimeBodyPart
        *  for defintions
        */
       public MultiPartEmail attach(
           DataSource ds,
           String name,
           String description)
  -        throws MessagingException
  +        throws EmailException
       {
           // verify that the DataSource is valid
           try
           {
               if (ds == null || ds.getInputStream() == null)
               {
  -                throw new MessagingException("Invalid Datasource");
  +                throw new EmailException("Invalid Datasource");
               }
           }
           catch (IOException e)
           {
  -            throw new MessagingException("Invalid Datasource");
  +            throw new EmailException("Invalid Datasource");
           }
   
           return attach(ds, name, description, EmailAttachment.ATTACHMENT);
  @@ -345,7 +364,7 @@
        * @param description A description for the attachement.
        * @param disposition Either mixed or inline.
        * @return A MultiPartEmail.
  -     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     * @throws EmailException see javax.mail.internet.MimeBodyPart
        *  for defintions
        */
       public MultiPartEmail attach(
  @@ -353,19 +372,24 @@
           String name,
           String description,
           String disposition)
  -        throws MessagingException
  +        throws EmailException
       {
  -        MimeBodyPart mbp = new MimeBodyPart();
  -        getContainer().addBodyPart(mbp);
  -
  -        mbp.setDisposition(disposition);
           if (StringUtils.isEmpty(name))
           {
               name = ds.getName();
           }
  -        mbp.setFileName(name);
  -        mbp.setDescription(description);
  -        mbp.setDataHandler(new DataHandler(ds));
  +        MimeBodyPart mbp = new MimeBodyPart();
  +        try {
  +            getContainer().addBodyPart(mbp);
  +
  +            mbp.setDisposition(disposition);
  +            mbp.setFileName(name);
  +            mbp.setDescription(description);
  +            mbp.setDataHandler(new DataHandler(ds));
  +        }
  +        catch (MessagingException me){
  +            throw new EmailException(me);
  +        }            
           this.boolHasAttachments = true;
           
           return this;
  @@ -375,7 +399,7 @@
        * Gets first body part of the message.
        *
        * @return The primary body part.
  -     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     * @throws EmailException see javax.mail.internet.MimeBodyPart
        *  for defintions
        */
       protected MimeBodyPart getPrimaryBodyPart() throws MessagingException
  @@ -399,10 +423,10 @@
        * Gets the message container.
        *
        * @return The message container.
  -     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     * @throws EmailException see javax.mail.internet.MimeBodyPart
        *  for defintions
        */
  -    protected MimeMultipart getContainer() throws MessagingException
  +    protected MimeMultipart getContainer()
       {
           if (!initialized)
           {
  @@ -410,6 +434,7 @@
           }
           return container;
       }
  +    
   
       /**
        * @return boolHasAttachments
  
  
  
  1.2       +4 -6      jakarta-commons/email/src/java/org/apache/commons/mail/SimpleEmail.java
  
  Index: SimpleEmail.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/email/src/java/org/apache/commons/mail/SimpleEmail.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleEmail.java	25 Nov 2004 09:56:56 -0000	1.1
  +++ SimpleEmail.java	29 Nov 2004 17:33:12 -0000	1.2
  @@ -15,8 +15,6 @@
    */
   package org.apache.commons.mail;
   
  -import javax.mail.MessagingException;
  -
   import org.apache.commons.lang.StringUtils;
   
   /**
  @@ -38,14 +36,14 @@
        *
        * @param msg A String.
        * @return An Email.
  -     * @throws MessagingException see javax.mail.internet.MimeBodyPart
  +     * @throws EmailException see javax.mail.internet.MimeBodyPart
        *  for defintions
        */
  -    public Email setMsg(String msg) throws MessagingException
  +    public Email setMsg(String msg) throws EmailException
       {
           if (StringUtils.isEmpty(msg))
           {
  -            throw new MessagingException("Invalid message supplied");
  +            throw new EmailException("Invalid message supplied");
           }
   
           setContent(msg, TEXT_PLAIN);
  
  
  
  1.2       +194 -264  jakarta-commons/email/src/java/org/apache/commons/mail/Email.java
  
  Index: Email.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/email/src/java/org/apache/commons/mail/Email.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Email.java	25 Nov 2004 09:56:56 -0000	1.1
  +++ Email.java	29 Nov 2004 17:33:12 -0000	1.2
  @@ -15,7 +15,6 @@
    */
   package org.apache.commons.mail;
   
  -import java.io.UnsupportedEncodingException;
   import java.util.ArrayList;
   import java.util.Collection;
   import java.util.Date;
  @@ -29,6 +28,7 @@
   import javax.mail.Session;
   import javax.mail.Store;
   import javax.mail.Transport;
  +import javax.mail.internet.AddressException;
   import javax.mail.internet.InternetAddress;
   import javax.mail.internet.MimeMessage;
   import javax.mail.internet.MimeMultipart;
  @@ -337,9 +337,9 @@
        * Initialise a mailsession object
        *
        * @return A Session.
  -     * @throws MessagingException thrown when host name was not set
  +     * @throws EmailException thrown when host name was not set
        */
  -    protected Session getMailSession() throws MessagingException
  +    protected Session getMailSession() throws EmailException
       {
           if (this.session == null)
           {
  @@ -353,7 +353,7 @@
   
               if (!StringUtils.isNotEmpty(this.hostName))
               {
  -                throw new MessagingException(
  +                throw new EmailException(
                       "Cannot find valid hostname for mail session");
               }
   
  @@ -378,15 +378,58 @@
           }
           return this.session;
       }
  +    
  +    /**
  +    * Creates a InternetAddress
  +    * @param name
  +    * @param email
  +    * @return An internet address
  +    * @throws EmailException
  +    */
  +    private InternetAddress createInternetAddress(String email,String name) 
  +        throws EmailException
  +    {
  +
   
  +        
  +        InternetAddress address = null;
  +        
  +        try 
  +        {
  +            // check name input
  +            if (!StringUtils.isNotEmpty(name))
  +            {
  +                name = email;
  +            }
  +            
  +            if (StringUtils.isNotEmpty(this.charset))
  +            {
  +                address = new InternetAddress(email, name,this.charset);
  +            }
  +            else
  +            {
  +                address = new InternetAddress(email, name);
  +            }
  +            
  +            address.validate();
  +        }
  +        catch (Exception e)
  +        {
  +            throw new EmailException(e);
  +        }
  +        return address;
  +    }
  +    
  +    
       /**
        * Set the FROM field of the email.
        *
        * @param email A String.
        * @return An Email.
  -     * @throws MessagingException Indicates an invalid email address
  +     * @throws AddressException Indicates an invalid email address
        */
  -    public Email setFrom(String email) throws MessagingException
  +    public Email setFrom(String email) 
  +        throws EmailException 
       {
           return setFrom(email, null);
       }
  @@ -397,41 +440,12 @@
        * @param email A String.
        * @param name A String.
        * @return An Email.
  -     * @throws MessagingException Indicates an invalid email address
  +     * @throws AddressException Indicates an invalid email address
        */
  -    public Email setFrom(String email, String name) throws MessagingException
  +    public Email setFrom(String email, String name) 
  +        throws EmailException
       {
  -        try
  -        {
  -            // check name input
  -            if (!StringUtils.isNotEmpty(name))
  -            {
  -                name = email;
  -            }
  -
  -            // set/update the from address
  -            if (this.fromAddress == null)
  -            {
  -                if (StringUtils.isNotEmpty(this.charset))
  -                {
  -                    this.fromAddress =
  -                        new InternetAddress(email, name, this.charset);
  -                }
  -                else
  -                {
  -                    this.fromAddress = new InternetAddress(email, name);
  -                }
  -            }
  -            else
  -            {
  -                this.fromAddress.setAddress(email);
  -                this.fromAddress.setPersonal(name);
  -            }
  -        }
  -        catch (UnsupportedEncodingException e)
  -        {
  -            throw new MessagingException("cannot set from", e);
  -        }
  +        this.fromAddress = createInternetAddress(email,name);
   
           return this;
       }
  @@ -441,9 +455,10 @@
        *
        * @param email A String.
        * @return An Email.
  -     * @throws MessagingException Indicates an invalid email address
  +     * @throws AddressException Indicates an invalid email address
        */
  -    public Email addTo(String email) throws MessagingException
  +    public Email addTo(String email) 
  +        throws EmailException
       {
           return addTo(email, null);
       }
  @@ -454,30 +469,14 @@
        * @param email A String.
        * @param name A String.
        * @return An Email.
  -     * @throws MessagingException Indicates an invalid email address
  +     * @throws AddressException Indicates an invalid email address
        */
  -    public Email addTo(String email, String name) throws MessagingException
  +    public Email addTo(String email, String name) 
  +        throws EmailException
       {
  -        try
  -        {
  -            if (!StringUtils.isNotEmpty(name))
  -            {
  -                name = email;
  -            }
   
  -            if (StringUtils.isNotEmpty(this.charset))
  -            {
  -                this.toList.add(new InternetAddress(email, name, this.charset));
  -            }
  -            else
  -            {
  -                this.toList.add(new InternetAddress(email, name));
  -            }
  -        }
  -        catch (UnsupportedEncodingException e)
  -        {
  -            throw new MessagingException("cannot add to", e);
  -        }
  +        this.toList.add(createInternetAddress(email,name));
  +
           return this;
       }
   
  @@ -486,13 +485,13 @@
        *
        * @param   aCollection collection of InternetAddress objects
        * @return An Email.
  -     * @throws MessagingException Indicates an invalid email address
  +     * @throws AddressException Indicates an invalid email address
        */
  -    public Email setTo(Collection aCollection) throws MessagingException
  +    public Email setTo(Collection aCollection) throws EmailException
       {
           if (aCollection == null || aCollection.isEmpty())
           {
  -            throw new MessagingException("Address List provided was invalid");
  +            throw new EmailException("Address List provided was invalid");
           }
   
           this.toList = new ArrayList(aCollection);
  @@ -504,9 +503,10 @@
        *
        * @param email A String.
        * @return An Email.
  -     * @throws MessagingException Indicates an invalid email address
  +     * @throws AddressException Indicates an invalid email address
        */
  -    public Email addCc(String email) throws MessagingException
  +    public Email addCc(String email) 
  +        throws EmailException
       {
           return this.addCc(email, null);
       }
  @@ -517,30 +517,13 @@
        * @param email A String.
        * @param name A String.
        * @return An Email.
  -     * @throws MessagingException Indicates an invalid email address
  +     * @throws AddressException Indicates an invalid email address
        */
  -    public Email addCc(String email, String name) throws MessagingException
  +    public Email addCc(String email, String name) 
  +        throws EmailException
       {
  -        try
  -        {
  -            if (!StringUtils.isNotEmpty(name))
  -            {
  -                name = email;
  -            }
  -
  -            if (StringUtils.isNotEmpty(this.charset))
  -            {
  -                this.ccList.add(new InternetAddress(email, name, this.charset));
  -            }
  -            else
  -            {
  -                this.ccList.add(new InternetAddress(email, name));
  -            }
  -        }
  -        catch (UnsupportedEncodingException e)
  -        {
  -            throw new MessagingException("cannot add cc", e);
  -        }
  +        
  +        this.ccList.add(createInternetAddress(email,name));
   
           return this;
       }
  @@ -549,14 +532,14 @@
        * Set a list of "CC" addresses
        *
        * @param   aCollection collection of InternetAddress objects
  -     * @return An Email.
  -     * @throws MessagingException Indicates an invalid email address
  +     * @return An AddressException.
  +     * @throws EmailException Indicates an invalid email address
        */
  -    public Email setCc(Collection aCollection) throws MessagingException
  +    public Email setCc(Collection aCollection) throws EmailException
       {
           if (aCollection == null || aCollection.isEmpty())
           {
  -            throw new MessagingException("Address List provided was invalid");
  +            throw new EmailException("Address List provided was invalid");
           }
   
           this.ccList = new ArrayList(aCollection);
  @@ -568,9 +551,10 @@
        *
        * @param email A String.
        * @return An Email.
  -     * @throws MessagingException Indicates an invalid email address
  +     * @throws EmailException Indicates an invalid email address
        */
  -    public Email addBcc(String email) throws MessagingException
  +    public Email addBcc(String email) 
  +        throws EmailException
       {
           return this.addBcc(email, null);
       }
  @@ -581,32 +565,13 @@
        * @param email A String.
        * @param name A String.
        * @return An Email.
  -     * @throws MessagingException Indicates an invalid email address
  +     * @throws EmailException Indicates an invalid email address
        */
  -    public Email addBcc(String email, String name) throws MessagingException
  +    public Email addBcc(String email, String name) 
  +        throws EmailException
       {
  -        try
  -        {
  -            if (!StringUtils.isNotEmpty(name))
  -            {
  -                name = email;
  -            }
  -
  -            if (StringUtils.isNotEmpty(this.charset))
  -            {
  -                this.bccList.add(
  -                    new InternetAddress(email, name, this.charset));
  -            }
  -            else
  -            {
  -                this.bccList.add(new InternetAddress(email, name));
  -            }
   
  -        }
  -        catch (UnsupportedEncodingException e)
  -        {
  -            throw new MessagingException("cannot add bcc", e);
  -        }
  +        this.bccList.add(createInternetAddress(email, name));
   
           return this;
       }
  @@ -616,13 +581,13 @@
        *
        * @param   aCollection collection of InternetAddress objects
        * @return  An Email.
  -     * @throws MessagingException Indicates an invalid email address
  +     * @throws EmailException Indicates an invalid email address
        */
  -    public Email setBcc(Collection aCollection) throws MessagingException
  +    public Email setBcc(Collection aCollection) throws EmailException
       {
           if (aCollection == null || aCollection.isEmpty())
           {
  -            throw new MessagingException("Address List provided was invalid");
  +            throw new EmailException("Address List provided was invalid");
           }
   
           this.bccList = new ArrayList(aCollection);
  @@ -634,9 +599,10 @@
        *
        * @param email A String.
        * @return An Email.
  -     * @throws MessagingException Indicates an invalid email address
  +     * @throws EmailException Indicates an invalid email address
        */
  -    public Email addReplyTo(String email) throws MessagingException
  +    public Email addReplyTo(String email) 
  +        throws EmailException
       {
           return this.addReplyTo(email, null);
       }
  @@ -647,32 +613,14 @@
        * @param email A String.
        * @param name A String.
        * @return An Email.
  -     * @throws MessagingException Indicates an invalid email address
  +     * @throws EmailException Indicates an invalid email address
        */
       public Email addReplyTo(String email, String name)
  -        throws MessagingException
  +        throws EmailException
       {
  -        try
  -        {
  -            if (!StringUtils.isNotEmpty(name))
  -            {
  -                name = email;
  -            }
  +        
  +        this.replyList.add(createInternetAddress(email, name));
   
  -            if (StringUtils.isNotEmpty(this.charset))
  -            {
  -                this.replyList.add(
  -                    new InternetAddress(email, name, this.charset));
  -            }
  -            else
  -            {
  -                this.replyList.add(new InternetAddress(email, name));
  -            }
  -        }
  -        catch (UnsupportedEncodingException e)
  -        {
  -            throw new MessagingException("cannot add replyTo", e);
  -        }
           return this;
       }
   
  @@ -762,138 +710,120 @@
        *
        * @param msg A String.
        * @return An Email.
  -     * @throws MessagingException generic exception
  +     * @throws EmailException generic exception
        */
  -    public abstract Email setMsg(String msg) throws MessagingException;
  +    public abstract Email setMsg(String msg) throws EmailException;
   
       /**
        * Does the work of actually sending the email.
        *
  -     * @throws MessagingException if there was an error.
  +     * @throws EmailException if there was an error.
        */
  -    public void send() throws MessagingException
  +    public void send() throws EmailException
       {
  -        this.getMailSession();
  -        this.message = new MimeMessage(this.session);
  -
  -        if (StringUtils.isNotEmpty(this.subject))
  -        {
  -            if (StringUtils.isNotEmpty(this.charset))
  +        try {
  +            this.getMailSession();
  +            this.message = new MimeMessage(this.session);
  +    
  +            if (StringUtils.isNotEmpty(this.subject))
               {
  -                this.message.setSubject(this.subject, this.charset);
  +                if (StringUtils.isNotEmpty(this.charset))
  +                {
  +                    this.message.setSubject(this.subject, this.charset);
  +                }
  +                else
  +                {
  +                    this.message.setSubject(this.subject);
  +                }
  +            }
  +    
  +            // ========================================================
  +            // Start of replacement code
  +            if (this.content != null)
  +            {
  +                this.message.setContent(this.content, this.contentType);
  +            }
  +            // end of replacement code
  +            // ========================================================
  +            else if (this.emailBody != null)
  +            {
  +                this.message.setContent(this.emailBody);
               }
               else
               {
  -                this.message.setSubject(this.subject);
  +                this.message.setContent("", Email.TEXT_PLAIN);
               }
  -        }
  -
  -        //
  -        //      As far as i can tell, this logic is circular with 
  -        //      the setContent( Object, String ) method.
  -        //      There is no way for the content variable to be set without 
  -        //      the contentType also being set.
  -        //      The logic below therefore appears to be a duplication of 
  -        //      the setContent( Object, String ) method
  -        //      or if not should it not be moved to that method? 
  -        //      (Proposed replacement code below)
  -        //      if ( this.content != null )
  -        //      {
  -        //          String type = this.contentType;
  -        //
  -        //          if ( type != null && !type.trim().equals( "" ) 
  -        //              && this.charset != null 
  -        //              && !this.charset.trim().equals( "" ) )
  -        //          {
  -        //              type += "; charset=" + this.charset;
  -        //          }
  -        //
  -        //          this.message.setContent( this.content, type );
  -        //      }
  -
  -        // ========================================================
  -        // Start of replacement code
  -        if (this.content != null)
  -        {
  -            this.message.setContent(this.content, this.contentType);
  -        }
  -        // end of replacement code
  -        // ========================================================
  -        else if (this.emailBody != null)
  -        {
  -            this.message.setContent(this.emailBody);
  -        }
  -        else
  -        {
  -            this.message.setContent("", Email.TEXT_PLAIN);
  -        }
  -
  -        if (this.fromAddress != null)
  -        {
  -            this.message.setFrom(this.fromAddress);
  -        }
  -        else
  -        {
  -            throw new MessagingException("Sender address required");
  -        }
  -
  -        if (this.toList.size() + this.ccList.size() + this.bccList.size() == 0)
  -        {
  -            throw new MessagingException(
  -                        "At least one receiver address required");
  -        }
  -
  -        if (this.toList.size() > 0)
  -        {
  -            this.message.setRecipients(
  -                Message.RecipientType.TO,
  -                this.toInternetAddressArray(this.toList));
  -        }
  -
  -        if (this.ccList.size() > 0)
  -        {
  -            this.message.setRecipients(
  -                Message.RecipientType.CC,
  -                this.toInternetAddressArray(this.ccList));
  -        }
  -
  -        if (this.bccList.size() > 0)
  -        {
  -            this.message.setRecipients(
  -                Message.RecipientType.BCC,
  -                this.toInternetAddressArray(this.bccList));
  -        }
  -
  -        if (this.replyList.size() > 0)
  -        {
  -            this.message.setReplyTo(
  -                this.toInternetAddressArray(this.replyList));
  -        }
  -
  -        if (this.headers.size() > 0)
  -        {
  -            Enumeration enum = this.headers.keys();
  -
  -            while (enum.hasMoreElements())
  +    
  +            if (this.fromAddress != null)
               {
  -                String name = (String) enum.nextElement();
  -                String value = (String) headers.get(name);
  -                this.message.addHeader(name, value);
  +                this.message.setFrom(this.fromAddress);
               }
  +            else
  +            {
  +                throw new EmailException("Sender address required");
  +            }
  +    
  +            if (this.toList.size() + this.ccList.size() + this.bccList.size() == 0)
  +            {
  +                throw new EmailException(
  +                            "At least one receiver address required");
  +            }
  +    
  +            if (this.toList.size() > 0)
  +            {
  +                this.message.setRecipients(
  +                    Message.RecipientType.TO,
  +                    this.toInternetAddressArray(this.toList));
  +            }
  +    
  +            if (this.ccList.size() > 0)
  +            {
  +                this.message.setRecipients(
  +                    Message.RecipientType.CC,
  +                    this.toInternetAddressArray(this.ccList));
  +            }
  +    
  +            if (this.bccList.size() > 0)
  +            {
  +                this.message.setRecipients(
  +                    Message.RecipientType.BCC,
  +                    this.toInternetAddressArray(this.bccList));
  +            }
  +    
  +            if (this.replyList.size() > 0)
  +            {
  +                this.message.setReplyTo(
  +                    this.toInternetAddressArray(this.replyList));
  +            }
  +    
  +            if (this.headers.size() > 0)
  +            {
  +                Enumeration enum = this.headers.keys();
  +    
  +                while (enum.hasMoreElements())
  +                {
  +                    String name = (String) enum.nextElement();
  +                    String value = (String) headers.get(name);
  +                    this.message.addHeader(name, value);
  +                }
  +            }
  +    
  +            if (this.message.getSentDate() == null)
  +            {
  +                this.message.setSentDate(getSentDate());
  +            }
  +    
  +            if (this.popBeforeSmtp)
  +            {
  +                Store store = session.getStore("pop3");
  +                store.connect(this.popHost, this.popUsername, this.popPassword);
  +            }
  +    
  +            Transport.send(this.message);
           }
  -
  -        if (this.message.getSentDate() == null)
  -        {
  -            this.message.setSentDate(getSentDate());
  -        }
  -
  -        if (this.popBeforeSmtp)
  -        {
  -            Store store = session.getStore("pop3");
  -            store.connect(this.popHost, this.popUsername, this.popPassword);
  -        }
  -
  -        Transport.send(this.message);
  +        catch (MessagingException me) {
  +            throw new EmailException(me);
  +        }    
       }
   
       /**
  
  
  
  1.2       +39 -29    jakarta-commons/email/src/java/org/apache/commons/mail/HtmlEmail.java
  
  Index: HtmlEmail.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/email/src/java/org/apache/commons/mail/HtmlEmail.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HtmlEmail.java	25 Nov 2004 09:56:56 -0000	1.1
  +++ HtmlEmail.java	29 Nov 2004 17:33:12 -0000	1.2
  @@ -80,11 +80,11 @@
        * @throws MessagingException see javax.mail.internet.MimeBodyPart
        *  for defintions
        */
  -    public HtmlEmail setTextMsg(String aText) throws MessagingException
  +    public HtmlEmail setTextMsg(String aText) throws EmailException
       {
           if (StringUtils.isEmpty(aText))
           {
  -            throw new MessagingException("Invalid message supplied");
  +            throw new EmailException("Invalid message supplied");
           }
   
          this.text = aText;
  @@ -99,11 +99,11 @@
        * @throws MessagingException see javax.mail.internet.MimeBodyPart
        *  for defintions
        */
  -    public HtmlEmail setHtmlMsg(String aHtml) throws MessagingException
  +    public HtmlEmail setHtmlMsg(String aHtml) throws EmailException
       {
           if (StringUtils.isEmpty(aHtml))
           {
  -            throw new MessagingException("Invalid message supplied");
  +            throw new EmailException("Invalid message supplied");
           }
           
           this.html = aHtml;
  @@ -124,11 +124,11 @@
        * @throws MessagingException see javax.mail.internet.MimeBodyPart
        *  for defintions
        */
  -    public Email setMsg(String msg) throws MessagingException
  +    public Email setMsg(String msg) throws EmailException
       {
           if (StringUtils.isEmpty(msg))
           {
  -            throw new MessagingException("Invalid message supplied");
  +            throw new EmailException("Invalid message supplied");
           }
   
           setTextMsg(msg);
  @@ -167,7 +167,7 @@
        * @throws MessagingException when URL suplpied is invalid
        *  also see javax.mail.internet.MimeBodyPart for defintions
        */
  -    public String embed(URL url, String name) throws MessagingException
  +    public String embed(URL url, String name) throws EmailException
       {
           // verify that the URL is valid
           try
  @@ -177,19 +177,24 @@
           }
           catch (IOException e)
           {
  -            throw new MessagingException("Invalid URL");
  +            throw new EmailException("Invalid URL");
           }
   
           MimeBodyPart mbp = new MimeBodyPart();
   
  -        mbp.setDataHandler(new DataHandler(new URLDataSource(url)));
  -        mbp.setFileName(name);
  -        mbp.setDisposition("inline");
  -        String cid = RandomStringUtils.randomAlphabetic(HtmlEmail.CID_LENGTH).toLowerCase();
  -        mbp.addHeader("Content-ID", "<" + cid + ">");
  -
  -        this.inlineImages.add(mbp);
  -        return cid;
  +        try {
  +            mbp.setDataHandler(new DataHandler(new URLDataSource(url)));
  +            mbp.setFileName(name);
  +            mbp.setDisposition("inline");
  +            String cid = RandomStringUtils.randomAlphabetic(HtmlEmail.CID_LENGTH).toLowerCase();
  +            mbp.addHeader("Content-ID", "<" + cid + ">");
  +            this.inlineImages.add(mbp);
  +            return cid;            
  +        } 
  +        catch (MessagingException me) {
  +            throw new EmailException(me);
  +        }
  +        
       }
   
       /**
  @@ -197,26 +202,31 @@
        *
        * @exception MessagingException if there was an error.
        */
  -    public void send() throws MessagingException
  +    public void send() throws EmailException
       {
  -        // if the email has attachments then the base type is mixed, 
  -        // otherwise it should be related
  -        if (this.isBoolHasAttachments())
  -        {
  -            this.buildAttachments();
  +        try {
  +            // if the email has attachments then the base type is mixed, 
  +            // otherwise it should be related
  +            if (this.isBoolHasAttachments())
  +            {
  +                this.buildAttachments();
  +            }
  +            else
  +            {
  +                this.buildNoAttachments();
  +            }
  +
           }
  -        else
  -        {
  -            this.buildNoAttachments();
  +        catch (MessagingException me){
  +            throw new EmailException(me);
           }
  -
           super.send();
       }
   
       /**
        * @throws MessagingException MessagingException
        */
  -    private void buildAttachments() throws MessagingException
  +    private void buildAttachments() throws MessagingException, EmailException
       {
           MimeMultipart container = this.getContainer();
           MimeMultipart subContainer = null;
  @@ -288,7 +298,7 @@
       /**
        * @throws MessagingException MessagingException
        */
  -    private void buildNoAttachments() throws MessagingException
  +    private void buildNoAttachments() throws MessagingException, EmailException
       {
           MimeMultipart container = this.getContainer();
           MimeMultipart subContainerHTML = new MimeMultipart("related");
  
  
  
  1.1                  jakarta-commons/email/src/java/org/apache/commons/mail/EmailException.java
  
  Index: EmailException.java
  ===================================================================
  /*
   * Copyright 2001-2004 The Apache Software Foundation
   *
   * Licensed under the Apache License, Version 2.0 ( the "License" );
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  package org.apache.commons.mail;
  
  import org.apache.commons.lang.exception.NestableException;
  
  public class EmailException extends NestableException 
  {
      public EmailException()
      {
          super();
      }
      
      public EmailException(String msg)
      {
          super(msg);
      }
      
      public EmailException(String msg,Throwable cause)
      {
          super(msg,cause);
      }
      
      public EmailException(Throwable cause)
      {
          super(cause);
      }
      
  }
  
  
  
  1.2       +5 -4      jakarta-commons/email/src/test/org/apache/commons/mail/mocks/MockEmailConcrete.java
  
  Index: MockEmailConcrete.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/email/src/test/org/apache/commons/mail/mocks/MockEmailConcrete.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MockEmailConcrete.java	25 Nov 2004 11:14:53 -0000	1.1
  +++ MockEmailConcrete.java	29 Nov 2004 17:33:12 -0000	1.2
  @@ -26,6 +26,7 @@
   import javax.mail.internet.MimeMultipart;
   
   import org.apache.commons.mail.Email;
  +import org.apache.commons.mail.EmailException;
   
   /**
    * Concrete Implementation on the Abstract Email 
  @@ -44,7 +45,7 @@
        * @return Email msg.
        * @throws MessagingException MessagingException
        */
  -    public Email setMsg(String msg) throws MessagingException
  +    public Email setMsg(String msg) throws EmailException
       {
           // This abstract method should be tested in the concrete 
           // implementation classes only.
  @@ -223,10 +224,10 @@
   
       /**
        * @return Session
  -     * @throws MessagingException MessagingException
  +     * @throws EmailException EmailException
        */
       public Session getSession()
  -        throws MessagingException
  +        throws EmailException
       {
           return this.getMailSession();
       }
  
  
  
  1.3       +3 -0      jakarta-commons/email/xdocs/changes.xml
  
  Index: changes.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/email/xdocs/changes.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- changes.xml	29 Nov 2004 09:59:11 -0000	1.2
  +++ changes.xml	29 Nov 2004 17:33:12 -0000	1.3
  @@ -7,6 +7,9 @@
   
     <body>
       <release version="1.0" date="IN CVS"> 
  +      <action dev="epugh" type="add" due-to="Mark Lowe" issue="32094">
  +        Email throws EmailException wrapping underlying JavaMail exception
  +      </action>         
         <action dev="epugh" type="add" due-to="Corey Scott" issue="32410">
           Change port for dumbster from 25 to 2500 to use unreserved port.
         </action>              
  
  
  

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


Mime
View raw message