commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henn...@apache.org
Subject svn commit: r279285 - in /jakarta/commons/proper/email/trunk: ./ src/java/org/apache/commons/mail/ src/test/org/apache/commons/mail/ xdocs/
Date Wed, 07 Sep 2005 09:52:55 GMT
Author: henning
Date: Wed Sep  7 02:52:44 2005
New Revision: 279285

URL: http://svn.apache.org/viewcvs?rev=279285&view=rev
Log:
Apply Stephen Colebourne's patch to remove the commons-lang
dependency. Thanks a lot, Stephen.



Modified:
    jakarta/commons/proper/email/trunk/build.xml
    jakarta/commons/proper/email/trunk/project.xml
    jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java
    jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/EmailException.java
    jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/HtmlEmail.java
    jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/MultiPartEmail.java
    jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/SimpleEmail.java
    jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/MultiPartEmailTest.java
    jakarta/commons/proper/email/trunk/xdocs/changes.xml

Modified: jakarta/commons/proper/email/trunk/build.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/build.xml?rev=279285&r1=279284&r2=279285&view=diff
==============================================================================
--- jakarta/commons/proper/email/trunk/build.xml (original)
+++ jakarta/commons/proper/email/trunk/build.xml Wed Sep  7 02:52:44 2005
@@ -15,33 +15,51 @@
  limitations under the License.
 -->
 
-<!--build.xml generated by maven from project.xml version 1.0-rc5
-  on date July 27 2005, time 2125-->
+<!--build.xml generated by maven from project.xml version 1.0-rc7
+  on date September 3 2005, time 1320-->
 
 <project default="jar" name="commons-email" basedir=".">
-  <property name="defaulttargetdir" value="target">
+  <!--Load local and user build preferences-->
+
+  <property file="build.properties">
+  </property>
+  <property file="${user.home}/build.properties">
+  </property>
+  <!--Build properties-->
+
+  <property name="defaulttargetdir" value="${basedir}/target">
+  </property>
+  <property name="libdir" value="${user.home}/.maven/repository">
   </property>
-  <property name="libdir" value="target/lib">
+  <property name="classesdir" value="${basedir}/target/classes">
   </property>
-  <property name="classesdir" value="target/classes">
+  <property name="testclassesdir" value="${basedir}/target/test-classes">
   </property>
-  <property name="testclassesdir" value="target/test-classes">
+  <property name="testreportdir" value="${basedir}/target/test-reports">
   </property>
-  <property name="testclassesdir" value="target/test-classes">
+  <property name="distdir" value="${basedir}/dist">
   </property>
-  <property name="testreportdir" value="target/test-reports">
+  <property name="javadocdir" value="${basedir}/dist/docs/api">
   </property>
-  <property name="distdir" value="dist">
+  <property name="final.name" value="commons-email-1.0-rc8-dev">
   </property>
-  <property name="javadocdir" value="dist/docs/api">
+  <property name="proxy.host" value="">
   </property>
-  <property name="final.name" value="commons-email-1.0-rc5">
+  <property name="proxy.port" value="">
+  </property>
+  <property name="proxy.username" value="">
+  </property>
+  <property name="proxy.password" value="">
   </property>
   <path id="build.classpath">
-    <fileset dir="${libdir}">
-      <include name="**/*.jar">
-      </include>
-    </fileset>
+    <pathelement location="${libdir}/javamail/jars/javamail-1.3.2.jar">
+    </pathelement>
+    <pathelement location="${libdir}/activation/jars/activation-1.0.2.jar">
+    </pathelement>
+    <pathelement location="${libdir}/dumbster/jars/dumbster-1.6.jar">
+    </pathelement>
+    <pathelement location="${libdir}/maven-plugins/plugins/maven-findbugs-plugin-0.9.1.jar">
+    </pathelement>
   </path>
   <target name="init" description="o Initializes some properties">
     <mkdir dir="${libdir}">
