### Eclipse Workspace Patch 1.0
#P org.eclipse.jdt.core
Index: buildnotes_jdt-core.html
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/buildnotes_jdt-core.html,v
retrieving revision 1.7707
diff -u -r1.7707 buildnotes_jdt-core.html
--- buildnotes_jdt-core.html 20 Dec 2010 10:21:13 -0000 1.7707
+++ buildnotes_jdt-core.html 20 Dec 2010 10:32:50 -0000
@@ -110,7 +110,9 @@
Problem Reports Fixed
-327143
+327471
+java.io.EOFException at java.io.DataInputStream.readInt(Unknown Source)
+
327143
IndexManager should not accept new jobs if the processing thread is null
332619
Small error in IType#codeComplete Javadoc example
Index: model/org/eclipse/jdt/internal/core/JavaModelManager.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/JavaModelManager.java,v
retrieving revision 1.462
diff -u -r1.462 JavaModelManager.java
--- model/org/eclipse/jdt/internal/core/JavaModelManager.java 2 Dec 2010 07:51:52 -0000 1.462
+++ model/org/eclipse/jdt/internal/core/JavaModelManager.java 20 Dec 2010 10:32:56 -0000
@@ -3965,38 +3965,23 @@
}
void save(ISaveContext context) throws IOException, JavaModelException {
- IProject project = context.getProject();
- if (project == null) { // save all projects if none specified (snapshot or full save)
- saveProjects(getJavaModel().getJavaProjects());
- }
- else {
- saveProjects(new IJavaProject[] {JavaCore.create(project)});
- }
-
- switch (context.getKind()) {
- case ISaveContext.FULL_SAVE :
- // TODO (eric) - investigate after 3.3 if variables should be saved for a SNAPSHOT
- case ISaveContext.SNAPSHOT :
- // remove variables that should not be saved
- HashMap varsToSave = null;
- Iterator iterator = JavaModelManager.this.variables.entrySet().iterator();
- IEclipsePreferences defaultPreferences = getDefaultPreferences();
- while (iterator.hasNext()) {
- Map.Entry entry = (Map.Entry) iterator.next();
- String varName = (String) entry.getKey();
- if (defaultPreferences.get(CP_VARIABLE_PREFERENCES_PREFIX + varName, null) != null // don't save classpath variables from the default preferences as there is no delta if they are removed
- || CP_ENTRY_IGNORE_PATH.equals(entry.getValue())) {
-
- if (varsToSave == null)
- varsToSave = new HashMap(JavaModelManager.this.variables);
- varsToSave.remove(varName);
- }
- }
- saveVariables(varsToSave != null ? varsToSave : JavaModelManager.this.variables);
- break;
- default :
- // do nothing
+ saveProjects(getJavaModel().getJavaProjects());
+ // remove variables that should not be saved
+ HashMap varsToSave = null;
+ Iterator iterator = JavaModelManager.this.variables.entrySet().iterator();
+ IEclipsePreferences defaultPreferences = getDefaultPreferences();
+ while (iterator.hasNext()) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ String varName = (String) entry.getKey();
+ if (defaultPreferences.get(CP_VARIABLE_PREFERENCES_PREFIX + varName, null) != null // don't save classpath variables from the default preferences as there is no delta if they are removed
+ || CP_ENTRY_IGNORE_PATH.equals(entry.getValue())) {
+
+ if (varsToSave == null)
+ varsToSave = new HashMap(JavaModelManager.this.variables);
+ varsToSave.remove(varName);
+ }
}
+ saveVariables(varsToSave != null ? varsToSave : JavaModelManager.this.variables);
}
private void saveAccessRule(ClasspathAccessRule rule) throws IOException {
#P org.eclipse.jdt.core.tests.model
Index: src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java
===================================================================
RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java,v
retrieving revision 1.70
diff -u -r1.70 ClasspathInitializerTests.java
--- src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java 25 Oct 2010 10:30:07 -0000 1.70
+++ src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java 20 Dec 2010 10:33:07 -0000
@@ -1034,6 +1034,40 @@
}
}
+
+/*
+ * https://bugs.eclipse.org/bugs/show_bug.cgi?id=327471
+ * [java.io.EOFException at java.io.DataInputStream.readInt(Unknown Source)]
+ * This test ensures that there is no exception on a restart of eclipse after
+ * the project is closed after the workspace save
+ */
+public void testContainerInitializer26() throws CoreException {
+ try {
+ createProject("P1");
+ createFile("/P1/lib.jar", "");
+ ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1/lib.jar"}));
+ IJavaProject p2 = createJavaProject(
+ "P2",
+ new String[] {},
+ new String[] {"org.eclipse.jdt.core.tests.model.TEST_CONTAINER"},
+ "");
+ ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1"}));
+
+ waitForAutoBuild();
+ getWorkspace().save(true/*full save*/, null/*no progress*/);
+ p2.getProject().close(null); // close the project after the save and before the shutdown
+ JavaModelManager.getJavaModelManager().shutdown();
+
+ startLogListening();
+ simulateRestart();
+ assertLogEquals(""); // no error should be logged
+
+ } finally {
+ stopLogListening();
+ deleteProject("P1");
+ deleteProject("P2");
+ }
+}
public void testVariableInitializer01() throws CoreException {
try {
createProject("P1");