Author: sebb
Date: Tue Apr 24 19:52:27 2012
New Revision: 1329972

URL: http://svn.apache.org/viewvc?rev=1329972&view=rev
Log:
Immutable private type might as well be final

Modified:
    
commons/proper/email/trunk/src/java/org/apache/commons/mail/ByteArrayDataSource.java

Modified: 
commons/proper/email/trunk/src/java/org/apache/commons/mail/ByteArrayDataSource.java
URL: 
http://svn.apache.org/viewvc/commons/proper/email/trunk/src/java/org/apache/commons/mail/ByteArrayDataSource.java?rev=1329972&r1=1329971&r2=1329972&view=diff
==============================================================================
--- 
commons/proper/email/trunk/src/java/org/apache/commons/mail/ByteArrayDataSource.java
 (original)
+++ 
commons/proper/email/trunk/src/java/org/apache/commons/mail/ByteArrayDataSource.java
 Tue Apr 24 19:52:27 2012
@@ -49,7 +49,7 @@ public class ByteArrayDataSource impleme
     private ByteArrayOutputStream baos;
 
     /** Content-type. */
-    private String type = "application/octet-stream";
+    private final String type;// = "application/octet-stream";
 
     /**
      * Create a datasource from a byte array.
@@ -61,12 +61,13 @@ public class ByteArrayDataSource impleme
      */
     public ByteArrayDataSource(byte[] data, String aType) throws IOException
     {
+        this.type = aType;
         ByteArrayInputStream bis = null;
 
         try
         {
             bis = new ByteArrayInputStream(data);
-            this.byteArrayDataSource(bis, aType);
+            this.byteArrayDataSource(bis);
         }
         finally
         {
@@ -87,7 +88,8 @@ public class ByteArrayDataSource impleme
      */
     public ByteArrayDataSource(InputStream aIs, String aType) throws 
IOException
     {
-        this.byteArrayDataSource(aIs, aType);
+        this.type = aType;
+        this.byteArrayDataSource(aIs);
     }
 
     /**
@@ -131,14 +133,11 @@ public class ByteArrayDataSource impleme
       * Create a datasource from an input stream.
       *
       * @param aIs An InputStream.
-      * @param aType A String.
       * @throws IOException IOException
       */
-    private void byteArrayDataSource(InputStream aIs, String aType)
+    private void byteArrayDataSource(InputStream aIs)
         throws IOException
     {
-        this.type = aType;
-
         BufferedInputStream bis = null;
         BufferedOutputStream osWriter = null;
 


Reply via email to