@@ -54,13 +72,25 @@
 
     <available property="Junit.present" classname="junit.framework.Test">
     </available>
+    <!--Test if user defined a proxy-->
+
+    <condition property="useProxy">
+      <and>
+        <isset property="proxy.host">
+        </isset>
+        <not>
+          <equals trim="true" arg2="" arg1="${proxy.host}">
+          </equals>
+        </not>
+      </and>
+    </condition>
   </target>
   <target name="compile" description="o Compile the code" depends="get-deps">
     <mkdir dir="${classesdir}">
     </mkdir>
     <javac destdir="${classesdir}" deprecation="true" debug="true" optimize="false" excludes="**/package.html">
       <src>
-        <pathelement location="src/java">
+        <pathelement location="${basedir}/src/java">
         </pathelement>
       </src>
       <classpath refid="build.classpath">
@@ -69,7 +99,7 @@
     <mkdir dir="${classesdir}/META-INF">
     </mkdir>
     <copy todir="${classesdir}/META-INF">
-      <fileset dir=".">
+      <fileset dir="${basedir}/.">
         <include name="NOTICE.txt">
         </include>
       </fileset>
@@ -102,7 +132,7 @@
   <target name="internal-test" if="Junit.present" depends="junit-present,compile-tests">
     <mkdir dir="${testreportdir}">
     </mkdir>
-    <junit dir="./" failureproperty="test.failure" printSummary="yes" fork="true" haltonerror="true">
+    <junit dir="${basedir}" failureproperty="test.failure" printSummary="yes" fork="true"
haltonerror="true">
       <sysproperty key="basedir" value=".">
       </sysproperty>
       <formatter type="xml">
@@ -118,7 +148,7 @@
         </pathelement>
       </classpath>
       <batchtest todir="${testreportdir}">
-        <fileset dir="src/test">
+        <fileset dir="${basedir}/src/test">
           <include name="**/*Test.java">
           </include>
         </fileset>
@@ -135,7 +165,7 @@
     </mkdir>
     <javac destdir="${testclassesdir}" deprecation="true" debug="true" optimize="false"
excludes="**/package.html">
       <src>
-        <pathelement location="src/test">
+        <pathelement location="${basedir}/src/test">
         </pathelement>
       </src>
       <classpath>
@@ -146,7 +176,7 @@
       </classpath>
     </javac>
     <copy todir="${testclassesdir}">
-      <fileset dir="src/test">
+      <fileset dir="${basedir}/src/test">
         <exclude name="**/*.java">
         </exclude>
       </fileset>
@@ -161,28 +191,77 @@
     </tstamp>
     <property name="copyright" value="Copyright &amp;copy;  The Apache Software Foundation.
All Rights Reserved.">
     </property>
-    <property name="title" value="Commons Email 1.0-rc5 API">
+    <property name="title" value="Commons Email 1.0-rc8-dev API">
     </property>
-    <javadoc use="true" private="true" destdir="${javadocdir}" author="true" version="true"
sourcepath="src/java" packagenames="org.apache.commons.mail.*">
+    <javadoc use="true" private="true" destdir="${javadocdir}" author="true" version="true"
sourcepath="${basedir}/src/java" packagenames="org.apache.commons.mail.*">
       <classpath>
         <path refid="build.classpath">
         </path>
       </classpath>
     </javadoc>
   </target>
-  <target name="get-deps" unless="noget" depends="init">
-    <!--Proxy settings works only with a JDK 1.2 and higher.-->
-
-    <setproxy>
-    </setproxy>
-    <get dest="${libdir}/commons-lang-2.0.jar" usetimestamp="true" ignoreerrors="true"
src="http://www.ibiblio.org/maven/commons-lang/jars/commons-lang-2.0.jar">
+  <target name="get-dep-javamail.jar" description="o Download the dependency : javamail.jar"
unless="javamail.jar" depends="init,setProxy,noProxy,get-custom-dep-javamail.jar">
+    <mkdir dir="${libdir}/javamail/jars/">
+    </mkdir>
+    <get dest="${libdir}/javamail/jars/javamail-1.3.2.jar" usetimestamp="true" ignoreerrors="true"
src="http://www.ibiblio.org/maven/javamail/jars/javamail-1.3.2.jar">
     </get>
