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:
@@ -26,8 +26,6 @@ import java.util.regex.Matcher;
|
|||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
import com.samskivert.util.RandomUtil;
|
import com.samskivert.util.RandomUtil;
|
||||||
import com.samskivert.util.StringUtil;
|
|
||||||
|
|
||||||
import com.threerings.util.Name;
|
import com.threerings.util.Name;
|
||||||
|
|
||||||
import static com.threerings.crowd.Log.log;
|
import static com.threerings.crowd.Log.log;
|
||||||
@@ -97,7 +95,7 @@ public abstract class CurseFilter implements ChatFilter
|
|||||||
|
|
||||||
case COMIC:
|
case COMIC:
|
||||||
m.appendReplacement(outbuf,
|
m.appendReplacement(outbuf,
|
||||||
StringUtil.replace(_replacements[ii], " ", comicChars(_comicLength[ii])));
|
_replacements[ii].replace(" ", comicChars(_comicLength[ii])));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case VERNACULAR:
|
case VERNACULAR:
|
||||||
@@ -107,8 +105,7 @@ public abstract class CurseFilter implements ChatFilter
|
|||||||
vernacular = vernacular.substring(0, firstCharLen).toUpperCase() +
|
vernacular = vernacular.substring(0, firstCharLen).toUpperCase() +
|
||||||
vernacular.substring(firstCharLen);
|
vernacular.substring(firstCharLen);
|
||||||
}
|
}
|
||||||
m.appendReplacement(outbuf,
|
m.appendReplacement(outbuf, _replacements[ii].replace(" ", vernacular));
|
||||||
StringUtil.replace(_replacements[ii], " ", vernacular));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case UNFILTERED:
|
case UNFILTERED:
|
||||||
@@ -177,7 +174,7 @@ public abstract class CurseFilter implements ChatFilter
|
|||||||
s += "$3";
|
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);
|
Pattern pat = Pattern.compile(pattern, Pattern.CASE_INSENSITIVE | Pattern.UNICODE_CASE);
|
||||||
_matchers[ii] = pat.matcher("");
|
_matchers[ii] = pat.matcher("");
|
||||||
_replacements[ii] = s;
|
_replacements[ii] = s;
|
||||||
@@ -220,7 +217,7 @@ public abstract class CurseFilter implements ChatFilter
|
|||||||
*/
|
*/
|
||||||
protected String getStopWordRegexp (String word)
|
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)
|
List<?> methods, Iterator<String> imports)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
String name = StringUtil.replace(rname, "Receiver", "");
|
String name = rname.replace("Receiver", "");
|
||||||
String spackage = StringUtil.replace(rpackage, ".client", ".server");
|
String spackage = rpackage.replace(".client", ".server");
|
||||||
|
|
||||||
// construct our imports list
|
// construct our imports list
|
||||||
ComparableArrayList<String> implist = new ComparableArrayList<String>();
|
ComparableArrayList<String> implist = new ComparableArrayList<String>();
|
||||||
CollectionUtil.addAll(implist, imports);
|
CollectionUtil.addAll(implist, imports);
|
||||||
checkedAdd(implist, ClientObject.class.getName());
|
checkedAdd(implist, ClientObject.class.getName());
|
||||||
checkedAdd(implist, InvocationSender.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 + "." + dname);
|
||||||
checkedAdd(implist, rpackage + "." + rname);
|
checkedAdd(implist, rpackage + "." + rname);
|
||||||
implist.sort();
|
implist.sort();
|
||||||
@@ -122,7 +122,7 @@ public class GenReceiverTask extends InvocationTask
|
|||||||
|
|
||||||
// determine the path to our sender file
|
// determine the path to our sender file
|
||||||
String mpath = source.getPath();
|
String mpath = source.getPath();
|
||||||
mpath = StringUtil.replace(mpath, "Receiver", "Sender");
|
mpath = mpath.replace("Receiver", "Sender");
|
||||||
mpath = replacePath(mpath, "/client/", "/server/");
|
mpath = replacePath(mpath, "/client/", "/server/");
|
||||||
writeFile(mpath, sw.toString());
|
writeFile(mpath, sw.toString());
|
||||||
}
|
}
|
||||||
@@ -131,7 +131,7 @@ public class GenReceiverTask extends InvocationTask
|
|||||||
List<?> methods, Iterator<String> imports)
|
List<?> methods, Iterator<String> imports)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
String name = StringUtil.replace(rname, "Receiver", "");
|
String name = rname.replace("Receiver", "");
|
||||||
|
|
||||||
// construct our imports list
|
// construct our imports list
|
||||||
ComparableArrayList<String> implist = new ComparableArrayList<String>();
|
ComparableArrayList<String> implist = new ComparableArrayList<String>();
|
||||||
@@ -151,7 +151,7 @@ public class GenReceiverTask extends InvocationTask
|
|||||||
|
|
||||||
// determine the path to our sender file
|
// determine the path to our sender file
|
||||||
String mpath = source.getPath();
|
String mpath = source.getPath();
|
||||||
mpath = StringUtil.replace(mpath, "Receiver", "Decoder");
|
mpath = mpath.replace("Receiver", "Decoder");
|
||||||
writeFile(mpath, sw.toString());
|
writeFile(mpath, sw.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ public class GenServiceTask extends InvocationTask
|
|||||||
public String getName ()
|
public String getName ()
|
||||||
{
|
{
|
||||||
String name = GenUtil.simpleName(listener);
|
String name = GenUtil.simpleName(listener);
|
||||||
name = StringUtil.replace(name, "Listener", "");
|
name = name.replace("Listener", "");
|
||||||
int didx = name.indexOf(".");
|
int didx = name.indexOf(".");
|
||||||
return name.substring(didx+1);
|
return name.substring(didx+1);
|
||||||
}
|
}
|
||||||
@@ -223,9 +223,9 @@ public class GenServiceTask extends InvocationTask
|
|||||||
}
|
}
|
||||||
|
|
||||||
String sname = sdesc.sname;
|
String sname = sdesc.sname;
|
||||||
String name = StringUtil.replace(sname, "Service", "");
|
String name = sname.replace("Service", "");
|
||||||
String mname = StringUtil.replace(sname, "Service", "Marshaller");
|
String mname = sname.replace("Service", "Marshaller");
|
||||||
String mpackage = StringUtil.replace(sdesc.spackage, ".client", ".data");
|
String mpackage = sdesc.spackage.replace(".client", ".data");
|
||||||
|
|
||||||
// ----------- Part I - java marshaller
|
// ----------- Part I - java marshaller
|
||||||
|
|
||||||
@@ -273,7 +273,7 @@ public class GenServiceTask extends InvocationTask
|
|||||||
|
|
||||||
// determine the path to our marshaller file
|
// determine the path to our marshaller file
|
||||||
String mpath = source.getPath();
|
String mpath = source.getPath();
|
||||||
mpath = StringUtil.replace(mpath, "Service", "Marshaller");
|
mpath = mpath.replace("Service", "Marshaller");
|
||||||
mpath = replacePath(mpath, "/client/", "/data/");
|
mpath = replacePath(mpath, "/client/", "/data/");
|
||||||
|
|
||||||
StringWriter sw = new StringWriter();
|
StringWriter sw = new StringWriter();
|
||||||
@@ -498,9 +498,8 @@ public class GenServiceTask extends InvocationTask
|
|||||||
System.out.println("Generating dispatcher");
|
System.out.println("Generating dispatcher");
|
||||||
}
|
}
|
||||||
|
|
||||||
String name = StringUtil.replace(sdesc.sname, "Service", "");
|
String name = sdesc.sname.replace("Service", "");
|
||||||
String dpackage = StringUtil.replace(
|
String dpackage = sdesc.spackage.replace(".client", ".server");
|
||||||
sdesc.spackage, ".client", ".server");
|
|
||||||
|
|
||||||
// start with the imports required by service methods
|
// start with the imports required by service methods
|
||||||
ImportSet imports = sdesc.imports.clone();
|
ImportSet imports = sdesc.imports.clone();
|
||||||
@@ -550,7 +549,7 @@ public class GenServiceTask extends InvocationTask
|
|||||||
|
|
||||||
// determine the path to our marshaller file
|
// determine the path to our marshaller file
|
||||||
String mpath = source.getPath();
|
String mpath = source.getPath();
|
||||||
mpath = StringUtil.replace(mpath, "Service", "Dispatcher");
|
mpath = mpath.replace("Service", "Dispatcher");
|
||||||
mpath = replacePath(mpath, "/client/", "/server/");
|
mpath = replacePath(mpath, "/client/", "/server/");
|
||||||
|
|
||||||
writeFile(mpath, sw.toString());
|
writeFile(mpath, sw.toString());
|
||||||
@@ -563,8 +562,8 @@ public class GenServiceTask extends InvocationTask
|
|||||||
System.out.println("Generating provider");
|
System.out.println("Generating provider");
|
||||||
}
|
}
|
||||||
|
|
||||||
String name = StringUtil.replace(sdesc.sname, "Service", "");
|
String name = sdesc.sname.replace("Service", "");
|
||||||
String mpackage = StringUtil.replace(sdesc.spackage, ".client", ".server");
|
String mpackage = sdesc.spackage.replace(".client", ".server");
|
||||||
|
|
||||||
// start with imports required by service methods
|
// start with imports required by service methods
|
||||||
ImportSet imports = sdesc.imports.clone();
|
ImportSet imports = sdesc.imports.clone();
|
||||||
@@ -610,7 +609,7 @@ public class GenServiceTask extends InvocationTask
|
|||||||
|
|
||||||
// determine the path to our provider file
|
// determine the path to our provider file
|
||||||
String mpath = source.getPath();
|
String mpath = source.getPath();
|
||||||
mpath = StringUtil.replace(mpath, "Service", "Provider");
|
mpath = mpath.replace("Service", "Provider");
|
||||||
mpath = replacePath(mpath, "/client/", "/server/");
|
mpath = replacePath(mpath, "/client/", "/server/");
|
||||||
|
|
||||||
writeFile(mpath, sw.toString());
|
writeFile(mpath, sw.toString());
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class GenUtil extends com.samskivert.util.GenUtil
|
|||||||
Package pkg = clazz.getPackage();
|
Package pkg = clazz.getPackage();
|
||||||
int offset = (pkg == null) ? 0 : pkg.getName().length()+1;
|
int offset = (pkg == null) ? 0 : pkg.getName().length()+1;
|
||||||
String name = cname.substring(offset);
|
String name = cname.substring(offset);
|
||||||
return StringUtil.replace(name, "$", "_");
|
return name.replace('$', '_');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -173,7 +173,7 @@ public class ImportSet
|
|||||||
int dollar = name.indexOf('$');
|
int dollar = name.indexOf('$');
|
||||||
if (dollar >= 0) {
|
if (dollar >= 0) {
|
||||||
i.remove();
|
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")) {
|
if (name.endsWith("InvocationService$InvocationListener")) {
|
||||||
return "InvocationMarshaller_ListenerMarshaller";
|
return "InvocationMarshaller_ListenerMarshaller";
|
||||||
} else {
|
} else {
|
||||||
return getMarshaller().replace(".", "_");
|
return getMarshaller().replace('.', '_');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -468,12 +468,10 @@ public abstract class InvocationTask extends Task
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static String replacePath (
|
protected static String replacePath (String source, String oldstr, String newstr)
|
||||||
String source, String oldstr, String newstr)
|
|
||||||
{
|
{
|
||||||
return StringUtil.replace(source,
|
return source.replace(oldstr.replace('/', File.separatorChar),
|
||||||
oldstr.replace('/', File.separatorChar),
|
newstr.replace('/', File.separatorChar));
|
||||||
newstr.replace('/', File.separatorChar));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** A list of filesets that contain tile images. */
|
/** A list of filesets that contain tile images. */
|
||||||
|
|||||||
Reference in New Issue
Block a user