Resolve "Avoid bad performance pattern involving Interger.parseInt"

This commit is contained in:
Hans Mackowiak
2020-05-31 14:22:25 +00:00
committed by Michael Kamensky
parent 33e7cde2d6
commit 19c07f5bef
17 changed files with 171 additions and 329 deletions

View File

@@ -531,12 +531,10 @@ public final class CardRules implements ICardCharacteristics {
public final ManaCostShard next() {
final String unparsed = st.nextToken();
// System.out.println(unparsed);
try {
int iVal = Integer.parseInt(unparsed);
this.genericCost += iVal;
if (StringUtils.isNumeric(unparsed)) {
this.genericCost += Integer.parseInt(unparsed);
return null;
}
catch (NumberFormatException nex) { }
return ManaCostShard.parseNonGeneric(unparsed);
}