-    <get dest="${libdir}/javamail-1.3.2.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/javamail/jars/javamail-1.3.2.jar">
+  </target>
+  <target name="get-custom-dep-javamail.jar" if="javamail.jar" depends="init,setProxy,noProxy">
+    <mkdir dir="${libdir}/javamail/jars/">
+    </mkdir>
+    <get dest="${libdir}/javamail/jars/javamail-1.3.2.jar" usetimestamp="true" ignoreerrors="true"
src="${javamail.jar}">
     </get>
-    <get dest="${libdir}/activation-1.0.2.jar" usetimestamp="true" ignoreerrors="true"
src="http://www.ibiblio.org/maven/activation/jars/activation-1.0.2.jar">
+  </target>
+  <target name="get-dep-activation.jar" description="o Download the dependency : activation.jar"
unless="activation.jar" depends="init,setProxy,noProxy,get-custom-dep-activation.jar">
+    <mkdir dir="${libdir}/activation/jars/">
+    </mkdir>
+    <get dest="${libdir}/activation/jars/activation-1.0.2.jar" usetimestamp="true" ignoreerrors="true"
src="http://www.ibiblio.org/maven/activation/jars/activation-1.0.2.jar">
     </get>
-    <get dest="${libdir}/dumbster-1.6.jar" usetimestamp="true" ignoreerrors="true" src="http://www.ibiblio.org/maven/dumbster/jars/dumbster-1.6.jar">
+  </target>
+  <target name="get-custom-dep-activation.jar" if="activation.jar" depends="init,setProxy,noProxy">
+    <mkdir dir="${libdir}/activation/jars/">
+    </mkdir>
+    <get dest="${libdir}/activation/jars/activation-1.0.2.jar" usetimestamp="true" ignoreerrors="true"
src="${activation.jar}">
     </get>
+  </target>
+  <target name="get-dep-dumbster.jar" description="o Download the dependency : dumbster.jar"
unless="dumbster.jar" depends="init,setProxy,noProxy,get-custom-dep-dumbster.jar">
+    <mkdir dir="${libdir}/dumbster/jars/">
+    </mkdir>
+    <get dest="${libdir}/dumbster/jars/dumbster-1.6.jar" usetimestamp="true" ignoreerrors="true"
src="http://www.ibiblio.org/maven/dumbster/jars/dumbster-1.6.jar">
+    </get>
+  </target>
+  <target name="get-custom-dep-dumbster.jar" if="dumbster.jar" depends="init,setProxy,noProxy">
+    <mkdir dir="${libdir}/dumbster/jars/">
+    </mkdir>
+    <get dest="${libdir}/dumbster/jars/dumbster-1.6.jar" usetimestamp="true" ignoreerrors="true"
src="${dumbster.jar}">
+    </get>
+  </target>
+  <target name="get-dep-maven-findbugs-plugin.jar" description="o Download the dependency
: maven-findbugs-plugin.jar" unless="maven-findbugs-plugin.jar" depends="init,setProxy,noProxy,get-custom-dep-maven-findbugs-plugin.jar">
+    <mkdir dir="${libdir}/maven-plugins/plugins/">
+    </mkdir>
+    <get dest="${libdir}/maven-plugins/plugins/maven-findbugs-plugin-0.9.1.jar" usetimestamp="true"
ignoreerrors="true" src="http://www.ibiblio.org/maven/maven-plugins/plugins/maven-findbugs-plugin-0.9.1.jar">
+    </get>
+  </target>
+  <target name="get-custom-dep-maven-findbugs-plugin.jar" if="maven-findbugs-plugin.jar"
depends="init,setProxy,noProxy">
+    <mkdir dir="${libdir}/maven-plugins/plugins/">
+    </mkdir>
+    <get dest="${libdir}/maven-plugins/plugins/maven-findbugs-plugin-0.9.1.jar" usetimestamp="true"
ignoreerrors="true" src="${maven-findbugs-plugin.jar}">
+    </get>
+  </target>
+  <target name="get-deps" unless="noget" depends="get-dep-javamail.jar,get-dep-activation.jar,get-dep-dumbster.jar,get-dep-maven-findbugs-plugin.jar">
+  </target>
+  <target name="setProxy" if="useProxy" depends="init">
+    <!--Proxy settings works only with a JDK 1.2 and higher.-->
+
+    <echo>Proxy used :</echo>
+    <echo>Proxy host [${proxy.host}]</echo>
+    <echo>Proxy port [${proxy.port}]</echo>
+    <echo>Proxy user [${proxy.username}]</echo>
+    <setproxy proxyuser="${proxy.username}" proxyport="${proxy.port}" proxypassword="${proxy.password}"
proxyhost="${proxy.host}">
+    </setproxy>
+  </target>
+  <target name="noProxy" unless="useProxy" depends="init">
+    <echo>Proxy not used.</echo>
   </target>
   <target name="install-maven">
     <get dest="${user.home}/maven-install-latest.jar" usetimestamp="true" src="${repo}/maven/maven-install-latest.jar">

