Changed replaceAll() to replace() (sonarqube)
This commit is contained in:
parent
f161ac2e79
commit
2166e166e8
7 changed files with 13 additions and 13 deletions
|
@ -247,12 +247,12 @@ public final class Utils {
|
|||
* @return The unescaped string.
|
||||
*/
|
||||
public static String unescapeXml(final String str) {
|
||||
return str.replaceAll("&", "&")
|
||||
.replaceAll("<", "<")
|
||||
.replaceAll(">", ">")
|
||||
.replaceAll(""", "\"")
|
||||
.replaceAll("'", "'")
|
||||
.replaceAll("'", "'");
|
||||
return str.replace("&", "&")
|
||||
.replace("<", "<")
|
||||
.replace(">", ">")
|
||||
.replace(""", "\"")
|
||||
.replace("'", "'")
|
||||
.replace("'", "'");
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -115,6 +115,6 @@ public final class EntriesUtils {
|
|||
* @return The entry's tags.
|
||||
*/
|
||||
public static String buildTags(final int entryIndex, final EntryLink entry) {
|
||||
return (Commands.LINK_CMD + (entryIndex + 1) + "T: " + entry.getPinboardTags().replaceAll(",", ", "));
|
||||
return (Commands.LINK_CMD + (entryIndex + 1) + "T: " + entry.getPinboardTags().replace(",", ", "));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -297,7 +297,7 @@ public class EntryLink implements Serializable {
|
|||
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
|
||||
public final void setTags(final String tags) {
|
||||
if (tags != null) {
|
||||
final String[] parts = tags.replaceAll(", ", " ").replaceAll(",", " ").split(" ");
|
||||
final String[] parts = tags.replace(", ", " ").replace(",", " ").split(" ");
|
||||
|
||||
SyndCategoryImpl tag;
|
||||
String part;
|
||||
|
|
|
@ -71,7 +71,7 @@ public class Calc extends AbstractModule {
|
|||
|
||||
try {
|
||||
final Expression calc = new ExpressionBuilder(query).build();
|
||||
return query.replaceAll(" ", "") + " = " + decimalFormat.format(calc.evaluate());
|
||||
return query.replace(" ", "") + " = " + decimalFormat.format(calc.evaluate());
|
||||
} catch (Exception e) {
|
||||
return "No idea. This is the kind of math I don't get.";
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ public final class CurrencyConverter extends ThreadedModule {
|
|||
return new ErrorMessage("You're kidding, right?");
|
||||
} else {
|
||||
try {
|
||||
final double amt = Double.parseDouble(cmds[0].replaceAll(",", ""));
|
||||
final double amt = Double.parseDouble(cmds[0].replace(",", ""));
|
||||
final double from = Double.parseDouble(EXCHANGE_RATES.get(cmds[1]
|
||||
.toUpperCase(Constants.LOCALE)));
|
||||
final double to = Double.parseDouble(EXCHANGE_RATES.get(cmds[3].toUpperCase(Constants.LOCALE)));
|
||||
|
|
|
@ -89,8 +89,8 @@ public final class Joke extends ThreadedModule {
|
|||
|
||||
//noinspection RegExpRedundantEscape
|
||||
return new PublicMessage(
|
||||
json.getJSONObject("value").get("joke").toString().replaceAll("\\'", "'")
|
||||
.replaceAll("\\\"", "\""));
|
||||
json.getJSONObject("value").get("joke").toString().replace("\\'", "'")
|
||||
.replace("\\\"", "\""));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new ModuleException("randomJoke()", "An error has occurred retrieving a random joke.", e);
|
||||
|
|
|
@ -65,7 +65,7 @@ class LocalProperties {
|
|||
}
|
||||
|
||||
private static String keyToEnv(final String key) {
|
||||
return key.replaceAll("-", "_").toUpperCase(Constants.LOCALE);
|
||||
return key.replace("-", "_").toUpperCase(Constants.LOCALE);
|
||||
}
|
||||
|
||||
@BeforeSuite(alwaysRun = true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue