diff options
author | rbuj <robert.buj@gmail.com> | 2014-07-30 14:13:01 +0200 |
---|---|---|
committer | Noel Grandin <noel@peralex.com> | 2014-07-31 11:44:01 +0200 |
commit | 56739cf7ae7d697aba4daad0b3eb66cbd6b35af2 (patch) | |
tree | cbb9aa7ea2f625c3b080947330e2627a99c56a13 /xmerge | |
parent | 7e0e581c162a8836034a47e84d28a638e9aa9744 (diff) |
xmerge: Avoid java.util.ConcurrentModificationException
Fix removeByName function, which deletes elements of the list without an iterator.
Move declarations inside the for loop in the removeByJar function, and delete the comment about removing list elements.
Change-Id: I6a9ba82af2999703d1447c5c0bc5800ec4367b65
Diffstat (limited to 'xmerge')
-rw-r--r-- | xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java index 76b0792d96e6..adf2be978633 100644 --- a/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java +++ b/xmerge/source/xmerge/java/org/openoffice/xmerge/util/registry/ConverterInfoMgr.java @@ -132,13 +132,11 @@ public final class ConverterInfoMgr { boolean rc = false; - Iterator<ConverterInfo> ciIter = converterInfoList.iterator(); - while (ciIter.hasNext()) - { - ConverterInfo converterInfo = ciIter.next(); + for (Iterator<ConverterInfo> it = converterInfoList.iterator(); it.hasNext();) { + ConverterInfo converterInfo = it.next(); if (jar.equals(converterInfo.getJarName())) { - ciIter.remove(); - rc = true; + it.remove(); + rc = true; } } return rc; @@ -157,9 +155,10 @@ public final class ConverterInfoMgr { boolean rc = false; - for (ConverterInfo converterInfo : converterInfoList) { + for (Iterator<ConverterInfo> it = converterInfoList.iterator(); it.hasNext();) { + ConverterInfo converterInfo = it.next(); if (name.equals(converterInfo.getDisplayName())) { - converterInfoList.remove(converterInfo); + it.remove(); rc = true; } } |