Use new split()

This commit is contained in:
zzz
2015-11-07 17:45:48 +00:00
parent 83b923151c
commit 1e5a35c7f8
31 changed files with 64 additions and 47 deletions

View File

@ -414,7 +414,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
_log.debug(getPrefix(requestId) + "First line [" + line + "]");
}
String[] params = line.split(" ", 3);
String[] params = DataHelper.split(line, " ", 3);
if(params.length != 3) {
break;
}
@ -1252,7 +1252,7 @@ public class I2PTunnelHTTPClient extends I2PTunnelHTTPClientBase implements Runn
String s = getTunnel().getClientOptions().getProperty(PROP_SSL_OUTPROXIES);
if (s == null)
return null;
String[] p = s.split("[,; \r\n\t]");
String[] p = DataHelper.split(s, "[,; \r\n\t]");
if (p.length == 0)
return null;
// todo doesn't check for ""

View File

@ -285,7 +285,7 @@ public abstract class I2PTunnelHTTPClientBase extends I2PTunnelClientBase implem
// We send Accept-Charset: UTF-8 in the 407 so hopefully it comes back that way inside the B64 ?
try {
String dec = new String(decoded, "UTF-8");
String[] parts = dec.split(":");
String[] parts = DataHelper.split(dec, ":");
String user = parts[0];
String pw = parts[1];
// first try pw for that user

View File

@ -664,7 +664,7 @@ public class I2PTunnelHTTPServer extends I2PTunnelServer {
*/
@Override
protected String filterResponseLine(String line) {
String[] s = line.split(" ", 3);
String[] s = DataHelper.split(line, " ", 3);
if (s.length > 1 &&
(s[1].startsWith("3") || s[1].startsWith("5")))
_dataExpected = 0;

View File

@ -13,6 +13,7 @@ import java.util.Properties;
import net.i2p.client.streaming.I2PSocket;
import net.i2p.crypto.SHA256Generator;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination;
import net.i2p.data.Hash;
import net.i2p.data.Base32;
@ -277,7 +278,7 @@ public class I2PTunnelIRCServer extends I2PTunnelServer implements Runnable {
//if (_log.shouldLog(Log.DEBUG))
// _log.debug("Got line: " + s);
String field[]=s.split(" ",5);
String field[] = DataHelper.split(s, " ", 5);
String command;
int idx=0;

View File

@ -19,6 +19,7 @@ import net.i2p.I2PException;
import net.i2p.client.I2PSession;
import net.i2p.client.I2PSessionException;
import net.i2p.client.streaming.I2PSocketManager;
import net.i2p.data.DataHelper;
import net.i2p.data.Destination;
import net.i2p.util.EventDispatcher;
import net.i2p.util.I2PAppThread;
@ -93,7 +94,7 @@ public class I2Ping extends I2PTunnelClientBase {
int localPort = 0;
int remotePort = 0;
boolean error = false;
String[] argv = cmd.split(" ");
String[] argv = DataHelper.split(cmd, " ");
Getopt g = new Getopt("ping", argv, "t:m:n:chl:f:p:");
int c;
while ((c = g.getopt()) != -1) {

View File

@ -33,7 +33,7 @@ abstract class IRCFilter {
*/
public static String inboundFilter(String s, StringBuffer expectedPong, DCCHelper helper) {
String field[]=s.split(" ",4);
String field[] = DataHelper.split(s, " ", 4);
String command;
int idx=0;
final String[] allowedCommands =
@ -274,7 +274,7 @@ abstract class IRCFilter {
*/
public static String outboundFilter(String s, StringBuffer expectedPong, DCCHelper helper) {
String field[]=s.split(" ",3);
String field[] = DataHelper.split(s, " ",3);
if(field[0].length()==0)
return null; // W T F?
@ -420,7 +420,7 @@ abstract class IRCFilter {
int ctcp = msg.indexOf(0x01);
if (ctcp > 0)
msg = msg.substring(0, ctcp);
String[] args = msg.split(" ", 5);
String[] args = DataHelper.split(msg, " ", 5);
if (args.length <= 0)
return null;
String type = args[0];
@ -512,7 +512,7 @@ abstract class IRCFilter {
int ctcp = msg.indexOf(0x01);
if (ctcp > 0)
msg = msg.substring(0, ctcp);
String[] args = msg.split(" ", 5);
String[] args = DataHelper.split(msg, " ", 5);
if (args.length <= 0)
return null;
String type = args[0];