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.
|
* @return The unescaped string.
|
||||||
*/
|
*/
|
||||||
public static String unescapeXml(final String str) {
|
public static String unescapeXml(final String str) {
|
||||||
return str.replaceAll("&", "&")
|
return str.replace("&", "&")
|
||||||
.replaceAll("<", "<")
|
.replace("<", "<")
|
||||||
.replaceAll(">", ">")
|
.replace(">", ">")
|
||||||
.replaceAll(""", "\"")
|
.replace(""", "\"")
|
||||||
.replaceAll("'", "'")
|
.replace("'", "'")
|
||||||
.replaceAll("'", "'");
|
.replace("'", "'");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -115,6 +115,6 @@ public final class EntriesUtils {
|
||||||
* @return The entry's tags.
|
* @return The entry's tags.
|
||||||
*/
|
*/
|
||||||
public static String buildTags(final int entryIndex, final EntryLink entry) {
|
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")
|
@SuppressWarnings("PMD.AvoidInstantiatingObjectsInLoops")
|
||||||
public final void setTags(final String tags) {
|
public final void setTags(final String tags) {
|
||||||
if (tags != null) {
|
if (tags != null) {
|
||||||
final String[] parts = tags.replaceAll(", ", " ").replaceAll(",", " ").split(" ");
|
final String[] parts = tags.replace(", ", " ").replace(",", " ").split(" ");
|
||||||
|
|
||||||
SyndCategoryImpl tag;
|
SyndCategoryImpl tag;
|
||||||
String part;
|
String part;
|
||||||
|
|
|
@ -71,7 +71,7 @@ public class Calc extends AbstractModule {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final Expression calc = new ExpressionBuilder(query).build();
|
final Expression calc = new ExpressionBuilder(query).build();
|
||||||
return query.replaceAll(" ", "") + " = " + decimalFormat.format(calc.evaluate());
|
return query.replace(" ", "") + " = " + decimalFormat.format(calc.evaluate());
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
return "No idea. This is the kind of math I don't get.";
|
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?");
|
return new ErrorMessage("You're kidding, right?");
|
||||||
} else {
|
} else {
|
||||||
try {
|
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]
|
final double from = Double.parseDouble(EXCHANGE_RATES.get(cmds[1]
|
||||||
.toUpperCase(Constants.LOCALE)));
|
.toUpperCase(Constants.LOCALE)));
|
||||||
final double to = Double.parseDouble(EXCHANGE_RATES.get(cmds[3].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
|
//noinspection RegExpRedundantEscape
|
||||||
return new PublicMessage(
|
return new PublicMessage(
|
||||||
json.getJSONObject("value").get("joke").toString().replaceAll("\\'", "'")
|
json.getJSONObject("value").get("joke").toString().replace("\\'", "'")
|
||||||
.replaceAll("\\\"", "\""));
|
.replace("\\\"", "\""));
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new ModuleException("randomJoke()", "An error has occurred retrieving a random joke.", 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) {
|
private static String keyToEnv(final String key) {
|
||||||
return key.replaceAll("-", "_").toUpperCase(Constants.LOCALE);
|
return key.replace("-", "_").toUpperCase(Constants.LOCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeSuite(alwaysRun = true)
|
@BeforeSuite(alwaysRun = true)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue