commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r1489604 - /commons/proper/net/trunk/src/main/java/org/apache/commons/net/finger/FingerClient.java
Date Tue, 04 Jun 2013 20:58:09 GMT
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);



Mime
View raw message