Re: svn commit: r1448981 - in /commons/proper/email/trunk/src: main/java/org/apache/commons/mail/ main/java/org/apache/commons/mail/resolver/ test/java/org/apache/commons/mail/
Hi Thomas, 2013/2/22 t...@apache.org Author: tn Date: Fri Feb 22 10:40:34 2013 New Revision: 1448981 URL: http://svn.apache.org/r1448981 Log: [EMAIL-125] Add datasource name for ByteArrayDataSource, fixes embedding multiple resources loaded from a ClassPath resolver. Modified: commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ImageHtmlEmail.java commons/proper/email/trunk/src/main/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java commons/proper/email/trunk/src/test/java/org/apache/commons/mail/ImageHtmlEmailTest.java Modified: commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java?rev=1448981r1=1448980r2=1448981view=diff == --- commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java (original) +++ commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java Fri Feb 22 10:40:34 2013 @@ -34,6 +34,10 @@ import javax.activation.DataSource; * - a byte arraybr * - a Stringbr * + * p + * From version 1.3.1, it is possible to set a name for this DataSource, + * and it is recommended to do so. + * * @since 1.0 * @author a href=mailto:colin.chalm...@maxware.nl;Colin Chalmers/a * @author a href=mailto:j...@latchkey.com;Jon S. Stevens/a @@ -52,6 +56,13 @@ public class ByteArrayDataSource impleme private final String type; // = application/octet-stream; /** + * The name associated with this data source. + * By default, the name is an empty string, similar to javax.mail.util.ByteArrayDataSource. + * @since 1.3.1 + */ +private String name = ; + +/** * Create a datasource from a byte array. * * @param data A byte[]. @@ -203,6 +214,17 @@ public class ByteArrayDataSource impleme } /** + * Sets the name for this DataSource. + * + * @param name The name. + * @since 1.3.1 + */ +public void setName(String name) +{ +this.name = name; +} Is it possible to do this in 1.3.1? This is a change of the external API. I always thought that this would cause the minor-segment of the version to change. According to the versioning guidelines [1] a point release is only possible if it only involves simple bug fixes or optimizations that do not introduce new features. To me it is not clear what exactly is a new feature. Benedikt [1] http://commons.apache.org/releases/versioning.html + +/** * Get the name. * * @return A String. @@ -210,7 +232,7 @@ public class ByteArrayDataSource impleme */ public String getName() { -return ByteArrayDataSource; +return name; } /** Modified: commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ImageHtmlEmail.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ImageHtmlEmail.java?rev=1448981r1=1448980r2=1448981view=diff == --- commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ImageHtmlEmail.java (original) +++ commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ImageHtmlEmail.java Fri Feb 22 10:40:34 2013 @@ -161,6 +161,11 @@ public class ImageHtmlEmail extends Html if (dataSource != null) { String name = dataSource.getName(); +if (EmailUtils.isEmpty(name)) +{ +name = resourceLocation; +} + String cid = cidCache.get(name); if (cid == null) 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=1448981r1=1448980r2=1448981view=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 Fri Feb 22 10:40:34 2013 @@ -93,7 +93,11 @@ public class DataSourceClassPathResolver if (is != null) { -result = new ByteArrayDataSource(is, mimeType); +ByteArrayDataSource ds = new ByteArrayDataSource(is, mimeType); +// EMAIL-125: set the name of
Re: svn commit: r1448981 - in /commons/proper/email/trunk/src: main/java/org/apache/commons/mail/ main/java/org/apache/commons/mail/resolver/ test/java/org/apache/commons/mail/
On 02/22/2013 01:36 PM, Benedikt Ritter wrote: Hi Thomas, 2013/2/22 t...@apache.org Author: tn Date: Fri Feb 22 10:40:34 2013 New Revision: 1448981 URL: http://svn.apache.org/r1448981 Log: [EMAIL-125] Add datasource name for ByteArrayDataSource, fixes embedding multiple resources loaded from a ClassPath resolver. Modified: commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ImageHtmlEmail.java commons/proper/email/trunk/src/main/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java commons/proper/email/trunk/src/test/java/org/apache/commons/mail/ImageHtmlEmailTest.java Modified: commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java?rev=1448981r1=1448980r2=1448981view=diff == --- commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java (original) +++ commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java Fri Feb 22 10:40:34 2013 @@ -34,6 +34,10 @@ import javax.activation.DataSource; * - a byte arraybr * - a Stringbr * + * p + * From version 1.3.1, it is possible to set a name for this DataSource, + * and it is recommended to do so. + * * @since 1.0 * @author a href=mailto:colin.chalm...@maxware.nl;Colin Chalmers/a * @author a href=mailto:j...@latchkey.com;Jon S. Stevens/a @@ -52,6 +56,13 @@ public class ByteArrayDataSource impleme private final String type; // = application/octet-stream; /** + * The name associated with this data source. + * By default, the name is an empty string, similar to javax.mail.util.ByteArrayDataSource. + * @since 1.3.1 + */ +private String name = ; + +/** * Create a datasource from a byte array. * * @param data A byte[]. @@ -203,6 +214,17 @@ public class ByteArrayDataSource impleme } /** + * Sets the name for this DataSource. + * + * @param name The name. + * @since 1.3.1 + */ +public void setName(String name) +{ +this.name = name; +} Is it possible to do this in 1.3.1? This is a change of the external API. I always thought that this would cause the minor-segment of the version to change. According to the versioning guidelines [1] a point release is only possible if it only involves simple bug fixes or optimizations that do not introduce new features. To me it is not clear what exactly is a new feature. you just copied the part of the sentence that make it appear as a mandatory requirement. The full sentence is: A point release typically involves simple bug fixes or optimizations that do not introduce new features. Developers may perform a point release if the release is at least interface-compatible with the previous release. The interface is compatible with a previous release, just a new method has been added which was necessary to fix the bug in a clean way. Additionally, to keep backwards compatibility, I added a sanity check, if the name of the DataSource is not set, and default it to the resource location in that case (although this should not happen in any case as the DataSource is created by email itself). Thomas - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org
Re: svn commit: r1448981 - in /commons/proper/email/trunk/src: main/java/org/apache/commons/mail/ main/java/org/apache/commons/mail/resolver/ test/java/org/apache/commons/mail/
On 02/22/2013 01:50 PM, Thomas Neidhart wrote: On 02/22/2013 01:36 PM, Benedikt Ritter wrote: Hi Thomas, 2013/2/22 t...@apache.org Author: tn Date: Fri Feb 22 10:40:34 2013 New Revision: 1448981 URL: http://svn.apache.org/r1448981 Log: [EMAIL-125] Add datasource name for ByteArrayDataSource, fixes embedding multiple resources loaded from a ClassPath resolver. Modified: commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ImageHtmlEmail.java commons/proper/email/trunk/src/main/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java commons/proper/email/trunk/src/test/java/org/apache/commons/mail/ImageHtmlEmailTest.java Modified: commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java?rev=1448981r1=1448980r2=1448981view=diff == --- commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java (original) +++ commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java Fri Feb 22 10:40:34 2013 @@ -34,6 +34,10 @@ import javax.activation.DataSource; * - a byte arraybr * - a Stringbr * + * p + * From version 1.3.1, it is possible to set a name for this DataSource, + * and it is recommended to do so. + * * @since 1.0 * @author a href=mailto:colin.chalm...@maxware.nl;Colin Chalmers/a * @author a href=mailto:j...@latchkey.com;Jon S. Stevens/a @@ -52,6 +56,13 @@ public class ByteArrayDataSource impleme private final String type; // = application/octet-stream; /** + * The name associated with this data source. + * By default, the name is an empty string, similar to javax.mail.util.ByteArrayDataSource. + * @since 1.3.1 + */ +private String name = ; + +/** * Create a datasource from a byte array. * * @param data A byte[]. @@ -203,6 +214,17 @@ public class ByteArrayDataSource impleme } /** + * Sets the name for this DataSource. + * + * @param name The name. + * @since 1.3.1 + */ +public void setName(String name) +{ +this.name = name; +} Is it possible to do this in 1.3.1? This is a change of the external API. I always thought that this would cause the minor-segment of the version to change. According to the versioning guidelines [1] a point release is only possible if it only involves simple bug fixes or optimizations that do not introduce new features. To me it is not clear what exactly is a new feature. you just copied the part of the sentence that make it appear as a mandatory requirement. The full sentence is: A point release typically involves simple bug fixes or optimizations that do not introduce new features. Developers may perform a point release if the release is at least interface-compatible with the previous release. The interface is compatible with a previous release, just a new method has been added which was necessary to fix the bug in a clean way. Additionally, to keep backwards compatibility, I added a sanity check, if the name of the DataSource is not set, and default it to the resource location in that case (although this should not happen in any case as the DataSource is created by email itself). btw. take a look here: http://commons.apache.org/beanutils/clirr-report.html Thomas - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org
Re: svn commit: r1448981 - in /commons/proper/email/trunk/src: main/java/org/apache/commons/mail/ main/java/org/apache/commons/mail/resolver/ test/java/org/apache/commons/mail/
Hi Thomas 2013/2/22 Thomas Neidhart thomas.neidh...@gmail.com On 02/22/2013 01:50 PM, Thomas Neidhart wrote: On 02/22/2013 01:36 PM, Benedikt Ritter wrote: Hi Thomas, 2013/2/22 t...@apache.org Author: tn Date: Fri Feb 22 10:40:34 2013 New Revision: 1448981 URL: http://svn.apache.org/r1448981 Log: [EMAIL-125] Add datasource name for ByteArrayDataSource, fixes embedding multiple resources loaded from a ClassPath resolver. Modified: commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ImageHtmlEmail.java commons/proper/email/trunk/src/main/java/org/apache/commons/mail/resolver/DataSourceClassPathResolver.java commons/proper/email/trunk/src/test/java/org/apache/commons/mail/ImageHtmlEmailTest.java Modified: commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java URL: http://svn.apache.org/viewvc/commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java?rev=1448981r1=1448980r2=1448981view=diff == --- commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java (original) +++ commons/proper/email/trunk/src/main/java/org/apache/commons/mail/ByteArrayDataSource.java Fri Feb 22 10:40:34 2013 @@ -34,6 +34,10 @@ import javax.activation.DataSource; * - a byte arraybr * - a Stringbr * + * p + * From version 1.3.1, it is possible to set a name for this DataSource, + * and it is recommended to do so. + * * @since 1.0 * @author a href=mailto:colin.chalm...@maxware.nl;Colin Chalmers/a * @author a href=mailto:j...@latchkey.com;Jon S. Stevens/a @@ -52,6 +56,13 @@ public class ByteArrayDataSource impleme private final String type; // = application/octet-stream; /** + * The name associated with this data source. + * By default, the name is an empty string, similar to javax.mail.util.ByteArrayDataSource. + * @since 1.3.1 + */ +private String name = ; + +/** * Create a datasource from a byte array. * * @param data A byte[]. @@ -203,6 +214,17 @@ public class ByteArrayDataSource impleme } /** + * Sets the name for this DataSource. + * + * @param name The name. + * @since 1.3.1 + */ +public void setName(String name) +{ +this.name = name; +} Is it possible to do this in 1.3.1? This is a change of the external API. I always thought that this would cause the minor-segment of the version to change. According to the versioning guidelines [1] a point release is only possible if it only involves simple bug fixes or optimizations that do not introduce new features. To me it is not clear what exactly is a new feature. you just copied the part of the sentence that make it appear as a mandatory requirement. The full sentence is: A point release typically involves simple bug fixes or optimizations that do not introduce new features. Developers may perform a point release if the release is at least interface-compatible with the previous release. The interface is compatible with a previous release, just a new method has been added which was necessary to fix the bug in a clean way. Additionally, to keep backwards compatibility, I added a sanity check, if the name of the DataSource is not set, and default it to the resource location in that case (although this should not happen in any case as the DataSource is created by email itself). btw. take a look here: http://commons.apache.org/beanutils/clirr-report.html Thanks for the clarification! Thomas - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org -- http://people.apache.org/~britter/ http://www.systemoutprintln.de/ http://twitter.com/BenediktRitter http://github.com/britter