Skip to content

Commit

Permalink
Breaking change: use Jakarta namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
twogee committed Jul 18, 2021
1 parent 2475937 commit 7d1cd33
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 22 deletions.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@
classname="org.apache.bcel.Constants"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="javamail.present"
classname="javax.mail.Transport"
classname="jakarta.mail.Transport"
classpathref="classpath" ignoresystemclasses="${ignoresystemclasses}"/>
<available property="graaljs.present"
classname="com.oracle.truffle.js.scriptengine.GraalJSScriptEngine"
Expand Down
2 changes: 1 addition & 1 deletion lib/libraries.properties
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ hamcrest-core.version=1.3
hamcrest-library.version=${hamcrest-core.version}
jai-core.version=1.1.3
jai-codec.version=1.1.3
jakarta.mail.version=1.6.4
jakarta.mail.version=2.0.1
jakarta-regexp.version=1.4
# Later versions of Tomcat provide a jspc task
jasper-compiler.version=4.1.36
Expand Down
4 changes: 2 additions & 2 deletions src/main/org/apache/tools/ant/taskdefs/email/EmailTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,8 @@ public void execute() {
try {
//check to make sure that activation.jar
//and mail.jar are available - see bug 31969
Class.forName("javax.activation.DataHandler");
Class.forName("javax.mail.internet.MimeMessage");
Class.forName("jakarta.activation.DataHandler");
Class.forName("jakarta.mail.internet.MimeMessage");

mailer = ClasspathUtils.newInstance(
"org.apache.tools.ant.taskdefs.email.MimeMailer",
Expand Down
37 changes: 19 additions & 18 deletions src/main/org/apache/tools/ant/taskdefs/email/MimeMailer.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,22 @@
import java.util.StringTokenizer;
import java.util.Vector;

import javax.activation.DataHandler;
import javax.activation.FileDataSource;
import javax.mail.Address;
import javax.mail.Authenticator;
import javax.mail.Message;
import javax.mail.MessagingException;
import javax.mail.PasswordAuthentication;
import javax.mail.SendFailedException;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
import javax.mail.internet.MimeBodyPart;
import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
import jakarta.activation.DataHandler;
import jakarta.activation.DataSource;
import jakarta.activation.FileDataSource;
import jakarta.mail.Address;
import jakarta.mail.Authenticator;
import jakarta.mail.Message;
import jakarta.mail.MessagingException;
import jakarta.mail.PasswordAuthentication;
import jakarta.mail.SendFailedException;
import jakarta.mail.Session;
import jakarta.mail.Transport;
import jakarta.mail.internet.AddressException;
import jakarta.mail.internet.InternetAddress;
import jakarta.mail.internet.MimeBodyPart;
import jakarta.mail.internet.MimeMessage;
import jakarta.mail.internet.MimeMultipart;

import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
Expand All @@ -70,12 +71,12 @@ public class MimeMailer extends Mailer {
= System.getProperty("file.encoding");

// To work properly with national charsets we have to use
// implementation of interface javax.activation.DataSource
// implementation of interface jakarta.activation.DataSource
/**
* String data source implementation.
* @since Ant 1.6
*/
class StringDataSource implements javax.activation.DataSource {
class StringDataSource implements DataSource {
private String data = null;
private String type = null;
private String charset = null;
Expand Down Expand Up @@ -211,7 +212,7 @@ public void send() {
message.setCharset(charset);
}
}
// Using javax.activation.DataSource paradigm
// Using jakarta.activation.DataSource paradigm
final StringDataSource sds = new StringDataSource();
sds.setContentType(message.getMimeType());
sds.setCharset(charset);
Expand Down

0 comments on commit 7d1cd33

Please sign in to comment.