Closed VitalyEG closed 6 years ago
IssuerToCardScriptProcessing.extractScriptID TaskMAnager.execute XRequestWatchdog.checkRequests
I agree it would be cleaner, though it shouldn't do any harm (e.g. ConcurrentModificationException
). The remove in IssuerToCardScriptProcessing.extractScriptID
is valid, since it returns the removed object, the other two however may skip items since the index doesn't get decremented.
I channged code at XRequestWatchdog.checkRequests:
_private void checkRequests() {
final String method = "checkRequests()";
final long currentTime = System.currentTimeMillis();
Iterator
and TaskMAnager.execute at:
public void execute(final Task task) {
final String method = "execute(Task)";
if (LOG.isDebugEnabled()) {
LOG.debug(method, "task=" + task + ",taskPath=" + taskPath);
}
Iterator
Please consider submitting a pull request for feature improvements.
Everywhere where you used removing object from arraylist wrong: for (int i = 0; i < XXX.size(); i++) { Object XX = XXX.remove(i); ...
As Example (Wrong): List arrayList = new ArrayList<>();
arrayList.add("A");
arrayList.add("B");
arrayList.add("C");
arrayList.add("D");
arrayList.add("E");
for (int i = 0; i < arrayList.size(); i++) {
String str = arrayList.remove(i);
System.out.println("str="+ str);
}
RESULT:
str=A
str=C
str=E
Please use construnction:
Iterator iterator = arrayListX.iterator();
while (iterator.hasNext()) {
X xx = iterator.next();
iterator.remove();
}