commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sgoes...@apache.org
Subject svn commit: r1296891 - in /commons/proper/email/trunk/src/java/org/apache/commons/mail: Email.java resolver/DataSourceBaseResolver.java resolver/DataSourceClassPathResolver.java resolver/DataSourceCompositeResolver.java util/MimeMessageUtils.java
Date Sun, 04 Mar 2012 22:21:47 GMT
Author: sgoeschl
Date: Sun Mar  4 22:21:46 2012
New Revision: 1296891

URL: http://svn.apache.org/viewvc?rev=1296891&view=rev
Log:
Fixed a few CheckStyle and FindBugs warnings.

Modified:
    commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java
    commons/proper/email/trunk/src/java/org/apache/commons/mail/resolver/DataSourceBaseResolver.java
    commons/proper/email/trunk/src/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java
    commons/proper/email/trunk/src/java/org/apache/commons/mail/resolver/DataSourceCompositeResolver.java
    commons/proper/email/trunk/src/java/org/apache/commons/mail/util/MimeMessageUtils.java

Modified: commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java?rev=1296891&r1=1296890&r2=1296891&view=diff
==============================================================================
--- commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java (original)
+++ commons/proper/email/trunk/src/java/org/apache/commons/mail/Email.java Sun Mar  4 22:21:46
2012
@@ -540,7 +540,7 @@ public abstract class Email implements E
 
             if (isSSLOnConnect() || isStartTLSEnabled())
             {
-                if(isSSLCheckServerIdentity())
+                if (isSSLCheckServerIdentity())
                 {
                     properties.setProperty(MAIL_SMTP_SSL_CHECKSERVERIDENTITY, "true");
                 }
@@ -1419,14 +1419,26 @@ public abstract class Email implements E
         return this;
     }
 
+    /**
+    * Is the server identity checked as specified by RFC 2595
+    *
+    * @return true if the server identity is checked
+    */
     public boolean isSSLCheckServerIdentity()
     {
         return sslCheckServerIdentity;
     }
 
-    public void setSSLCheckServerIdentity(boolean sslCheckServerIdentity)
+    /**
+     * Sets whether the server identity is checked as specified by RFC 2595
+     *
+     * @param sslCheckServerIdentity whether to enable server identity check
+     * @return An Email.
+     */
+    public Email setSSLCheckServerIdentity(boolean sslCheckServerIdentity)
     {
         this.sslCheckServerIdentity = sslCheckServerIdentity;
+        return this;
     }
 
     /**

Modified: commons/proper/email/trunk/src/java/org/apache/commons/mail/resolver/DataSourceBaseResolver.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/java/org/apache/commons/mail/resolver/DataSourceBaseResolver.java?rev=1296891&r1=1296890&r2=1296891&view=diff
==============================================================================
--- commons/proper/email/trunk/src/java/org/apache/commons/mail/resolver/DataSourceBaseResolver.java
(original)
+++ commons/proper/email/trunk/src/java/org/apache/commons/mail/resolver/DataSourceBaseResolver.java
Sun Mar  4 22:21:46 2012
@@ -28,11 +28,19 @@ public abstract class DataSourceBaseReso
     /** shall we ignore resources not found or complain with an exception */
     private final boolean lenient;
 
+    /**
+     * Constructor.
+     */
     public DataSourceBaseResolver()
     {
         this.lenient = false;
     }
 
