Bug: Concurrent Mod Bug on Act of Treason
Description: AI Draw Phase after Act of Treason on Buffed (5/5) Zulaport Enforcer
On opponent's upkeep and return of Treasonous Buffed Zulaport Enforcer bad things happened
public final ArrayList<String> getHiddenExtrinsicKeyword() {
while (true) {
try {
final ArrayList<String> keywords = new ArrayList<String>();
for (String keyword : this.hiddenExtrinsicKeyword) {
if (keyword == null) {
continue;
}
if (keyword.startsWith("HIDDEN")) {
keyword = keyword.substring(7);
}
keywords.add(keyword);
}
return keywords;
} catch (IndexOutOfBoundsException ex) {
// Do nothing and let the while loop retry
}
}
}
----> Substring makes a new string, but we are assigning it back to to the iterator holder (keyword) effectively modifying the list while iterating (which is a NONO!)
Correct code:
public final ArrayList<String> getHiddenExtrinsicKeyword() {
while (true) {
try {
final ArrayList<String> keywords = new ArrayList<String>();
for (String keyword : this.hiddenExtrinsicKeyword) {
if (keyword == null) {
continue;
}
if (keyword.startsWith("HIDDEN")) {
keywords.add(keyword.substring(7));
} else {
keywords.add(keyword);
}
}
return keywords;
} catch (IndexOutOfBoundsException ex) {
// Do nothing and let the while loop retry
}
}
}
---> If I get a chance, I will add a test and the fix, but y'all should really think about moving from SVN to Git to make a casual pull like this a piece o'cake.
On opponent's upkeep and return of Treasonous Buffed Zulaport Enforcer bad things happened
- ConcurrentModificationException | Open
public final ArrayList<String> getHiddenExtrinsicKeyword() {
while (true) {
try {
final ArrayList<String> keywords = new ArrayList<String>();
for (String keyword : this.hiddenExtrinsicKeyword) {
if (keyword == null) {
continue;
}
if (keyword.startsWith("HIDDEN")) {
keyword = keyword.substring(7);
}
keywords.add(keyword);
}
return keywords;
} catch (IndexOutOfBoundsException ex) {
// Do nothing and let the while loop retry
}
}
}
----> Substring makes a new string, but we are assigning it back to to the iterator holder (keyword) effectively modifying the list while iterating (which is a NONO!)
Correct code:
public final ArrayList<String> getHiddenExtrinsicKeyword() {
while (true) {
try {
final ArrayList<String> keywords = new ArrayList<String>();
for (String keyword : this.hiddenExtrinsicKeyword) {
if (keyword == null) {
continue;
}
if (keyword.startsWith("HIDDEN")) {
keywords.add(keyword.substring(7));
} else {
keywords.add(keyword);
}
}
return keywords;
} catch (IndexOutOfBoundsException ex) {
// Do nothing and let the while loop retry
}
}
}
---> If I get a chance, I will add a test and the fix, but y'all should really think about moving from SVN to Git to make a casual pull like this a piece o'cake.