Author: veithen
Date: Thu Jan 4 21:21:51 2018
New Revision: 1820217
URL: http://svn.apache.org/viewvc?rev=1820217&view=rev
Log:
Eliminate usage of deprecated Axiom API.
Modified:
axis/axis2/java/core/trunk/modules/transport/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportSender.java
Modified:
axis/axis2/java/core/trunk/modules/transport/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportSender.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportSender.java?rev=1820217&r1=1820216&r2=1820217&view=diff
==============================================================================
---
axis/axis2/java/core/trunk/modules/transport/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportSender.java
(original)
+++
axis/axis2/java/core/trunk/modules/transport/mail/src/main/java/org/apache/axis2/transport/mail/MailTransportSender.java
Thu Jan 4 21:21:51 2018
@@ -30,16 +30,21 @@ import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.AddressingConstants;
import org.apache.axis2.transport.OutTransportInfo;
import org.apache.axis2.transport.MessageFormatter;
+import org.apache.axiom.mime.ContentType;
import org.apache.axiom.om.OMOutputFormat;
-import org.apache.axiom.om.util.CommonUtils;
import javax.mail.*;
-import javax.mail.internet.*;
+import javax.mail.internet.AddressException;
+import javax.mail.internet.InternetAddress;
+import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMultipart;
+import javax.mail.internet.MimePart;
import javax.activation.DataHandler;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.io.IOException;
+import java.text.ParseException;
/**
* The mail transport sender sends mail using an SMTP server configuration
defined
@@ -469,8 +474,8 @@ public class MailTransportSender extends
mainPart.setHeader("Content-Transfer-Encoding",
(String)
msgContext.getOptions().getProperty("Content-Transfer-Encoding"));
} else {
- String contentType =
dataHandler.getContentType().toLowerCase();
- if (!contentType.startsWith("multipart/") &&
CommonUtils.isTextualPart(contentType)) {
+ ContentType contentType = new
ContentType(dataHandler.getContentType());
+ if (!contentType.getMediaType().hasPrimaryType("multipart") &&
contentType.isTextual()) {
mainPart.setHeader("Content-Transfer-Encoding",
"quoted-printable");
}
}
@@ -495,7 +500,7 @@ public class MailTransportSender extends
metrics.incrementBytesSent(msgContext, bytesSent);
}
- } catch (MessagingException e) {
+ } catch (MessagingException | ParseException e) {
metrics.incrementFaultsSending();
handleException("Error creating mail message or sending it to the
configured server", e);