commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1787115 - in /commons/proper/email/trunk/src: changes/changes.xml main/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java
Date Thu, 16 Mar 2017 00:36:48 GMT
Author: sebb
Date: Thu Mar 16 00:36:48 2017
New Revision: 1787115

URL: http://svn.apache.org/viewvc?rev=1787115&view=rev
Log:
EMAIL-167 DataSourceClassPathResolver doesn't close InputStream when resolving resources

Modified:
    commons/proper/email/trunk/src/changes/changes.xml
    commons/proper/email/trunk/src/main/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java

Modified: commons/proper/email/trunk/src/changes/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/changes/changes.xml?rev=1787115&r1=1787114&r2=1787115&view=diff
==============================================================================
--- commons/proper/email/trunk/src/changes/changes.xml (original)
+++ commons/proper/email/trunk/src/changes/changes.xml Thu Mar 16 00:36:48 2017
@@ -22,7 +22,11 @@
   </properties>
 
   <body>
-    <release version="1.5" date="2016-MM-DD">
+    <release version="1.5" date="2017-MM-DD">
+      <!-- N.B. AFAICT the date attribute is not used anywhere so no point in adding it
-->
+      <action dev="sebb" type="fix" issue="EMAIL-167" due-to="Lucian Burja">
+        DataSourceClassPathResolver doesn't close InputStream when resolving resources
+      </action>
       <action dev="sgoeschl" type="update" issue="EMAIL-165" date="2017-01-02">
         Upgrade to javax.mail-1.5.6
       </action>

Modified: commons/proper/email/trunk/src/main/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java
URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/main/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java?rev=1787115&r1=1787114&r2=1787115&view=diff
==============================================================================
--- commons/proper/email/trunk/src/main/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java
(original)
+++ commons/proper/email/trunk/src/main/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java
Thu Mar 16 00:36:48 2017
@@ -95,11 +95,17 @@ public class DataSourceClassPathResolver
 
                 if (is != null)
                 {
-                    final ByteArrayDataSource ds = new ByteArrayDataSource(is, mimeType);
-                    // EMAIL-125: set the name of the DataSource to the normalized resource
URL
-                    // similar to other DataSource implementations, e.g. FileDataSource,
URLDataSource
-                    ds.setName(DataSourceClassPathResolver.class.getResource(resourceName).toString());
-                    result = ds;
+                    try
+                    {
+                        final ByteArrayDataSource ds = new ByteArrayDataSource(is, mimeType);
+                        // EMAIL-125: set the name of the DataSource to the normalized resource
URL
+                        // similar to other DataSource implementations, e.g. FileDataSource,
URLDataSource
+                        ds.setName(DataSourceClassPathResolver.class.getResource(resourceName).toString());
+                        result = ds;
+                    } finally
+                    {
+                        is.close();
+                    }
                 }
                 else
                 {



Mime
View raw message