Author: sebb
Date: Sun Apr 10 13:01:11 2016
New Revision: 1738430
URL: http://svn.apache.org/viewvc?rev=1738430&view=rev
Log:
We can now use getCharset instead of the name
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/SocketClient.java
commons/proper/net/trunk/src/main/java/org/apache/commons/net/bsd/RExecClient.java
commons/proper/net/trunk/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java
commons/proper/net/trunk/src/main/java/org/apache/commons/net/finger/FingerClient.java
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java
commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java
commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java
commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Client.java
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java
commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/Telnet.java
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/SocketClient.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/SocketClient.java?rev=1738430&r1=1738429&r2=1738430&view=diff
==============================================================================
---
commons/proper/net/trunk/src/main/java/org/apache/commons/net/SocketClient.java
(original)
+++
commons/proper/net/trunk/src/main/java/org/apache/commons/net/SocketClient.java
Sun Apr 10 13:01:11 2016
@@ -852,8 +852,9 @@ public abstract class SocketClient
*
* @return the charset.
* @since 3.3
- * TODO Will be deprecated once the code requires Java 1.6 as a mininmum
+ * @deprecated Since the code now requires Java 1.6 as a mininmum
*/
+ @Deprecated
public String getCharsetName() {
return charset.name();
}
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/bsd/RExecClient.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/bsd/RExecClient.java?rev=1738430&r1=1738429&r2=1738430&view=diff
==============================================================================
---
commons/proper/net/trunk/src/main/java/org/apache/commons/net/bsd/RExecClient.java
(original)
+++
commons/proper/net/trunk/src/main/java/org/apache/commons/net/bsd/RExecClient.java
Sun Apr 10 13:01:11 2016
@@ -214,11 +214,11 @@ public class RExecClient extends SocketC
_output_.write(NULL_CHAR);
}
- _output_.write(username.getBytes(getCharsetName())); // Java 1.6 can
use getCharset()
+ _output_.write(username.getBytes(getCharset()));
_output_.write(NULL_CHAR);
- _output_.write(password.getBytes(getCharsetName())); // Java 1.6 can
use getCharset()
+ _output_.write(password.getBytes(getCharset()));
_output_.write(NULL_CHAR);
- _output_.write(command.getBytes(getCharsetName())); // Java 1.6 can
use getCharset()
+ _output_.write(command.getBytes(getCharset()));
_output_.write(NULL_CHAR);
_output_.flush();
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java?rev=1738430&r1=1738429&r2=1738430&view=diff
==============================================================================
---
commons/proper/net/trunk/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java
(original)
+++
commons/proper/net/trunk/src/main/java/org/apache/commons/net/daytime/DaytimeTCPClient.java
Sun Apr 10 13:01:11 2016
@@ -71,7 +71,7 @@ public final class DaytimeTCPClient exte
StringBuilder result = new StringBuilder(__buffer.length);
BufferedReader reader;
- reader = new BufferedReader(new InputStreamReader(_input_,
getCharsetName())); // Java 1.6 can use getCharset()
+ reader = new BufferedReader(new InputStreamReader(_input_,
getCharset()));
while (true)
{
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/finger/FingerClient.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/finger/FingerClient.java?rev=1738430&r1=1738429&r2=1738430&view=diff
==============================================================================
---
commons/proper/net/trunk/src/main/java/org/apache/commons/net/finger/FingerClient.java
(original)
+++
commons/proper/net/trunk/src/main/java/org/apache/commons/net/finger/FingerClient.java
Sun Apr 10 13:01:11 2016
@@ -89,7 +89,7 @@ public class FingerClient extends Socket
input =
new BufferedReader(new InputStreamReader(getInputStream(longOutput,
- username), getCharsetName())); // Java 1.6 can
use getCharset()
+ username), getCharset()));
try {
while (true)
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java?rev=1738430&r1=1738429&r2=1738430&view=diff
==============================================================================
---
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java
(original)
+++
commons/proper/net/trunk/src/main/java/org/apache/commons/net/ftp/FTPHTTPClient.java
Sun Apr 10 13:01:11 2016
@@ -165,7 +165,7 @@ public class FTPHTTPClient extends FTPCl
List<String> response = new ArrayList<String>();
BufferedReader reader = new BufferedReader(
- new InputStreamReader(input, getCharsetName())); // Java 1.6
can use getCharset()
+ new InputStreamReader(input, getCharset()));
for (String line = reader.readLine(); line != null
&& line.length() > 0; line = reader.readLine()) {
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java?rev=1738430&r1=1738429&r2=1738430&view=diff
==============================================================================
---
commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java
(original)
+++
commons/proper/net/trunk/src/main/java/org/apache/commons/net/imap/AuthenticatingIMAPClient.java
Sun Apr 10 13:01:11 2016
@@ -158,7 +158,7 @@ public class AuthenticatingIMAPClient ex
// the server sends an empty response ("+ "), so we don't have
to read it.
int result = sendData(
Base64.encodeBase64StringUnChunked(("\000" + username +
"\000" + password)
- .getBytes(getCharsetName()))); // Java 1.6 can
use getCharset()
+ .getBytes(getCharset())));
if (result == IMAPReply.OK)
{
setState(IMAP.IMAPState.AUTH_STATE);
@@ -171,12 +171,11 @@ public class AuthenticatingIMAPClient ex
byte[] serverChallenge =
Base64.decodeBase64(getReplyString().substring(2).trim());
// get the Mac instance
Mac hmac_md5 = Mac.getInstance("HmacMD5");
- hmac_md5.init(new
SecretKeySpec(password.getBytes(getCharsetName()), "HmacMD5")); // Java 1.6 can
use getCharset()
+ hmac_md5.init(new
SecretKeySpec(password.getBytes(getCharset()), "HmacMD5"));
// compute the result:
- // Java 1.6 can use getCharset()
- byte[] hmacResult =
_convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharsetName());
+ byte[] hmacResult =
_convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharset());
// join the byte arrays to form the reply
- byte[] usernameBytes = username.getBytes(getCharsetName()); //
Java 1.6 can use getCharset()
+ byte[] usernameBytes = username.getBytes(getCharset());
byte[] toEncode = new byte[usernameBytes.length + 1 /* the
space */ + hmacResult.length];
System.arraycopy(usernameBytes, 0, toEncode, 0,
usernameBytes.length);
toEncode[usernameBytes.length] = ' ';
@@ -193,14 +192,11 @@ public class AuthenticatingIMAPClient ex
{
// the server sends fixed responses (base64("Username") and
// base64("Password")), so we don't have to read them.
- if (sendData(
- // Java 1.6 can use getCharset()
-
Base64.encodeBase64StringUnChunked(username.getBytes(getCharsetName()))) !=
IMAPReply.CONT)
+ if
(sendData(Base64.encodeBase64StringUnChunked(username.getBytes(getCharset())))
!= IMAPReply.CONT)
{
return false;
}
- // Java 1.6 can use getCharset()
- int result =
sendData(Base64.encodeBase64StringUnChunked(password.getBytes(getCharsetName())));
+ int result =
sendData(Base64.encodeBase64StringUnChunked(password.getBytes(getCharset())));
if (result == IMAPReply.OK)
{
setState(IMAP.IMAPState.AUTH_STATE);
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java?rev=1738430&r1=1738429&r2=1738430&view=diff
==============================================================================
---
commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java
(original)
+++
commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/ExtendedPOP3Client.java
Sun Apr 10 13:01:11 2016
@@ -77,20 +77,19 @@ public class ExtendedPOP3Client extends
// the server sends an empty response ("+ "), so we don't have
to read it.
return sendCommand(
new String(
- Base64.encodeBase64(("\000" + username + "\000" +
password).getBytes(getCharsetName())),
- getCharsetName()) // Java 1.6 can use getCharset()
+ Base64.encodeBase64(("\000" + username + "\000" +
password).getBytes(getCharset())),
+ getCharset())
) == POP3Reply.OK;
case CRAM_MD5:
// get the CRAM challenge
byte[] serverChallenge =
Base64.decodeBase64(getReplyString().substring(2).trim());
// get the Mac instance
Mac hmac_md5 = Mac.getInstance("HmacMD5");
- hmac_md5.init(new
SecretKeySpec(password.getBytes(getCharsetName()), "HmacMD5")); // Java 1.6 can
use getCharset()
+ hmac_md5.init(new
SecretKeySpec(password.getBytes(getCharset()), "HmacMD5"));
// compute the result:
- // Java 1.6 can use getCharset()
- byte[] hmacResult =
_convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharsetName());
+ byte[] hmacResult =
_convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharset());
// join the byte arrays to form the reply
- byte[] usernameBytes = username.getBytes(getCharsetName()); //
Java 1.6 can use getCharset()
+ byte[] usernameBytes = username.getBytes(getCharset());
byte[] toEncode = new byte[usernameBytes.length + 1 /* the
space */ + hmacResult.length];
System.arraycopy(usernameBytes, 0, toEncode, 0,
usernameBytes.length);
toEncode[usernameBytes.length] = ' ';
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Client.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Client.java?rev=1738430&r1=1738429&r2=1738430&view=diff
==============================================================================
---
commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Client.java
(original)
+++
commons/proper/net/trunk/src/main/java/org/apache/commons/net/pop3/POP3Client.java
Sun Apr 10 13:01:11 2016
@@ -214,7 +214,7 @@ public class POP3Client extends POP3
md5 = MessageDigest.getInstance("MD5");
timestamp += secret;
- digest = md5.digest(timestamp.getBytes(getCharsetName())); // Java 1.6
can use getCharset()
+ digest = md5.digest(timestamp.getBytes(getCharset()));
digestBuffer = new StringBuilder(128);
for (i = 0; i < digest.length; i++) {
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java?rev=1738430&r1=1738429&r2=1738430&view=diff
==============================================================================
---
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java
(original)
+++
commons/proper/net/trunk/src/main/java/org/apache/commons/net/smtp/AuthenticatingSMTPClient.java
Sun Apr 10 13:01:11 2016
@@ -224,8 +224,7 @@ public class AuthenticatingSMTPClient ex
{
// the server sends an empty response ("334 "), so we don't have
to read it.
return SMTPReply.isPositiveCompletion(sendCommand(
- // Java 1.6 can use getCharset()
- Base64.encodeBase64StringUnChunked(("\000" + username +
"\000" + password).getBytes(getCharsetName()))
+ Base64.encodeBase64StringUnChunked(("\000" + username +
"\000" + password).getBytes(getCharset()))
));
}
else if (method.equals(AUTH_METHOD.CRAM_MD5))
@@ -234,12 +233,11 @@ public class AuthenticatingSMTPClient ex
byte[] serverChallenge =
Base64.decodeBase64(getReplyString().substring(4).trim());
// get the Mac instance
Mac hmac_md5 = Mac.getInstance("HmacMD5");
- hmac_md5.init(new
SecretKeySpec(password.getBytes(getCharsetName()), "HmacMD5")); // Java 1.6 can
use getCharset()
+ hmac_md5.init(new SecretKeySpec(password.getBytes(getCharset()),
"HmacMD5"));
// compute the result:
- // Java 1.6 can use getCharset()
- byte[] hmacResult =
_convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharsetName());
+ byte[] hmacResult =
_convertToHexString(hmac_md5.doFinal(serverChallenge)).getBytes(getCharset());
// join the byte arrays to form the reply
- byte[] usernameBytes = username.getBytes(getCharsetName()); //
Java 1.6 can use getCharset()
+ byte[] usernameBytes = username.getBytes(getCharset());
byte[] toEncode = new byte[usernameBytes.length + 1 /* the space
*/ + hmacResult.length];
System.arraycopy(usernameBytes, 0, toEncode, 0,
usernameBytes.length);
toEncode[usernameBytes.length] = ' ';
@@ -253,16 +251,16 @@ public class AuthenticatingSMTPClient ex
// the server sends fixed responses (base64("Username") and
// base64("Password")), so we don't have to read them.
if (!SMTPReply.isPositiveIntermediate(sendCommand(
-
Base64.encodeBase64StringUnChunked(username.getBytes(getCharsetName()))))) { //
Java 1.6 can use getCharset()
+
Base64.encodeBase64StringUnChunked(username.getBytes(getCharset()))))) {
return false;
}
return SMTPReply.isPositiveCompletion(sendCommand(
-
Base64.encodeBase64StringUnChunked(password.getBytes(getCharsetName())))); //
Java 1.6 can use getCharset()
+
Base64.encodeBase64StringUnChunked(password.getBytes(getCharset()))));
}
else if (method.equals(AUTH_METHOD.XOAUTH))
{
return SMTPReply.isPositiveIntermediate(sendCommand(
-
Base64.encodeBase64StringUnChunked(username.getBytes(getCharsetName())) // Java
1.6 can use getCharset()
+
Base64.encodeBase64StringUnChunked(username.getBytes(getCharset()))
));
} else {
return false; // safety check
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/Telnet.java
URL:
http://svn.apache.org/viewvc/commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/Telnet.java?rev=1738430&r1=1738429&r2=1738430&view=diff
==============================================================================
---
commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/Telnet.java
(original)
+++
commons/proper/net/trunk/src/main/java/org/apache/commons/net/telnet/Telnet.java
Sun Apr 10 13:01:11 2016
@@ -741,7 +741,7 @@ class Telnet extends SocketClient
{
_output_.write(_COMMAND_SB);
_output_.write(_COMMAND_IS);
- _output_.write(terminalType.getBytes(getCharsetName())); // Java
1.6 can use getCharset()
+ _output_.write(terminalType.getBytes(getCharset()));
_output_.write(_COMMAND_SE);
_output_.flush();
}