+    /**
+     * Constructor.
+     *
+     * @param lenient shall we ignore resources not found or throw an exception?
+     */
     public DataSourceBaseResolver(final boolean lenient)
     {
         this.lenient = lenient;

Modified: commons/proper/email/trunk/src/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java?rev=1296891&r1=1296890&r2=1296891&view=diff
==============================================================================
--- commons/proper/email/trunk/src/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java
(original)
+++ commons/proper/email/trunk/src/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java
Sun Mar  4 22:21:46 2012
@@ -33,16 +33,30 @@ public class DataSourceClassPathResolver
     /** the base string of the resource relative to the classpath when resolving relative
paths */
     private final String classPathBase;
 
+    /**
+     * Constructor
+     */
     public DataSourceClassPathResolver()
     {
         this.classPathBase = "/";
     }
 
+    /**
+     * Constructor.
+     *
+     * @param classPathBase a base class path
+     */
     public DataSourceClassPathResolver(final String classPathBase)
     {
         this.classPathBase = classPathBase.endsWith("/") ? classPathBase : classPathBase
+ "/";
     }
 
+    /**
+     * Constructor.
+     *
+     * @param classPathBase a base class path
+     * @param lenient shall we ignore resources not found or throw an exception?
+     */
     public DataSourceClassPathResolver(final String classPathBase, final boolean lenient)
     {
         super(lenient);

Modified: commons/proper/email/trunk/src/java/org/apache/commons/mail/resolver/DataSourceCompositeResolver.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/java/org/apache/commons/mail/resolver/DataSourceCompositeResolver.java?rev=1296891&r1=1296890&r2=1296891&view=diff
==============================================================================
--- commons/proper/email/trunk/src/java/org/apache/commons/mail/resolver/DataSourceCompositeResolver.java
(original)
+++ commons/proper/email/trunk/src/java/org/apache/commons/mail/resolver/DataSourceCompositeResolver.java
Sun Mar  4 22:21:46 2012
@@ -32,12 +32,23 @@ public class DataSourceCompositeResolver
     /** the list of resolvers */
     private DataSourceResolver[] dataSourceResolvers;
 
+    /**
+     * Constructor.
+     *
+     * @param dataSourceResolvers a list of of resolvers being used
+     */
     public DataSourceCompositeResolver(final DataSourceResolver[] dataSourceResolvers)
     {
         this.dataSourceResolvers = new DataSourceResolver[dataSourceResolvers.length];
         System.arraycopy(dataSourceResolvers, 0, this.dataSourceResolvers, 0, dataSourceResolvers.length);
     }
 
+    /**
+     * Constructor.
+     *
+     * @param dataSourceResolvers a list of of resolvers being used
+     * @param isLenient shall we ignore resources not found or throw an exception?
+     */
     public DataSourceCompositeResolver(final DataSourceResolver[] dataSourceResolvers, final
boolean isLenient)
     {
         super(isLenient);
@@ -45,6 +56,11 @@ public class DataSourceCompositeResolver
         System.arraycopy(dataSourceResolvers, 0, this.dataSourceResolvers, 0, dataSourceResolvers.length);
     }
 
+    /**
+     * Get the underlying data source resolvers.
+     *
+     * @return underlying data source resolvers
+     */
     public DataSourceResolver[] getDataSourceResolvers()
     {
         return dataSourceResolvers;

Modified: commons/proper/email/trunk/src/java/org/apache/commons/mail/util/MimeMessageUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/java/org/apache/commons/mail/util/MimeMessageUtils.java?rev=1296891&r1=1296890&r2=1296891&view=diff
==============================================================================
--- commons/proper/email/trunk/src/java/org/apache/commons/mail/util/MimeMessageUtils.java
(original)
+++ commons/proper/email/trunk/src/java/org/apache/commons/mail/util/MimeMessageUtils.java
Sun Mar  4 22:21:46 2012
@@ -156,7 +156,14 @@ public final class MimeMessageUtils
 
         try
         {
-            resultFile.getParentFile().mkdirs();
+            if(!resultFile.getParentFile().exists())
+            {
+                if(!resultFile.getParentFile().mkdirs())
+                {
+                    throw new IOException("Failed to created the following parent directories
: " + resultFile.getParentFile());
+                }
+            }
+
             fos = new FileOutputStream(resultFile);
             mimeMessage.writeTo(fos);
             fos.flush();
@@ -170,7 +177,6 @@ public final class MimeMessageUtils
                 try
                 {
                     fos.close();
-                    fos = null;
                 }
                 catch (Exception e)
                 {



Mime
View raw message