Modified: jakarta/commons/proper/email/trunk/project.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/project.xml?rev=279285&r1=279284&r2=279285&view=diff
==============================================================================
--- jakarta/commons/proper/email/trunk/project.xml (original)
+++ jakarta/commons/proper/email/trunk/project.xml Wed Sep  7 02:52:44 2005
@@ -19,7 +19,7 @@
     <name>Commons Email</name>
     <groupId>commons-email</groupId>
     <artifactId>commons-email</artifactId>
-    <currentVersion>1.0-rc7</currentVersion>
+    <currentVersion>1.0-rc8-dev</currentVersion>
 
     <organization>
       <name>The Apache Software Foundation</name>
@@ -143,6 +143,10 @@
     </developers>
     <contributors>
         <contributor>
+            <name>Stephen Colebourne</name>
+            <roles/>
+        </contributor>
+        <contributor>
             <name>Mark Lowe</name>
             <email>mark.lowe@boxstuff.com</email>
             <roles/>
@@ -165,18 +169,9 @@
     </contributors>
     <dependencies>
         <dependency>
-            <groupId>commons-lang</groupId>
-            <artifactId>commons-lang</artifactId>
-            <version>2.0</version>
-            <url>http://jakarta.apache.org/commons/lang.html</url>
-            <properties>
-              <dist.bundle>true</dist.bundle>
-            </properties>
-        </dependency>
-        <dependency>
             <groupId>javamail</groupId>
             <artifactId>javamail</artifactId>
-            <version>1.3.2</version>
+            <version>1.3.3</version>
             <url>http://java.sun.com/products/javamail/</url>
         </dependency>
         <dependency>

Modified: jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java?rev=279285&r1=279284&r2=279285&view=diff
==============================================================================
--- jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java (original)
+++ jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java Wed Sep
 7 02:52:44 2005
