summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerge Beauchamp2013-09-23 14:14:29 (EDT)
committerSergey Prigogin2013-09-23 15:56:03 (EDT)
commitdc28d7f6f8877c179e5cbc80d696be6f71380ed7 (patch)
tree1b1af667b7bbcb3e88abf1326be3cbf2c6277612
parent7569b2522fa31f636714f4c49aff2e829bae2544 (diff)
downloadorg.eclipse.cdt-dc28d7f6f8877c179e5cbc80d696be6f71380ed7.zip
org.eclipse.cdt-dc28d7f6f8877c179e5cbc80d696be6f71380ed7.tar.gz
org.eclipse.cdt-dc28d7f6f8877c179e5cbc80d696be6f71380ed7.tar.bz2
Bug 417852 - java.utilConcurrentModificationException inrefs/changes/03/16703/3
LanguageVerifier Change-Id: I8c614c37ab1559069c0639e8c4247ec414e0f0fd Signed-off-by: Serge Beauchamp <sergebeauchamp@mac.com> Reviewed-on: https://git.eclipse.org/r/16703 Reviewed-by: Sergey Prigogin <eclipse.sprigogin@gmail.com> IP-Clean: Sergey Prigogin <eclipse.sprigogin@gmail.com> Tested-by: Sergey Prigogin <eclipse.sprigogin@gmail.com>
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/misc/LanguageVerifierTests.java47
-rw-r--r--core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/misc/MiscTestSuite.java1
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/LanguageVerifier.java10
3 files changed, 56 insertions, 2 deletions
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/misc/LanguageVerifierTests.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/misc/LanguageVerifierTests.java
new file mode 100644
index 0000000..c0a060d
--- /dev/null
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/misc/LanguageVerifierTests.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Serge Beauchamp and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Serge Beauchamp (Freescale Semiconductor.) - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.cdt.ui.tests.misc;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.eclipse.cdt.core.language.WorkspaceLanguageConfiguration;
+import org.eclipse.cdt.core.model.ILanguage;
+
+import org.eclipse.cdt.internal.ui.language.LanguageVerifier;
+
+/**
+ * Tests for CDT Language Verifier.
+ */
+public class LanguageVerifierTests extends TestCase {
+
+ /**
+ * This API call was throwing a java.utilConcurrentModificationException.
+ * see Bug 417852
+ */
+ public void testConcurrentExceptionInLanguageVerifier() throws Exception {
+
+ WorkspaceLanguageConfiguration config = new WorkspaceLanguageConfiguration();
+
+ config.addWorkspaceMapping("foo", "bar");
+ config.addWorkspaceMapping("foo2", "bar2");
+
+ Map<String, ILanguage> availableLanguages = new HashMap<String, ILanguage>();
+
+ availableLanguages.put("foo", null);
+ availableLanguages.put("foo3", null);
+
+ LanguageVerifier.removeMissingLanguages(config, availableLanguages);
+ }
+}
diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/misc/MiscTestSuite.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/misc/MiscTestSuite.java
index 95b6f02..6264079 100644
--- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/misc/MiscTestSuite.java
+++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/misc/MiscTestSuite.java
@@ -25,5 +25,6 @@ public class MiscTestSuite extends TestSuite {
public MiscTestSuite() {
super(MiscTestSuite.class.getName());
addTestSuite(CDTSharedImagesTests.class);
+ addTestSuite(LanguageVerifierTests.class);
}
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/LanguageVerifier.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/LanguageVerifier.java
index 59662f4..f2a4a9c 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/LanguageVerifier.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/language/LanguageVerifier.java
@@ -7,10 +7,13 @@
*
* Contributors:
* IBM Corporation - Initial API and implementation
+ * Freescale Semiconductor - Bug 417852
*******************************************************************************/
package org.eclipse.cdt.internal.ui.language;
+import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
@@ -97,16 +100,19 @@ public class LanguageVerifier {
// Check content type mappings
Iterator<Entry<String, String>> contentTypeMappings = config.getWorkspaceMappings().entrySet().iterator();
+ List<String> removals = new ArrayList<String>();
while (contentTypeMappings.hasNext()) {
Entry<String, String> entry = contentTypeMappings.next();
- String contentTypeId = entry.getKey();
String languageId = entry.getValue();
if (!availableLanguages.containsKey(languageId)) {
missingLanguages.add(languageId);
- config.removeWorkspaceMapping(contentTypeId);
+ removals.add(entry.getKey());
}
}
+ for (String removal : removals) {
+ config.removeWorkspaceMapping(removal);
+ }
return missingLanguages;
}
}