From 8f8ad163a513003b56697585f2af1ddf53c8ecb4 Mon Sep 17 00:00:00 2001 From: Andrew Gvozdev Date: Sun, 17 Feb 2013 14:25:37 -0500 Subject: [PATCH] Fix testRepeatedlyChangeConfig_bug375226 so its failure won't break all subsequent indexer tests --- .../pdom/tests/ChangeConfigurationTests.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/ChangeConfigurationTests.java b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/ChangeConfigurationTests.java index d0b3a4375a8..c9fd02d96f5 100644 --- a/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/ChangeConfigurationTests.java +++ b/core/org.eclipse.cdt.core.tests/parser/org/eclipse/cdt/internal/pdom/tests/ChangeConfigurationTests.java @@ -104,14 +104,17 @@ public class ChangeConfigurationTests extends PDOMTestBase { Pattern testFunc2 = Pattern.compile("testFunc2"); int i = 0, noTrials = 50; do { + boolean isFirstConfig = i % 2 == 0; IIndex index = CCorePlugin.getIndexManager().getIndex(cProject); index.acquireReadLock(); - boolean isFirstConfig = i % 2 == 0; - IBinding[] bindings = index.findBindings(isFirstConfig ? testFunc1 : testFunc2, true, IndexFilter.ALL, new NullProgressMonitor()); - IBinding[] noBindings = index.findBindings(isFirstConfig ? testFunc2 : testFunc1, true, IndexFilter.ALL, new NullProgressMonitor()); - assertEquals(1, bindings.length); - assertEquals(0, noBindings.length); - index.releaseReadLock(); + try { + IBinding[] bindings = index.findBindings(isFirstConfig ? testFunc1 : testFunc2, true, IndexFilter.ALL, new NullProgressMonitor()); + IBinding[] noBindings = index.findBindings(isFirstConfig ? testFunc2 : testFunc1, true, IndexFilter.ALL, new NullProgressMonitor()); + assertEquals(1, bindings.length); + assertEquals(0, noBindings.length); + } finally { + index.releaseReadLock(); + } String nextConfig = isFirstConfig ? secondConfigName : firstConfigName; changeProjectConfiguration(project, nextConfig);