Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSzymon Brandys2012-03-07 10:48:23 +0000
committerGerrit Code Review @ Eclipse.org2012-03-07 10:48:23 +0000
commite6361f702db7d28c75e74fc58d8aba73720affc5 (patch)
tree807ea4fd3571c68f39f46bf7f523b2ae4f1be975
parent7def0e8c4d483c69759cf0434685f8be344dbb5b (diff)
parent3e5707eaf8edead76e9345b1cf92313789bc8b45 (diff)
downloadeclipse.platform.resources-e6361f702db7d28c75e74fc58d8aba73720affc5.tar.gz
eclipse.platform.resources-e6361f702db7d28c75e74fc58d8aba73720affc5.tar.xz
eclipse.platform.resources-e6361f702db7d28c75e74fc58d8aba73720affc5.zip
Merge "Bug 316182 - Calling RepositoryProvider.getProvider(IProject pjct) throws null pointer exception"
-rw-r--r--bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java8
-rw-r--r--tests/org.eclipse.core.tests.resources/plugin.xml6
-rw-r--r--tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/refresh/Bug316182RefreshProvider.java34
-rw-r--r--tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/AllTests.java1
-rw-r--r--tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestBug316182.java55
5 files changed, 101 insertions, 3 deletions
diff --git a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java
index 632b04069..4df06c6d8 100644
--- a/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java
+++ b/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/resources/Workspace.java
@@ -2498,17 +2498,19 @@ public class Workspace extends PlatformObject implements IWorkspace, ICoreConsta
markerManager = new MarkerManager(this);
markerManager.startup(null);
synchronizer = new Synchronizer(this);
- refreshManager = new RefreshManager(this);
saveManager = new SaveManager(this);
saveManager.startup(null);
- //must start after save manager, because (read) access to tree is needed
- refreshManager.startup(null);
propertyManager = ResourcesCompatibilityHelper.createPropertyManager();
propertyManager.startup(monitor);
charsetManager = new CharsetManager(this);
charsetManager.startup(null);
contentDescriptionManager = new ContentDescriptionManager();
contentDescriptionManager.startup(null);
+ //must start after save manager, because (read) access to tree is needed
+ //must start after other managers to avoid potential cyclic dependency on uninitialized managers (see bug 316182)
+ //must start before alias manager (see bug 94829)
+ refreshManager = new RefreshManager(this);
+ refreshManager.startup(null);
//must start at the end to avoid potential cyclic dependency on other uninitialized managers (see bug 369177)
aliasManager = new AliasManager(this);
aliasManager.startup(null);
diff --git a/tests/org.eclipse.core.tests.resources/plugin.xml b/tests/org.eclipse.core.tests.resources/plugin.xml
index a71e4c6d8..187921245 100644
--- a/tests/org.eclipse.core.tests.resources/plugin.xml
+++ b/tests/org.eclipse.core.tests.resources/plugin.xml
@@ -522,6 +522,12 @@
class="org.eclipse.core.tests.resources.refresh.TestRefreshProvider"
name="org.eclipse.core.tests.resources.testRefreshProvider"/>
</extension>
+<extension
+ point="org.eclipse.core.resources.refreshProviders">
+ <refreshProvider
+ class="org.eclipse.core.tests.resources.refresh.Bug316182RefreshProvider"
+ name="org.eclipse.core.tests.resources.bug316182RefreshProvider"/>
+</extension>
<extension point="org.eclipse.core.runtime.preferences">
<modifier class="org.eclipse.core.tests.internal.resources.ProjectPreferenceModifyListener"/>
diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/refresh/Bug316182RefreshProvider.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/refresh/Bug316182RefreshProvider.java
new file mode 100644
index 000000000..c8ca3b569
--- /dev/null
+++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/refresh/Bug316182RefreshProvider.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.core.tests.resources.refresh;
+
+import org.eclipse.core.resources.*;
+import org.eclipse.core.resources.refresh.*;
+import org.eclipse.core.tests.resources.session.TestBug316182;
+
+/**
+ * Refresh provider depicting bug 316182.
+ */
+public class Bug316182RefreshProvider extends RefreshProvider {
+ @Override
+ public IRefreshMonitor installMonitor(IResource resource, IRefreshResult result) {
+ try {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject("project_TestBug316182");
+ project.getPersistentProperties();
+ project.getDefaultCharset();
+ project.getContentTypeMatcher();
+ } catch (Exception e) {
+ // remember the exception
+ TestBug316182.CAUGHT_EXCEPTION = e;
+ }
+ return null;
+ }
+}
diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/AllTests.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/AllTests.java
index 371c2f7cf..3b6faf350 100644
--- a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/AllTests.java
+++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/AllTests.java
@@ -54,6 +54,7 @@ public class AllTests extends TestCase {
suite.addTest(ProjectDescriptionDynamicTest.suite());
suite.addTest(TestBug202384.suite());
suite.addTest(TestBug369177.suite());
+ suite.addTest(TestBug316182.suite());
return suite;
}
}
diff --git a/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestBug316182.java b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestBug316182.java
new file mode 100644
index 000000000..723df057b
--- /dev/null
+++ b/tests/org.eclipse.core.tests.resources/src/org/eclipse/core/tests/resources/session/TestBug316182.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2012 IBM Corporation 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.core.tests.resources.session;
+
+import junit.framework.Test;
+import org.eclipse.core.resources.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.core.tests.resources.AutomatedTests;
+import org.eclipse.core.tests.resources.WorkspaceSessionTest;
+import org.eclipse.core.tests.session.WorkspaceSessionTestSuite;
+
+/**
+ * Test for bug 316182
+ */
+public class TestBug316182 extends WorkspaceSessionTest {
+ public static Exception CAUGHT_EXCEPTION = null;
+
+ public TestBug316182() {
+ super();
+ }
+
+ public TestBug316182(String name) {
+ super(name);
+ }
+
+ public void test01_prepareWorkspace() throws CoreException {
+ InstanceScope.INSTANCE.getNode(ResourcesPlugin.PI_RESOURCES).putBoolean(ResourcesPlugin.PREF_AUTO_REFRESH, true);
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ IProject project = workspace.getRoot().getProject("project_TestBug316182");
+ ensureExistsInWorkspace(project, true);
+ workspace.save(true, getMonitor());
+ // reset last caught exception
+ CAUGHT_EXCEPTION = null;
+ }
+
+ public void test02_startWorkspace() {
+ InstanceScope.INSTANCE.getNode(ResourcesPlugin.PI_RESOURCES).putBoolean(ResourcesPlugin.PREF_AUTO_REFRESH, false);
+ if (CAUGHT_EXCEPTION != null) {
+ fail("Test failed", CAUGHT_EXCEPTION);
+ }
+ }
+
+ public static Test suite() {
+ return new WorkspaceSessionTestSuite(AutomatedTests.PI_RESOURCES_TESTS, TestBug316182.class);
+ }
+}

Back to the top