You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by se...@apache.org on 2013/06/04 22:58:09 UTC
svn commit: r1489604 -
/commons/proper/net/trunk/src/main/java/org/apache/commons/net/finger/FingerClient.java
Author: sebb
Date: Tue Jun 4 20:57:55 2013
New Revision: 1489604
URL: http://svn.apache.org/r1489604
Log:
FindBugs points out that getBytes(null) is not allowed ...
Modified:
commons/proper/net/trunk/src/main/java/org/apache/commons/net/finger/FingerClient.java
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=1489604&r1=1489603&r2=1489604&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 Tue Jun 4 20:57:55 2013
@@ -24,7 +24,7 @@ import java.io.BufferedOutputStream;
import java.io.DataOutputStream;
import org.apache.commons.net.SocketClient;
-//import org.apache.commons.net.util.Charsets;
+import org.apache.commons.net.util.Charsets;
/***
* The FingerClient class implements the client side of the Internet Finger
@@ -168,7 +168,8 @@ public class FingerClient extends Socket
buffer.append(username);
buffer.append(SocketClient.NETASCII_EOL);
- byte[] encodedQuery = buffer.toString().getBytes(/*Charsets.toCharset*/(encoding)); // Java 1.6 can use charset
+ // Note: Charsets.toCharset() returns the platform default for null input
+ byte[] encodedQuery = buffer.toString().getBytes(Charsets.toCharset(encoding).name()); // Java 1.6 can use charset directly
output = new DataOutputStream(new BufferedOutputStream(_output_, 1024));
output.write(encodedQuery, 0, encodedQuery.length);