### Eclipse Workspace Patch 1.0 #P org.eclipse.jdt.core.tests.model Index: src/org/eclipse/jdt/core/tests/model/ClasspathTests.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.model/src/org/eclipse/jdt/core/tests/model/ClasspathTests.java,v retrieving revision 1.198 diff -u -r1.198 ClasspathTests.java --- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 28 Apr 2009 17:46:10 -0000 1.198 +++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 30 Apr 2009 14:07:45 -0000 @@ -4177,18 +4177,22 @@ * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=245576 ) */ public void testReadOnly() throws CoreException { - if (!org.eclipse.jdt.internal.core.util.Util.isReadOnlySupported()) + if (!org.eclipse.jdt.internal.core.util.Util.isReadOnlySupported()) { + System.out.println("Read-only not supported => skip test"); return; + } IJavaProject project = this.createJavaProject("P", new String[] {"src"}, "bin"); IClasspathEntry[] originalCP= project.getRawClasspath(); + IFile classpathFile = null; try { IClasspathEntry newEntry= JavaCore.newSourceEntry(project.getProject().getFullPath().append("extra")); IClasspathEntry[] newCP= new IClasspathEntry[originalCP.length + 1]; System.arraycopy(originalCP, 0 , newCP, 0, originalCP.length); newCP[originalCP.length]= newEntry; - org.eclipse.jdt.internal.core.util.Util.setReadOnly(getFile("/P/.classpath"), true); + classpathFile = getFile("/P/.classpath"); + org.eclipse.jdt.internal.core.util.Util.setReadOnly(classpathFile, true); JavaModelException expected = null; try { project.setRawClasspath(newCP, null); @@ -4198,6 +4202,9 @@ assertExceptionEquals("Unexpected exception", "File /P/.classpath is read-only.", expected); } finally { // cleanup + if (classpathFile != null) { + org.eclipse.jdt.internal.core.util.Util.setReadOnly(classpathFile, false); + } this.deleteProject("P"); } }