@@ -34,9 +34,6 @@
 import javax.mail.internet.MimeMessage;
 import javax.mail.internet.MimeMultipart;
 
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.Validate;
-
 /**
  * The base class for all email messages.  This class sets the
  * sender's email & name, receiver's email & name, subject, and the
@@ -272,7 +269,7 @@
     public void setContent(Object aObject, String aContentType)
     {
         this.content = aObject;
-        if (!StringUtils.isNotEmpty(aContentType))
+        if (EmailUtils.isEmpty(aContentType))
         {
             this.contentType = null;
         }
@@ -358,12 +355,12 @@
             Properties properties = new Properties(System.getProperties());
             properties.setProperty(MAIL_TRANSPORT_PROTOCOL, SMTP);
 
-            if (!StringUtils.isNotEmpty(this.hostName))
+            if (EmailUtils.isEmpty(this.hostName))
             {
                 this.hostName = properties.getProperty(MAIL_HOST);
             }
 
-            if (!StringUtils.isNotEmpty(this.hostName))
+            if (EmailUtils.isEmpty(this.hostName))
             {
                 throw new EmailException(
                     "Cannot find valid hostname for mail session");
@@ -407,12 +404,12 @@
         try
         {
             // check name input
-            if (!StringUtils.isNotEmpty(name))
+            if (EmailUtils.isEmpty(name))
             {
                 name = email;
             }
 
-            if (StringUtils.isNotEmpty(this.charset))
+            if (EmailUtils.isNotEmpty(this.charset))
             {
                 address = new InternetAddress(email, name, this.charset);
             }
@@ -660,11 +657,11 @@
             String strName = (String) entry.getKey();
             String strValue = (String) entry.getValue();
 
-            if (!StringUtils.isNotEmpty(strName))
+            if (EmailUtils.isEmpty(strName))
             {
                 throw new IllegalArgumentException("name can not be null");
             }
-            if (!StringUtils.isNotEmpty(strValue))
+            if (EmailUtils.isEmpty(strValue))
             {
                 throw new IllegalArgumentException("value can not be null");
             }
@@ -683,11 +680,11 @@
      */
     public void addHeader(String name, String value)
     {
-        if (!StringUtils.isNotEmpty(name))
+        if (EmailUtils.isEmpty(name))
         {
             throw new IllegalArgumentException("name can not be null");
         }
-        if (!StringUtils.isNotEmpty(value))
+        if (EmailUtils.isEmpty(value))
         {
             throw new IllegalArgumentException("value can not be null");
         }
@@ -749,9 +746,9 @@
             this.getMailSession();
             this.message = new MimeMessage(this.session);
 
-            if (StringUtils.isNotEmpty(this.subject))
+            if (EmailUtils.isNotEmpty(this.subject))
             {
-                if (StringUtils.isNotEmpty(this.charset))
+                if (EmailUtils.isNotEmpty(this.charset))
                 {
                     this.message.setSubject(this.subject, this.charset);
                 }
@@ -857,7 +854,7 @@
     public String sendMimeMessage()
        throws EmailException
     {
-        Validate.notNull(this.message, "message");
+        EmailUtils.notNull(this.message, "message");
 
         try
         {

Modified: jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/EmailException.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/EmailException.java?rev=279285&r1=279284&r2=279285&view=diff
==============================================================================
--- jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/EmailException.java
(original)
+++ jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/EmailException.java
Wed Sep  7 02:52:44 2005
@@ -15,58 +15,134 @@
  */
 package org.apache.commons.mail;
 
-import org.apache.commons.lang.exception.NestableException;
+import java.io.PrintStream;
+import java.io.PrintWriter;
 
 /**
- * EmailException
+ * Exception thrown when a checked error occurs in commons-email.
+ * <p>
+ * Supports nesting, emulating JDK 1.4 behavior if necessary.
+ * <p>
+ * Adapted from {@link org.apache.commons.collections.FunctorException}.
+ *
  * @author jakarta-commons
  * @since 1.0
+ * @version $Version: $
  */
-public class EmailException extends NestableException
-{
-    /** serialization version */
+public class EmailException extends Exception {
+
+    /** Serializable version identifier */
     static final long serialVersionUID = 5550674499282474616L;
 
     /**
-     * Create a new EmailException with no message and no cause.
-     * Note: This constructor should only be used as a last resort. Please
-     * provide at least a message.
-     * @since 1.0
+     * Does JDK support nested exceptions?
      */
-    public EmailException()
-    {
+    private static final boolean JDK_SUPPORTS_NESTED;
+
+    static {
+        boolean flag = false;
+        try {
+            Throwable.class.getDeclaredMethod("getCause", new Class[0]);
+            flag = true;
+        } catch (NoSuchMethodException ex) {
+            flag = false;
+        }
+        JDK_SUPPORTS_NESTED = flag;
+    }
+
+    /**
+     * Root cause of the exception
+     */
+    private final Throwable rootCause;
+
+    /**
+     * Constructs a new <code>EmailException</code> with no
+     * detail message.
+     */
+    public EmailException() {
         super();
+        this.rootCause = null;
+    }
+
+    /**
+     * Constructs a new <code>EmailException</code> with specified
+     * detail message.
+     *
+     * @param msg  the error message.
+     */
+    public EmailException(String msg) {
+        super(msg);
+        this.rootCause = null;
     }
 
     /**
-     * Create a new EmailException with a message but no other cause.
-     * @param msg the reason for this exception.
-     * @since 1.0
+     * Constructs a new <code>EmailException</code> with specified
+     * nested <code>Throwable</code> root cause.
+     *
+     * @param rootCause  the exception or error that caused this exception
+     *                   to be thrown.
      */
-    public EmailException(String msg)
-    {
+    public EmailException(Throwable rootCause) {
+        super((rootCause == null ? null : rootCause.getMessage()));
+        this.rootCause = rootCause;
+    }
+
+    /**
+     * Constructs a new <code>EmailException</code> with specified
+     * detail message and nested <code>Throwable</code> root cause.
+     *
+     * @param msg  the error message.
+     * @param rootCause  the exception or error that caused this exception
+     *                   to be thrown.
+     */
+    public EmailException(String msg, Throwable rootCause) {
         super(msg);
+        this.rootCause = rootCause;
+    }
+
+    /**
+     * Gets the cause of this throwable.
+     *
+     * @return  the cause of this throwable, or <code>null</code>
+     */
+    public Throwable getCause() {
+        return rootCause;
+    }
+
+    /**
+     * Prints the stack trace of this exception to the standard error stream.
+     */
+    public void printStackTrace() {
+        printStackTrace(System.err);
     }
 
     /**
-     * Create a new EmailException with a message and a cause.
-     * @param msg the reason for this exception.
-     * @param cause the contributing Throwable (e.g. some other Exception)
-     * @since 1.0
+     * Prints the stack trace of this exception to the specified stream.
+     *
+     * @param out  the <code>PrintStream</code> to use for output
      */
-    public EmailException(String msg, Throwable cause)
-    {
-        super(msg, cause);
+    public void printStackTrace(PrintStream out) {
+        synchronized (out) {
+            PrintWriter pw = new PrintWriter(out, false);
+            printStackTrace(pw);
+            // Flush the PrintWriter before it's GC'ed.
+            pw.flush();
+        }
     }
 
     /**
-     * Create a new EmailException with a cause but no message.
-     * @param cause the contributing Throwable (e.g. some other Exception)
-     * @since 1.0
+     * Prints the stack trace of this exception to the specified writer.
+     *
+     * @param out  the <code>PrintWriter</code> to use for output
      */
-    public EmailException(Throwable cause)
-    {
-        super(cause);
+    public void printStackTrace(PrintWriter out) {
+        synchronized (out) {
+            super.printStackTrace(out);
+            if (rootCause != null && JDK_SUPPORTS_NESTED == false) {
+                out.print("Caused by: ");
+                rootCause.printStackTrace(out);
+            }
+        }
     }
 
 }

Modified: jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/HtmlEmail.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/HtmlEmail.java?rev=279285&r1=279284&r2=279285&view=diff
==============================================================================
--- jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/HtmlEmail.java (original)
+++ jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/HtmlEmail.java Wed
Sep  7 02:52:44 2005
@@ -29,9 +29,6 @@
 import javax.mail.internet.MimeBodyPart;
 import javax.mail.internet.MimeMultipart;
 
-import org.apache.commons.lang.RandomStringUtils;
-import org.apache.commons.lang.StringUtils;
-
 /**
  * An HTML multipart email.
  *
@@ -84,7 +81,7 @@
      */
     public HtmlEmail setTextMsg(String aText) throws EmailException
     {
-        if (StringUtils.isEmpty(aText))
+        if (EmailUtils.isEmpty(aText))
         {
             throw new EmailException("Invalid message supplied");
         }
@@ -104,7 +101,7 @@
      */
     public HtmlEmail setHtmlMsg(String aHtml) throws EmailException
     {
-        if (StringUtils.isEmpty(aHtml))
+        if (EmailUtils.isEmpty(aHtml))
         {
             throw new EmailException("Invalid message supplied");
         }
@@ -130,7 +127,7 @@
      */
     public Email setMsg(String msg) throws EmailException
     {
-        if (StringUtils.isEmpty(msg))
+        if (EmailUtils.isEmpty(msg))
         {
             throw new EmailException("Invalid message supplied");
         }
@@ -192,7 +189,7 @@
             mbp.setDataHandler(new DataHandler(new URLDataSource(url)));
             mbp.setFileName(name);
             mbp.setDisposition("inline");
-            String cid = RandomStringUtils.randomAlphabetic(HtmlEmail.CID_LENGTH).toLowerCase();
+            String cid = EmailUtils.randomAlphabetic(HtmlEmail.CID_LENGTH).toLowerCase();
             mbp.addHeader("Content-ID", "<" + cid + ">");
             this.inlineImages.add(mbp);
             return cid;
@@ -247,12 +244,12 @@
         container.setSubType("mixed");
         subContainer = new MimeMultipart("alternative");
 
-        if (StringUtils.isNotEmpty(this.text))
+        if (EmailUtils.isNotEmpty(this.text))
         {
             msgText = new MimeBodyPart();
             subContainer.addBodyPart(msgText);
 
-            if (StringUtils.isNotEmpty(this.charset))
+            if (EmailUtils.isNotEmpty(this.charset))
             {
                 msgText.setContent(
                     this.text,
@@ -264,7 +261,7 @@
             }
         }
 
-        if (StringUtils.isNotEmpty(this.html))
+        if (EmailUtils.isNotEmpty(this.html))
         {
             if (this.inlineImages.size() > 0)
             {
@@ -277,7 +274,7 @@
                 subContainer.addBodyPart(msgHtml);
             }
 
-            if (StringUtils.isNotEmpty(this.charset))
+            if (EmailUtils.isNotEmpty(this.charset))
             {
                 msgHtml.setContent(
                     this.html,
@@ -319,10 +316,10 @@
         BodyPart msgText = null;
         BodyPart msgHtml = null;
 
-        if (StringUtils.isNotEmpty(this.text))
+        if (EmailUtils.isNotEmpty(this.text))
         {
             msgText = this.getPrimaryBodyPart();
-            if (StringUtils.isNotEmpty(this.charset))
+            if (EmailUtils.isNotEmpty(this.charset))
             {
                 msgText.setContent(
                     this.text,
@@ -334,7 +331,7 @@
             }
         }
 
-        if (StringUtils.isNotEmpty(this.html))
+        if (EmailUtils.isNotEmpty(this.html))
         {
             // if the txt part of the message was null, then the html part
             // will become the primary body part
@@ -356,7 +353,7 @@
                 }
             }
 
-            if (StringUtils.isNotEmpty(this.charset))
+            if (EmailUtils.isNotEmpty(this.charset))
             {
                 msgHtml.setContent(
                     this.html,

Modified: jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/MultiPartEmail.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/MultiPartEmail.java?rev=279285&r1=279284&r2=279285&view=diff
==============================================================================
--- jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/MultiPartEmail.java
(original)
+++ jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/MultiPartEmail.java
Wed Sep  7 02:52:44 2005
@@ -30,8 +30,6 @@
 import javax.mail.internet.MimeMultipart;
 import javax.mail.internet.MimePart;
 
-import org.apache.commons.lang.StringUtils;
-
 /**
  * A multipart email.
  *
@@ -192,7 +190,7 @@
     public Email setMsg(String msg) throws EmailException
     {
         // throw exception on null message
-        if (StringUtils.isEmpty(msg))
+        if (EmailUtils.isEmpty(msg))
         {
             throw new EmailException("Invalid message supplied");
         }
@@ -200,7 +198,7 @@
         {
             BodyPart primary = getPrimaryBodyPart();
 
-            if ((primary instanceof MimePart) && StringUtils.isNotEmpty(charset))
+            if ((primary instanceof MimePart) && EmailUtils.isNotEmpty(charset))
             {
                 ((MimePart) primary).setText(msg, charset);
             }
@@ -421,7 +419,7 @@
         String disposition)
         throws EmailException
     {
-        if (StringUtils.isEmpty(name))
+        if (EmailUtils.isEmpty(name))
         {
             name = ds.getName();
         }

Modified: jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/SimpleEmail.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/SimpleEmail.java?rev=279285&r1=279284&r2=279285&view=diff
==============================================================================
--- jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/SimpleEmail.java (original)
+++ jakarta/commons/proper/email/trunk/src/java/org/apache/commons/mail/SimpleEmail.java Wed
Sep  7 02:52:44 2005
@@ -15,8 +15,6 @@
  */
 package org.apache.commons.mail;
 
-import org.apache.commons.lang.StringUtils;
-
 /**
  * This class is used to send simple internet email messages without
  * attachments.
@@ -43,7 +41,7 @@
      */
     public Email setMsg(String msg) throws EmailException
     {
-        if (StringUtils.isEmpty(msg))
+        if (EmailUtils.isEmpty(msg))
         {
             throw new EmailException("Invalid message supplied");
         }

Modified: jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/MultiPartEmailTest.java
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/MultiPartEmailTest.java?rev=279285&r1=279284&r2=279285&view=diff
==============================================================================
--- jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/MultiPartEmailTest.java
(original)
+++ jakarta/commons/proper/email/trunk/src/test/org/apache/commons/mail/MultiPartEmailTest.java
Wed Sep  7 02:52:44 2005
@@ -24,7 +24,6 @@
 import javax.activation.URLDataSource;
 import javax.mail.internet.MimeMultipart;
 
-import org.apache.commons.lang.StringUtils;
 import org.apache.commons.mail.mocks.MockMultiPartEmailConcrete;
 
 /**
@@ -151,8 +150,8 @@
             testEmail.attach(attachment);
             testEmail.setSubType("subType");
 
-            if (StringUtils.isNotEmpty(this.strTestUser)
-                && StringUtils.isNotEmpty(this.strTestPasswd))
+            if (EmailUtils.isNotEmpty(this.strTestUser)
+                && EmailUtils.isNotEmpty(this.strTestPasswd))
             {
                 testEmail.setAuthentication(
                     this.strTestUser,

Modified: jakarta/commons/proper/email/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewcvs/jakarta/commons/proper/email/trunk/xdocs/changes.xml?rev=279285&r1=279284&r2=279285&view=diff
==============================================================================
--- jakarta/commons/proper/email/trunk/xdocs/changes.xml (original)
+++ jakarta/commons/proper/email/trunk/xdocs/changes.xml Wed Sep  7 02:52:44 2005
@@ -21,7 +21,13 @@
   </properties>
 
   <body>
-    <release version="1.0-rc6-SNAPSHOT" date="IN Subversion">
+    <release version="1.0-rc8-SNAPSHOT" date="in Subversion">
+      <action dev="henning" type="update" due-to="Stephen Colebourne" issue="36486">
+        Remove dependencies to commons-lang, allowing commons-email to exist without
+        any external dependencies in an J2EE 1.4+ environment.
+      </action>
+    </release>
+    <release version="1.0-rc6-SNAPSHOT" date="in Subversion">
       <action dev="epugh" type="update" due-to="Troy Poppe" issue="34056">
         Improve MultiPartEmail to ease extending it.
       </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