Author: sebb Date: Tue Aug 30 14:48:15 2011 New Revision: 1163241 URL: http://svn.apache.org/viewvc?rev=1163241&view=rev Log: NET-421 Problem connecting to TLS/SSL SMTP server using explicit mode
Modified: commons/proper/net/trunk/src/changes/changes.xml commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTP.java commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java Modified: commons/proper/net/trunk/src/changes/changes.xml URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/changes/changes.xml?rev=1163241&r1=1163240&r2=1163241&view=diff ============================================================================== --- commons/proper/net/trunk/src/changes/changes.xml (original) +++ commons/proper/net/trunk/src/changes/changes.xml Tue Aug 30 14:48:15 2011 @@ -59,6 +59,9 @@ The <action> type attribute can be add,u <release version="3.0.2-SNAPSHOT" date="TBA" description=" TBA "> + <action issue="NET-421" dev="sebb" type="fix" due-to="Oliver Saggau"> + Problem connecting to TLS/SSL SMTP server using explicit mode. + </action> <action issue="NET-415" dev="sebb" type="fix"> typo in migration how-to. </action> Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTP.java URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTP.java?rev=1163241&r1=1163240&r2=1163241&view=diff ============================================================================== --- commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTP.java (original) +++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTP.java Tue Aug 30 14:48:15 2011 @@ -93,7 +93,7 @@ public class SMTP extends SocketClient private static final String __DEFAULT_ENCODING = "ISO-8859-1"; /** The encoding to use (user-settable) */ - private final String encoding; + protected final String encoding; /** * A ProtocolCommandSupport object used to manage the registering of Modified: commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java URL: http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java?rev=1163241&r1=1163240&r2=1163241&view=diff ============================================================================== --- commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java (original) +++ commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/SMTPSClient.java Tue Aug 30 14:48:15 2011 @@ -17,7 +17,10 @@ package org.apache.commons.net.smtp; +import java.io.BufferedWriter; import java.io.IOException; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; import java.net.Socket; import javax.net.ssl.KeyManager; import javax.net.ssl.SSLContext; @@ -26,6 +29,7 @@ import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; import javax.net.ssl.TrustManager; +import org.apache.commons.net.io.CRLFLineReader; import org.apache.commons.net.util.SSLContextUtils; /** @@ -178,6 +182,11 @@ public class SMTPSClient extends SMTPCli _socket_ = socket; _input_ = socket.getInputStream(); _output_ = socket.getOutputStream(); + _reader = new CRLFLineReader( + new InputStreamReader(_input_, encoding)); + _writer = new BufferedWriter( + new OutputStreamWriter(_output_, encoding)); + } /**