StringUtil.replace is deprecated

git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6094 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Dave Hoover
2010-07-13 21:45:39 +00:00
parent 3340e270ae
commit cdebcfa71d
6 changed files with 27 additions and 33 deletions
@@ -26,8 +26,6 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import com.samskivert.util.RandomUtil;
import com.samskivert.util.StringUtil;
import com.threerings.util.Name;
import static com.threerings.crowd.Log.log;
@@ -97,7 +95,7 @@ public abstract class CurseFilter implements ChatFilter
case COMIC:
m.appendReplacement(outbuf,
StringUtil.replace(_replacements[ii], " ", comicChars(_comicLength[ii])));
_replacements[ii].replace(" ", comicChars(_comicLength[ii])));
break;
case VERNACULAR:
@@ -107,8 +105,7 @@ public abstract class CurseFilter implements ChatFilter
vernacular = vernacular.substring(0, firstCharLen).toUpperCase() +
vernacular.substring(firstCharLen);
}
m.appendReplacement(outbuf,
StringUtil.replace(_replacements[ii], " ", vernacular));
m.appendReplacement(outbuf, _replacements[ii].replace(" ", vernacular));
break;
case UNFILTERED:
@@ -177,7 +174,7 @@ public abstract class CurseFilter implements ChatFilter
s += "$3";
}
String pattern = "\\b" + StringUtil.replace(p, " ", "(" + curse + ")") + "\\b";
String pattern = "\\b" + p.replace(" ", "(" + curse + ")") + "\\b";
Pattern pat = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
_matchers[ii] = pat.matcher("");
_replacements[ii] = s;
@@ -220,7 +217,7 @@ public abstract class CurseFilter implements ChatFilter
*/
protected String getStopWordRegexp (String word)
{
return "\\b" + StringUtil.replace(word, "*", "[A-Za-z]*") + "\\b";
return "\\b" + word.replace("*", "[A-Za-z]*") + "\\b";
}
/**
@@ -98,15 +98,15 @@ public class GenReceiverTask extends InvocationTask
List<?> methods, Iterator<String> imports)
throws Exception
{
String name = StringUtil.replace(rname, "Receiver", "");
String spackage = StringUtil.replace(rpackage, ".client", ".server");
String name = rname.replace("Receiver", "");
String spackage = rpackage.replace(".client", ".server");
// construct our imports list
ComparableArrayList<String> implist = new ComparableArrayList<String>();
CollectionUtil.addAll(implist, imports);
checkedAdd(implist, ClientObject.class.getName());
checkedAdd(implist, InvocationSender.class.getName());
String dname = StringUtil.replace(rname, "Receiver", "Decoder");
String dname = rname.replace("Receiver", "Decoder");
checkedAdd(implist, rpackage + "." + dname);
checkedAdd(implist, rpackage + "." + rname);
implist.sort();
@@ -122,7 +122,7 @@ public class GenReceiverTask extends InvocationTask
// determine the path to our sender file
String mpath = source.getPath();
mpath = StringUtil.replace(mpath, "Receiver", "Sender");
mpath = mpath.replace("Receiver", "Sender");
mpath = replacePath(mpath, "/client/", "/server/");
writeFile(mpath, sw.toString());
}
@@ -131,7 +131,7 @@ public class GenReceiverTask extends InvocationTask
List<?> methods, Iterator<String> imports)
throws Exception
{
String name = StringUtil.replace(rname, "Receiver", "");
String name = rname.replace("Receiver", "");
// construct our imports list
ComparableArrayList<String> implist = new ComparableArrayList<String>();
@@ -151,7 +151,7 @@ public class GenReceiverTask extends InvocationTask
// determine the path to our sender file
String mpath = source.getPath();
mpath = StringUtil.replace(mpath, "Receiver", "Decoder");
mpath = mpath.replace("Receiver", "Decoder");
writeFile(mpath, sw.toString());
}
@@ -129,7 +129,7 @@ public class GenServiceTask extends InvocationTask
public String getName ()
{
String name = GenUtil.simpleName(listener);
name = StringUtil.replace(name, "Listener", "");
name = name.replace("Listener", "");
int didx = name.indexOf(".");
return name.substring(didx+1);
}
@@ -223,9 +223,9 @@ public class GenServiceTask extends InvocationTask
}
String sname = sdesc.sname;
String name = StringUtil.replace(sname, "Service", "");
String mname = StringUtil.replace(sname, "Service", "Marshaller");
String mpackage = StringUtil.replace(sdesc.spackage, ".client", ".data");
String name = sname.replace("Service", "");
String mname = sname.replace("Service", "Marshaller");
String mpackage = sdesc.spackage.replace(".client", ".data");
// ----------- Part I - java marshaller
@@ -273,7 +273,7 @@ public class GenServiceTask extends InvocationTask
// determine the path to our marshaller file
String mpath = source.getPath();
mpath = StringUtil.replace(mpath, "Service", "Marshaller");
mpath = mpath.replace("Service", "Marshaller");
mpath = replacePath(mpath, "/client/", "/data/");
StringWriter sw = new StringWriter();
@@ -498,9 +498,8 @@ public class GenServiceTask extends InvocationTask
System.out.println("Generating dispatcher");
}
String name = StringUtil.replace(sdesc.sname, "Service", "");
String dpackage = StringUtil.replace(
sdesc.spackage, ".client", ".server");
String name = sdesc.sname.replace("Service", "");
String dpackage = sdesc.spackage.replace(".client", ".server");
// start with the imports required by service methods
ImportSet imports = sdesc.imports.clone();
@@ -550,7 +549,7 @@ public class GenServiceTask extends InvocationTask
// determine the path to our marshaller file
String mpath = source.getPath();
mpath = StringUtil.replace(mpath, "Service", "Dispatcher");
mpath = mpath.replace("Service", "Dispatcher");
mpath = replacePath(mpath, "/client/", "/server/");
writeFile(mpath, sw.toString());
@@ -563,8 +562,8 @@ public class GenServiceTask extends InvocationTask
System.out.println("Generating provider");
}
String name = StringUtil.replace(sdesc.sname, "Service", "");
String mpackage = StringUtil.replace(sdesc.spackage, ".client", ".server");
String name = sdesc.sname.replace("Service", "");
String mpackage = sdesc.spackage.replace(".client", ".server");
// start with imports required by service methods
ImportSet imports = sdesc.imports.clone();
@@ -610,7 +609,7 @@ public class GenServiceTask extends InvocationTask
// determine the path to our provider file
String mpath = source.getPath();
mpath = StringUtil.replace(mpath, "Service", "Provider");
mpath = mpath.replace("Service", "Provider");
mpath = replacePath(mpath, "/client/", "/server/");
writeFile(mpath, sw.toString());
@@ -78,7 +78,7 @@ public class GenUtil extends com.samskivert.util.GenUtil
Package pkg = clazz.getPackage();
int offset = (pkg == null) ? 0 : pkg.getName().length()+1;
String name = cname.substring(offset);
return StringUtil.replace(name, "$", "_");
return name.replace('$', '_');
}
}
@@ -173,7 +173,7 @@ public class ImportSet
int dollar = name.indexOf('$');
if (dollar >= 0) {
i.remove();
inner.add(name.replace("$", "_"));
inner.add(name.replace('$', '_'));
}
}
@@ -94,7 +94,7 @@ public abstract class InvocationTask extends Task
if (name.endsWith("InvocationService$InvocationListener")) {
return "InvocationMarshaller_ListenerMarshaller";
} else {
return getMarshaller().replace(".", "_");
return getMarshaller().replace('.', '_');
}
}
}
@@ -468,12 +468,10 @@ public abstract class InvocationTask extends Task
}
}
protected static String replacePath (
String source, String oldstr, String newstr)
protected static String replacePath (String source, String oldstr, String newstr)
{
return StringUtil.replace(source,
oldstr.replace('/', File.separatorChar),
newstr.replace('/', File.separatorChar));
return source.replace(oldstr.replace('/', File.separatorChar),
newstr.replace('/', File.separatorChar));
}
/** A list of filesets that contain tile images. */