commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bspeak...@apache.org
Subject svn commit: r578501 - in /commons/proper/email/trunk/src: java/org/apache/commons/mail/HtmlEmail.java test/org/apache/commons/mail/mocks/MockHtmlEmailConcrete.java
Date Sat, 22 Sep 2007 21:18:50 GMT
Author: bspeakmon
Date: Sat Sep 22 14:18:49 2007
New Revision: 578501

URL: http://svn.apache.org/viewvc?rev=578501&view=rev
Log:
- rename inlineImages field to inlineEmbeds
- restore 1.0 version of inlineImages field and add deprecation warnings

Modified:
    commons/proper/email/trunk/src/java/org/apache/commons/mail/HtmlEmail.java
    commons/proper/email/trunk/src/test/org/apache/commons/mail/mocks/MockHtmlEmailConcrete.java

Modified: commons/proper/email/trunk/src/java/org/apache/commons/mail/HtmlEmail.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/java/org/apache/commons/mail/HtmlEmail.java?rev=578501&r1=578500&r2=578501&view=diff
==============================================================================
--- commons/proper/email/trunk/src/java/org/apache/commons/mail/HtmlEmail.java (original)
+++ commons/proper/email/trunk/src/java/org/apache/commons/mail/HtmlEmail.java Sat Sep 22
14:18:49 2007
@@ -23,6 +23,7 @@
 import java.net.URL;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 
 import javax.activation.DataHandler;
@@ -103,10 +104,16 @@
     protected String html;
 
     /**
+     * @deprecated As of commons-email 1.1, no longer used. Inline embedded
+     * objects are now stored in {@link #inlineEmbeds}.
+     */
+    protected List inlineImages;
+
+    /**
      * Embedded images Map<String, InlineImage> where the key is the
      * user-defined image name.
      */
-    protected Map inlineImages = new HashMap();
+    protected Map inlineEmbeds = new HashMap();
 
     /**
      * Set the text content.
@@ -253,9 +260,9 @@
 
         // check if a URLDataSource for this name has already been attached;
         // if so, return the cached CID value.
-        if (inlineImages.containsKey(name))
+        if (inlineEmbeds.containsKey(name))
         {
-            InlineImage ii = (InlineImage) inlineImages.get(name);
+            InlineImage ii = (InlineImage) inlineEmbeds.get(name);
             URLDataSource urlDataSource = (URLDataSource) ii.getDataSource();
             // make sure the supplied URL points to the same thing
             // as the one already associated with this name.
@@ -365,9 +372,9 @@
 
         // check if a FileDataSource for this name has already been attached;
         // if so, return the cached CID value.
-        if (inlineImages.containsKey(file.getName()))
+        if (inlineEmbeds.containsKey(file.getName()))
         {
-            InlineImage ii = (InlineImage) inlineImages.get(file.getName());
+            InlineImage ii = (InlineImage) inlineEmbeds.get(file.getName());
             FileDataSource fileDataSource = (FileDataSource) ii.getDataSource();
             // make sure the supplied file has the same canonical path
             // as the one already associated with this name.
@@ -427,9 +434,9 @@
     {
         // check if the DataSource has already been attached;
         // if so, return the cached CID value.
-        if (inlineImages.containsKey(name))
+        if (inlineEmbeds.containsKey(name))
         {
-            InlineImage ii = (InlineImage) inlineImages.get(name);
+            InlineImage ii = (InlineImage) inlineEmbeds.get(name);
             // make sure the supplied URL points to the same thing
             // as the one already associated with this name.
             if (dataSource.equals(ii.getDataSource()))
@@ -478,7 +485,7 @@
             mbp.setContentID("<" + cid + ">");
 
             InlineImage ii = new InlineImage(cid, dataSource, mbp);
-            this.inlineImages.put(name, ii);
+            this.inlineEmbeds.put(name, ii);
 
             return cid;
         }
@@ -524,7 +531,7 @@
         if (EmailUtils.isNotEmpty(this.text))
         {
             msgText = new MimeBodyPart();
-            if (this.inlineImages.size() > 0)
+            if (this.inlineEmbeds.size() > 0)
             {
                 subContainer.addBodyPart(msgText);
             }
@@ -549,7 +556,7 @@
         if (EmailUtils.isNotEmpty(this.html))
         {
             msgHtml = new MimeBodyPart();
-            if (this.inlineImages.size() > 0)
+            if (this.inlineEmbeds.size() > 0)
             {
                 subContainer.addBodyPart(msgHtml);
             }
@@ -570,7 +577,7 @@
                 msgHtml.setContent(this.html, Email.TEXT_HTML);
             }
 
-            Iterator iter = this.inlineImages.values().iterator();
+            Iterator iter = this.inlineEmbeds.values().iterator();
             while (iter.hasNext())
             {
                 InlineImage ii = (InlineImage) iter.next();
@@ -578,7 +585,7 @@
             }
         }
 
-        if (this.inlineImages.size() > 0)
+        if (this.inlineEmbeds.size() > 0)
         {
             // add sub container to message
             this.addPart(subContainer, 0);

Modified: commons/proper/email/trunk/src/test/org/apache/commons/mail/mocks/MockHtmlEmailConcrete.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/test/org/apache/commons/mail/mocks/MockHtmlEmailConcrete.java?rev=578501&r1=578500&r2=578501&view=diff
==============================================================================
--- commons/proper/email/trunk/src/test/org/apache/commons/mail/mocks/MockHtmlEmailConcrete.java
(original)
+++ commons/proper/email/trunk/src/test/org/apache/commons/mail/mocks/MockHtmlEmailConcrete.java
Sat Sep 22 14:18:49 2007
@@ -74,11 +74,19 @@
     }
 
     /**
-     * @return inlineImages
+     * @deprecated as of commons-email 1.1, replaced by {@link #getInlineEmbeds}.
      */
-    public Map getInlineImages()
+    public List getInlineImages()
     {
         return inlineImages;
+    }
+
+    /**
+     * @return inlineEmbeds
+     */
+    public Map getInlineEmbeds()
+    {
+        return inlineEmbeds;
     }
 
     /**



Mime
View raw message