View | Details | Raw Unified | Return to bug 166977 | Differences between
and this patch

Collapse All | Expand All

(-)META-INF/MANIFEST.MF (+1 lines)
Lines 24-26 Link Here
24
 org.eclipse.test.performance;bundle-version="[3.1.0,4.0.0)"
24
 org.eclipse.test.performance;bundle-version="[3.1.0,4.0.0)"
25
Eclipse-LazyStart: true
25
Eclipse-LazyStart: true
26
Bundle-RequiredExecutionEnvironment: J2SE-1.4
26
Bundle-RequiredExecutionEnvironment: J2SE-1.4
27
Bundle-Activator: org.eclipse.jdt.core.tests.JDTCoreTestsPlugin
(-)Eclipse Java Tests Compiler/org/eclipse/jdt/tests/compiler/regression/NegativeTest.java (-4 / +5 lines)
Lines 16-21 Link Here
16
import junit.framework.Test;
16
import junit.framework.Test;
17
17
18
import org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest;
18
import org.eclipse.jdt.core.tests.compiler.regression.AbstractRegressionTest;
19
import org.eclipse.jdt.core.tests.util.Util;
19
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
20
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
20
21
21
public class NegativeTest extends AbstractRegressionTest {
22
public class NegativeTest extends AbstractRegressionTest {
Lines 15360-15366 Link Here
15360
		},
15361
		},
15361
		"SUCCESS");
15362
		"SUCCESS");
15362
	// delete binary file SecretClass (i.e. simulate removing it from classpath for subsequent compile)
15363
	// delete binary file SecretClass (i.e. simulate removing it from classpath for subsequent compile)
15363
	new File(OUTPUT_DIR, "plugin3" + File.separator + "SecretClass.class").delete();
15364
	Util.delete(new File(OUTPUT_DIR, "plugin3" + File.separator + "SecretClass.class"));
15364
	
15365
	
15365
	this.runNegativeTest(
15366
	this.runNegativeTest(
15366
		new String[] {
15367
		new String[] {
Lines 15408-15414 Link Here
15408
		},
15409
		},
15409
		"SUCCESS");
15410
		"SUCCESS");
15410
	// delete binary file SecretClass (i.e. simulate removing it from classpath for subsequent compile)
15411
	// delete binary file SecretClass (i.e. simulate removing it from classpath for subsequent compile)
15411
	new File(OUTPUT_DIR, "plugin3" + File.separator + "SecretClass.class").delete();
15412
	Util.delete(new File(OUTPUT_DIR, "plugin3" + File.separator + "SecretClass.class"));
15412
	
15413
	
15413
	this.runNegativeTest(
15414
	this.runNegativeTest(
15414
		new String[] {
15415
		new String[] {
Lines 15458-15464 Link Here
15458
		},
15459
		},
15459
		"SUCCESS");
15460
		"SUCCESS");
15460
	// delete binary file SecretClass (i.e. simulate removing it from classpath for subsequent compile)
15461
	// delete binary file SecretClass (i.e. simulate removing it from classpath for subsequent compile)
15461
	new File(OUTPUT_DIR, "plugin3" + File.separator + "SecretClass.class").delete();
15462
	Util.delete(new File(OUTPUT_DIR, "plugin3" + File.separator + "SecretClass.class"));
15462
	
15463
	
15463
	this.runNegativeTest(
15464
	this.runNegativeTest(
15464
		new String[] {
15465
		new String[] {
Lines 15654-15660 Link Here
15654
		false,
15655
		false,
15655
		null);	
15656
		null);	
15656
	// discard LoopB.class and replace it with copy LoopB1.class so as to create cycle in binaries
15657
	// discard LoopB.class and replace it with copy LoopB1.class so as to create cycle in binaries
15657
	new File(OUTPUT_DIR, "p" + File.separator + "LoopB.class").delete();
15658
	Util.delete(new File(OUTPUT_DIR, "p" + File.separator + "LoopB.class"));
15658
	new File(OUTPUT_DIR, "p" + File.separator + "LoopB1.class").renameTo(new File(OUTPUT_DIR, "p" + File.separator + "LoopB.class"));
15659
	new File(OUTPUT_DIR, "p" + File.separator + "LoopB1.class").renameTo(new File(OUTPUT_DIR, "p" + File.separator + "LoopB.class"));
15659
	
15660
	
15660
	this.runNegativeTest(
15661
	this.runNegativeTest(
(-)Eclipse Java Tests Model/src/org/eclipse/jdt/tests/core/JavaModelRegressionTestSetup.java (-3 / +1 lines)
Lines 236-244 Link Here
236
	if (CURRENT_TEST_SETUP == this) {
236
	if (CURRENT_TEST_SETUP == this) {
237
		RegressionTestSuite.fgJavaModel.close();
237
		RegressionTestSuite.fgJavaModel.close();
238
		RegressionTestSuite.fgJavaModel = null;
238
		RegressionTestSuite.fgJavaModel = null;
239
		new java.io.File(LOCAL_JDK + File.separator + "classes.zip").delete();
239
		Util.delete(new File(LOCAL_JDK));
240
		new java.io.File(LOCAL_JDK + File.separator + "src.zip").delete();
241
		new java.io.File(LOCAL_JDK).delete();
242
	}
240
	}
243
}
241
}
244
}
242
}
(-).options (+8 lines)
Added Link Here
1
# Turn on debug tracing for org.eclipse.jdt.core.tests plugin
2
org.eclipse.jdt.core.tests/debug=true
3
4
# Reports deletion activity
5
org.eclipse.jdt.core.tests/debug/delete=false
6
7
# Maximum time in ms waiting for delete operation succeed
8
org.eclipse.jdt.core.tests/debug/delete/wait=10000
(-)Eclipse (+80 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2006 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.jdt.core.tests;
12
13
import org.eclipse.core.runtime.Platform;
14
import org.eclipse.core.runtime.Plugin;
15
import org.eclipse.jdt.core.tests.util.Util;
16
import org.osgi.framework.BundleContext;
17
18
public class JDTCoreTestsPlugin extends Plugin {
19
20
// The shared plugin instance.
21
private static JDTCoreTestsPlugin JDT_CORE_TESTS_PLUGIN;
22
23
/**
24
 * The plug-in identifier of the JDT/Core tests support
25
 * (value <code>"org.eclipse.jdt.core.tests"</code>).
26
 */
27
public static final String PLUGIN_ID = "org.eclipse.jdt.core.tests" ; //$NON-NLS-1$
28
29
private static final String DELETE_DEBUG = PLUGIN_ID + "/debug/delete" ; //$NON-NLS-1$
30
private static final String DELETE_MAX_WAIT = PLUGIN_ID + "/debug/delete/wait" ; //$NON-NLS-1$
31
32
/**
33
 * The constructor.
34
 */
35
public JDTCoreTestsPlugin() {
36
	JDT_CORE_TESTS_PLUGIN = this;
37
}
38
39
/**
40
 * This method is called upon plug-in activation
41
 */
42
public void start(BundleContext context) throws Exception {
43
	super.start(context);
44
	configurePluginDebugOptions();
45
}
46
47
/**
48
 * This method is called when the plug-in is stopped
49
 */
50
public void stop(BundleContext context) throws Exception {
51
	super.stop(context);
52
	JDT_CORE_TESTS_PLUGIN = null;
53
}
54
55
/**
56
 * Returns the shared instance.
57
 */
58
public static JDTCoreTestsPlugin getDefault() {
59
	return JDT_CORE_TESTS_PLUGIN;
60
}
61
62
/**
63
 * Configure the plugin with respect to option settings defined in ".options" file
64
 */
65
void configurePluginDebugOptions(){
66
	if(isDebugging()){
67
		String option = Platform.getDebugOption(DELETE_DEBUG);
68
		if(option != null) {
69
			Util.DELETE_DEBUG = option.equalsIgnoreCase("true") ; //$NON-NLS-1$
70
		}
71
		option = Platform.getDebugOption(DELETE_MAX_WAIT);
72
		if(option != null) {
73
			int wait = Integer.parseInt(option);
74
			if (wait > 1000 && wait <= 60000) { // between 1 and 60 seconds, else use default value (10s)
75
				Util.DELETE_MAX_WAIT = wait;
76
			}
77
		}
78
	}
79
}
80
}
(-)src/org/eclipse/jdt/core/tests/performance/FullSourceWorkspaceTests.java (-4 / +5 lines)
Lines 836-845 Link Here
836
		this.scenarioComment.append(warnings);
836
		this.scenarioComment.append(warnings);
837
	}
837
	}
838
838
839
	/**
839
	/*
840
	 * Delete a directory from file system.
840
	 * Delete a directory from file system.
841
	 * @param directory
841
	 * @param directory
842
	 */
842
	 *
843
	protected void cleanupDirectory(File directory) {
843
	protected void cleanupDirectory(File directory) {
844
		if (!directory.isDirectory() || !directory.exists()) {
844
		if (!directory.isDirectory() || !directory.exists()) {
845
			return;
845
			return;
Lines 857-862 Link Here
857
		if (!directory.delete())
857
		if (!directory.delete())
858
			System.out.println("Could not delete directory " + directory.getPath()); //$NON-NLS-1$
858
			System.out.println("Could not delete directory " + directory.getPath()); //$NON-NLS-1$
859
	}
859
	}
860
	*/
860
861
861
	/*
862
	/*
862
	 * Clear given options
863
	 * Clear given options
Lines 925-931 Link Here
925
			}
926
			}
926
		}
927
		}
927
		if (!"none".equals(COMPILER_OUTPUT_DIR)) {
928
		if (!"none".equals(COMPILER_OUTPUT_DIR)) {
928
			cleanupDirectory(new File(COMPILER_OUTPUT_DIR));
929
			Util.delete(COMPILER_OUTPUT_DIR);
929
		}
930
		}
930
		warnings = warmup.globalWarningsCount;
931
		warnings = warmup.globalWarningsCount;
931
		if (!log) Util.writeToFile(errStrWriter.toString(), logFileName);
932
		if (!log) Util.writeToFile(errStrWriter.toString(), logFileName);
Lines 957-963 Link Here
957
			}
958
			}
958
			stopMeasuring();
959
			stopMeasuring();
959
			if (!"none".equals(COMPILER_OUTPUT_DIR)) {
960
			if (!"none".equals(COMPILER_OUTPUT_DIR)) {
960
				cleanupDirectory(new File(COMPILER_OUTPUT_DIR));
961
				Util.delete(COMPILER_OUTPUT_DIR);
961
			}
962
			}
962
		}
963
		}
963
		
964
		
(-)src/org/eclipse/jdt/core/tests/model/DeleteTests.java (-2 / +3 lines)
Lines 18-23 Link Here
18
import org.eclipse.core.runtime.OperationCanceledException;
18
import org.eclipse.core.runtime.OperationCanceledException;
19
19
20
import org.eclipse.jdt.core.*;
20
import org.eclipse.jdt.core.*;
21
import org.eclipse.jdt.core.tests.util.Util;
21
import org.eclipse.jdt.core.util.IClassFileReader;
22
import org.eclipse.jdt.core.util.IClassFileReader;
22
23
23
import junit.framework.Test;
24
import junit.framework.Test;
Lines 196-202 Link Here
196
		ICompilationUnit cu = getCompilationUnit("P/X.java");
197
		ICompilationUnit cu = getCompilationUnit("P/X.java");
197
198
198
		startDeltas();
199
		startDeltas();
199
		file.delete(false, null);
200
		Util.delete(file);
200
		assertTrue("Should be able to delete a CU", !cu.exists());
201
		assertTrue("Should be able to delete a CU", !cu.exists());
201
		assertDeltas(
202
		assertDeltas(
202
			"Unexpected delta",
203
			"Unexpected delta",
Lines 808-814 Link Here
808
		);
809
		);
809
		IClassFile classFile = getClassFile("P78128", "lib.jar", "p", "X.class");
810
		IClassFile classFile = getClassFile("P78128", "lib.jar", "p", "X.class");
810
		ToolFactory.createDefaultClassFileReader(classFile, IClassFileReader.ALL);
811
		ToolFactory.createDefaultClassFileReader(classFile, IClassFileReader.ALL);
811
		javaProject.getProject().delete(false, null);
812
		Util.delete(javaProject.getProject());
812
	} finally {
813
	} finally {
813
		if (getProject("P78128").exists()) 
814
		if (getProject("P78128").exists()) 
814
			System.gc();
815
			System.gc();
(-)src/org/eclipse/jdt/core/tests/model/JavaProjectTests.java (-14 / +2 lines)
Lines 894-906 Link Here
894
		//System.out.println((System.currentTimeMillis() - start)+ "ms for "+roots.length+" roots");
894
		//System.out.println((System.currentTimeMillis() - start)+ "ms for "+roots.length+" roots");
895
	} finally {
895
	} finally {
896
		if (libDir != null) {
896
		if (libDir != null) {
897
			String[] libJars = libDir.list();
897
			org.eclipse.jdt.core.tests.util.Util.delete(libDir);
898
			if (libJars != null) {
899
				for (int i = 0, length = libJars.length; i < length; i++) {
900
					new File(libDir, libJars[i]).delete();
901
				}
902
			}
903
			libDir.delete();
904
		}
898
		}
905
		this.deleteProject("P");
899
		this.deleteProject("P");
906
		JavaCore.removeClasspathVariable("MyVar", null);
900
		JavaCore.removeClasspathVariable("MyVar", null);
Lines 933-945 Link Here
933
		assertEquals("unexpected root raw entry:", classpath[0], rawEntry); // ensure first entry is associated to the root
927
		assertEquals("unexpected root raw entry:", classpath[0], rawEntry); // ensure first entry is associated to the root
934
	} finally {
928
	} finally {
935
		if (libDir != null) {
929
		if (libDir != null) {
936
			String[] libJars = libDir.list();
930
			org.eclipse.jdt.core.tests.util.Util.delete(libDir);
937
			if (libJars != null) {
938
				for (int i = 0, length = libJars.length; i < length; i++) {
939
					new File(libDir, libJars[i]).delete();
940
				}
941
			}
942
			libDir.delete();
943
		}
931
		}
944
		this.deleteProject("P");
932
		this.deleteProject("P");
945
		JavaCore.removeClasspathVariable("MyVar", null);
933
		JavaCore.removeClasspathVariable("MyVar", null);
(-)src/org/eclipse/jdt/core/tests/model/JavadocPackageCompletionModelTest.java (-8 / +1 lines)
Lines 80-93 Link Here
80
		if (!PACKAGE_FILES.contains(packageDir)) {
80
		if (!PACKAGE_FILES.contains(packageDir)) {
81
			if (packageDir.exists()) {
81
			if (packageDir.exists()) {
82
				PACKAGE_FILES.add(packageDir);
82
				PACKAGE_FILES.add(packageDir);
83
				File[] dirs= packageDir.listFiles();
83
				Util.flushDirectoryContent(packageDir);
84
				for (int j=0, dl=dirs.length; j<dl; j++) {
85
					File[] files = dirs[j].listFiles();
86
					for (int k=0, fl=files.length; k<fl; k++) {
87
						files[k].delete();
88
					}
89
					dirs[j].delete();
90
				}
91
			} else if (packageDir.mkdirs()) {
84
			} else if (packageDir.mkdirs()) {
92
				PACKAGE_FILES.add(packageDir);
85
				PACKAGE_FILES.add(packageDir);
93
			} else {
86
			} else {
(-)src/org/eclipse/jdt/core/tests/model/AbstractJavadocCompletionModelTest.java (-4 / +1 lines)
Lines 455-464 Link Here
455
			if (!PACKAGE_FILES.contains(packageDir)) {
455
			if (!PACKAGE_FILES.contains(packageDir)) {
456
				if (packageDir.exists()) {
456
				if (packageDir.exists()) {
457
					PACKAGE_FILES.add(packageDir);
457
					PACKAGE_FILES.add(packageDir);
458
					File[] files = packageDir.listFiles();
458
					Util.delete(packageDir);
459
					for (int j=0, fl=files.length; j<fl; j++) {
460
						files[j].delete();
461
					}
462
				} else if (packageDir.mkdirs()) {
459
				} else if (packageDir.mkdirs()) {
463
					PACKAGE_FILES.add(packageDir);
460
					PACKAGE_FILES.add(packageDir);
464
				} else {
461
				} else {
(-)src/org/eclipse/jdt/core/tests/model/TypeHierarchyTests.java (-2 / +2 lines)
Lines 501-509 Link Here
501
		);
501
		);
502
	} finally {
502
	} finally {
503
		if (externalJar1 != null)
503
		if (externalJar1 != null)
504
			new File(externalJar1).delete();
504
			Util.delete(externalJar1);
505
		if (externalJar2 != null)
505
		if (externalJar2 != null)
506
			new File(externalJar2).delete();
506
			Util.delete(externalJar2);
507
		deleteProject("P");
507
		deleteProject("P");
508
	}
508
	}
509
}
509
}
(-)src/org/eclipse/jdt/core/tests/model/JavaSearchTests.java (-1 / +2 lines)
Lines 20-25 Link Here
20
import org.eclipse.core.runtime.*;
20
import org.eclipse.core.runtime.*;
21
import org.eclipse.jdt.core.*;
21
import org.eclipse.jdt.core.*;
22
import org.eclipse.jdt.core.search.*;
22
import org.eclipse.jdt.core.search.*;
23
import org.eclipse.jdt.core.tests.util.Util;
23
import org.eclipse.jdt.internal.core.JavaModelStatus;
24
import org.eclipse.jdt.internal.core.JavaModelStatus;
24
25
25
/**
26
/**
Lines 2072-2078 Link Here
2072
			this.resultCollector);
2073
			this.resultCollector);
2073
		
2074
		
2074
	} finally {
2075
	} finally {
2075
		externalJar.delete();
2076
		Util.delete(externalJar);
2076
		project.setRawClasspath(classpath, null);
2077
		project.setRawClasspath(classpath, null);
2077
	}
2078
	}
2078
	
2079
	
(-)src/org/eclipse/jdt/core/tests/model/AbstractJavaModelTests.java (-58 / +8 lines)
Lines 1170-1198 Link Here
1170
		return project;
1170
		return project;
1171
	}
1171
	}
1172
	public void deleteFile(File file) {
1172
	public void deleteFile(File file) {
1173
		file = file.getAbsoluteFile();
1173
		int retryCount = 0;
1174
		if (!file.exists())
1174
		while (++retryCount <= 60) { // wait 1 minute at most
1175
			return;
1175
			if (org.eclipse.jdt.core.tests.util.Util.delete(file)) {
1176
		if (file.isDirectory()) {
1176
				break;
1177
			String[] files = file.list();
1178
			//file.list() can return null
1179
			if (files != null) {
1180
				for (int i = 0; i < files.length; ++i) {
1181
					deleteFile(new File(file, files[i]));
1182
				}
1183
			}
1184
		}
1185
		boolean success = file.delete();
1186
		int retryCount = 60; // wait 1 minute at most
1187
		while (!success && --retryCount >= 0) {
1188
			try {
1189
				Thread.sleep(1000);
1190
			} catch (InterruptedException e) {
1191
			}
1177
			}
1192
			success = file.delete();
1193
		}
1178
		}
1194
		if (success) return;
1195
		System.err.println("Failed to delete " + file.getPath());
1196
	}
1179
	}
1197
	protected void deleteFolder(IPath folderPath) throws CoreException {
1180
	protected void deleteFolder(IPath folderPath) throws CoreException {
1198
		deleteResource(getFolder(folderPath));
1181
		deleteResource(getFolder(folderPath));
Lines 1231-1274 Link Here
1231
	 * Delete this resource.
1214
	 * Delete this resource.
1232
	 */
1215
	 */
1233
	public void deleteResource(IResource resource) throws CoreException {
1216
	public void deleteResource(IResource resource) throws CoreException {
1234
		CoreException lastException = null;
1235
		try {
1236
			resource.delete(true, null);
1237
			return;
1238
		} catch (CoreException e) {
1239
			lastException = e;
1240
			// just print for info
1241
			System.out.println(e.getMessage() + " [" + resource.getFullPath() + "]");
1242
		} catch (IllegalArgumentException iae) {
1243
			// just print for info
1244
			System.out.println(iae.getMessage() + " [" + resource.getFullPath() + "]");
1245
		}
1246
		int retryCount = 0; // wait 1 minute at most
1217
		int retryCount = 0; // wait 1 minute at most
1247
		while (resource.isAccessible() && ++retryCount <= 60) {
1218
		while (++retryCount <= 60) {
1248
			System.out.println("Running GC and waiting 1s...");
1219
			if (!org.eclipse.jdt.core.tests.util.Util.delete(resource)) {
1249
			try {
1250
				System.gc();
1220
				System.gc();
1251
				Thread.sleep(1000);
1252
			} catch (InterruptedException e) {
1253
			}
1221
			}
1254
			try {
1255
				resource.delete(true, null);
1256
			} catch (CoreException e) {
1257
				lastException = e;
1258
				// just print for info
1259
				System.out.println("Retry "+retryCount+": "+ e.getMessage() + " [" + resource.getFullPath() + "]");
1260
			} catch (IllegalArgumentException iae) {
1261
				// just print for info
1262
				System.out.println("Retry "+retryCount+": "+ iae.getMessage() + " [" + resource.getFullPath() + "]");
1263
			}
1264
		}
1265
		if (!resource.isAccessible()) {
1266
			System.out.println("Succeed to delete resource [" + resource.getFullPath() + "]");
1267
			return;
1268
		}
1269
		System.err.println("Failed to delete resource [" + resource.getFullPath() + "]");
1270
		if (lastException != null) {
1271
			throw lastException;
1272
		}
1222
		}
1273
	}
1223
	}
1274
	/**
1224
	/**
Lines 1716-1724 Link Here
1716
		IProject project = javaProject.getProject();
1666
		IProject project = javaProject.getProject();
1717
		String projectPath = '/' + project.getName() + '/';
1667
		String projectPath = '/' + project.getName() + '/';
1718
		removeLibraryEntry(javaProject, new Path(projectPath + jarName));
1668
		removeLibraryEntry(javaProject, new Path(projectPath + jarName));
1719
		project.getFile(jarName).delete(false, null);
1669
		org.eclipse.jdt.core.tests.util.Util.delete(project.getFile(jarName));
1720
		if (sourceZipName != null && sourceZipName.length() != 0) {
1670
		if (sourceZipName != null && sourceZipName.length() != 0) {
1721
			project.getFile(sourceZipName).delete(false, null);
1671
			org.eclipse.jdt.core.tests.util.Util.delete(project.getFile(sourceZipName));
1722
		}
1672
		}
1723
	}
1673
	}
1724
	protected void removeLibraryEntry(Path path) throws JavaModelException {
1674
	protected void removeLibraryEntry(Path path) throws JavaModelException {
(-)src/org/eclipse/jdt/core/tests/model/ModifyingResourceTests.java (-1 / +2 lines)
Lines 209-215 Link Here
209
}
209
}
210
protected IClassFile createClassFile(String libPath, String classFileRelativePath, String contents) throws CoreException {
210
protected IClassFile createClassFile(String libPath, String classFileRelativePath, String contents) throws CoreException {
211
	IClassFile classFile = getClassFile(libPath + "/" + classFileRelativePath);
211
	IClassFile classFile = getClassFile(libPath + "/" + classFileRelativePath);
212
	classFile.getResource().delete(false, null);
212
//	classFile.getResource().delete(false, null);
213
	Util.delete(classFile.getResource());
213
	IJavaProject javaProject = classFile.getJavaProject();
214
	IJavaProject javaProject = classFile.getJavaProject();
214
	IProject project = javaProject.getProject();
215
	IProject project = javaProject.getProject();
215
	String sourcePath = project.getLocation().toOSString() + File.separatorChar + classFile.getType().getElementName() + ".java";
216
	String sourcePath = project.getLocation().toOSString() + File.separatorChar + classFile.getType().getElementName() + ".java";
(-)src/org/eclipse/jdt/core/tests/dom/ASTConverter15Test.java (-1 / +2 lines)
Lines 5980-5986 Link Here
5980
			};
5980
			};
5981
			Util.compile(pathsAndContents, options, classesPath);
5981
			Util.compile(pathsAndContents, options, classesPath);
5982
			folder.refreshLocal(IResource.DEPTH_INFINITE, null);
5982
			folder.refreshLocal(IResource.DEPTH_INFINITE, null);
5983
			folder.getFolder("p").getFile("Bin.class").delete(false, null);
5983
//			folder.getFolder("p").getFile("Bin.class").delete(false, null);
5984
			Util.delete(folder.getFolder("p").getFile("Bin.class"));
5984
	    	this.workingCopy = getWorkingCopy("/P/src/X.java", true/*resolve*/);
5985
	    	this.workingCopy = getWorkingCopy("/P/src/X.java", true/*resolve*/);
5985
	    	String contents =
5986
	    	String contents =
5986
				"public class X {\n" + 
5987
				"public class X {\n" + 
(-)src/org/eclipse/jdt/core/tests/compiler/regression/JavadocTest.java (-5 / +5 lines)
Lines 366-376 Link Here
366
		createOutputTestDirectory(Character.toUpperCase(testName.charAt(0)) + 
366
		createOutputTestDirectory(Character.toUpperCase(testName.charAt(0)) + 
367
				testName.substring(1));
367
				testName.substring(1));
368
		System.out.println("Write test file to " + 
368
		System.out.println("Write test file to " + 
369
				this.outputTestDirectoryPath + "...");
369
				this.outputTestDirectory.getPath() + "...");
370
		for (int i=0, length=testFiles.length; i<length; i++) {
370
		for (int i=0, length=testFiles.length; i<length; i++) {
371
			String contents = testFiles[i+1];
371
			String contents = testFiles[i+1];
372
			String fileName = testFiles[i++];
372
			String fileName = testFiles[i++];
373
			String dirFileName = this.outputTestDirectoryPath.toString();
373
			String dirFileName = this.outputTestDirectory.getPath();
374
			if (fileName.indexOf("Visibility")>0) {
374
			if (fileName.indexOf("Visibility")>0) {
375
				continue;
375
				continue;
376
			} else {
376
			} else {
Lines 412-418 Link Here
412
			// Cleanup javac output dir if needed
412
			// Cleanup javac output dir if needed
413
			File javacOutputDirectory = new File(JAVAC_OUTPUT_DIR);
413
			File javacOutputDirectory = new File(JAVAC_OUTPUT_DIR);
414
			if (shouldFlushOutputDirectory) {
414
			if (shouldFlushOutputDirectory) {
415
				cleanupDirectory(javacOutputDirectory);
415
				Util.delete(javacOutputDirectory);
416
			}
416
			}
417
			
417
			
418
			// Write files in dir
418
			// Write files in dir
Lines 443-449 Link Here
443
443
444
			// Launch process
444
			// Launch process
445
			compileProcess = Runtime.getRuntime().exec(
445
			compileProcess = Runtime.getRuntime().exec(
446
				cmdLine.toString(), null, this.outputTestDirectoryPath.toFile());
446
				cmdLine.toString(), null, this.outputTestDirectory);
447
447
448
			// Log errors
448
			// Log errors
449
      Logger errorLogger = new Logger(compileProcess.getErrorStream(), "ERROR");            
449
      Logger errorLogger = new Logger(compileProcess.getErrorStream(), "ERROR");            
Lines 549-555 Link Here
549
			//           the test itself
549
			//           the test itself
550
		} 
550
		} 
551
		finally {
551
		finally {
552
			cleanupDirectory(outputTestDirectoryPath.toFile());
552
			Util.delete(outputTestDirectory);
553
		}
553
		}
554
	}
554
	}
555
	
555
	
(-)src/org/eclipse/jdt/core/tests/compiler/regression/AbstractRegressionTest.java (-29 / +7 lines)
Lines 202-229 Link Here
202
	/*######################################
202
	/*######################################
203
	 * Specific method to let tests Sun javac compilation available...
203
	 * Specific method to let tests Sun javac compilation available...
204
	 #######################################*/
204
	 #######################################*/
205
	/*
206
	 * Cleans up the given directory by removing all the files it contains as well
207
	 * but leaving the directory.
208
	 * @throws TargetException if the target path could not be cleaned up
209
	 */
210
	protected void cleanupDirectory(File directory) {
211
		if (!directory.exists()) {
212
			return;
213
		}
214
		String[] fileNames = directory.list();
215
		for (int i = 0; i < fileNames.length; i++) {
216
			File file = new File(directory, fileNames[i]);
217
			if (file.isDirectory()) {
218
				cleanupDirectory(file);
219
			} else {
220
				if (!file.delete())
221
					System.out.println("Could not delete file " + file.getPath());
222
			}
223
		}
224
		if (!directory.delete())
225
			System.out.println("Could not delete directory " + directory.getPath());
226
	}
227
	protected void compileAndDeploy(String source, String directoryName, String className) {
205
	protected void compileAndDeploy(String source, String directoryName, String className) {
228
		File directory = new File(SOURCE_DIRECTORY);
206
		File directory = new File(SOURCE_DIRECTORY);
229
		if (!directory.exists()) {
207
		if (!directory.exists()) {
Lines 474-480 Link Here
474
		if (fileNames != null) {
452
		if (fileNames != null) {
475
			for (int i = 0, max = fileNames.length; i < max; i++) {
453
			for (int i = 0, max = fileNames.length; i < max; i++) {
476
				if (fileNames[i].indexOf(className) != -1) {
454
				if (fileNames[i].indexOf(className) != -1) {
477
					new File(SOURCE_DIRECTORY + File.separator + fileNames[i]).delete();
455
					Util.delete(SOURCE_DIRECTORY + File.separator + fileNames[i]);
478
				}
456
				}
479
			}
457
			}
480
		}
458
		}
Lines 484-490 Link Here
484
		if (fileNames != null) {
462
		if (fileNames != null) {
485
			for (int i = 0, max = fileNames.length; i < max; i++) {
463
			for (int i = 0, max = fileNames.length; i < max; i++) {
486
				if (fileNames[i].indexOf(className) != -1) {
464
				if (fileNames[i].indexOf(className) != -1) {
487
					new File(EVAL_DIRECTORY + File.separator + fileNames[i]).delete();
465
					Util.delete(EVAL_DIRECTORY + File.separator + fileNames[i]);
488
				}
466
				}
489
			}
467
			}
490
		}
468
		}
Lines 795-801 Link Here
795
			// Cleanup javac output dir if needed
773
			// Cleanup javac output dir if needed
796
			File javacOutputDirectory = new File(JAVAC_OUTPUT_DIR);
774
			File javacOutputDirectory = new File(JAVAC_OUTPUT_DIR);
797
			if (shouldFlushOutputDirectory) {
775
			if (shouldFlushOutputDirectory) {
798
				cleanupDirectory(javacOutputDirectory);
776
				Util.delete(javacOutputDirectory);
799
			}
777
			}
800
			
778
			
801
			// Write files in dir
779
			// Write files in dir
Lines 826-832 Link Here
826
804
827
			// Launch process
805
			// Launch process
828
			compileProcess = Runtime.getRuntime().exec(
806
			compileProcess = Runtime.getRuntime().exec(
829
				cmdLine.toString(), null, this.outputTestDirectoryPath.toFile());
807
				cmdLine.toString(), null, this.outputTestDirectory);
830
808
831
			// Log errors
809
			// Log errors
832
      Logger errorLogger = new Logger(compileProcess.getErrorStream(), "ERROR");            
810
      Logger errorLogger = new Logger(compileProcess.getErrorStream(), "ERROR");            
Lines 891-897 Link Here
891
						javaCmdLine.append(cp);
869
						javaCmdLine.append(cp);
892
						javaCmdLine.append(' ').append(testFiles[0].substring(0, testFiles[0].indexOf('.')));
870
						javaCmdLine.append(' ').append(testFiles[0].substring(0, testFiles[0].indexOf('.')));
893
							// assume executable class is name of first test file - PREMATURE check if this is also the case in other test fwk classes
871
							// assume executable class is name of first test file - PREMATURE check if this is also the case in other test fwk classes
894
						execProcess = Runtime.getRuntime().exec(javaCmdLine.toString(), null, this.outputTestDirectoryPath.toFile());
872
						execProcess = Runtime.getRuntime().exec(javaCmdLine.toString(), null, this.outputTestDirectory);
895
						Logger logger = new Logger(execProcess.getInputStream(), "");
873
						Logger logger = new Logger(execProcess.getInputStream(), "");
896
						// PREMATURE implement consistent error policy
874
						// PREMATURE implement consistent error policy
897
	     				logger.start();
875
	     				logger.start();
Lines 960-966 Link Here
960
		} 
938
		} 
961
		finally {
939
		finally {
962
			// Clean up written file(s)
940
			// Clean up written file(s)
963
			cleanupDirectory(outputTestDirectoryPath.toFile());
941
			Util.delete(outputTestDirectory);
964
		}
942
		}
965
	}
943
	}
966
	/**
944
	/**
Lines 1314-1320 Link Here
1314
		// clean up output dir
1292
		// clean up output dir
1315
		File outputDir = new File(OUTPUT_DIR);
1293
		File outputDir = new File(OUTPUT_DIR);
1316
		if (outputDir.exists()) {
1294
		if (outputDir.exists()) {
1317
			Util.rmdir(outputDir);
1295
			Util.flushDirectoryContent(outputDir);
1318
		}
1296
		}
1319
		super.tearDown();
1297
		super.tearDown();
1320
		if (RUN_JAVAC) {
1298
		if (RUN_JAVAC) {
(-)src/org/eclipse/jdt/core/tests/compiler/regression/BatchCompilerTest.java (-10 / +10 lines)
Lines 1747-1753 Link Here
1747
	        "",
1747
	        "",
1748
	        true);
1748
	        true);
1749
		if (jarCreated) {
1749
		if (jarCreated) {
1750
			new File(libPath).delete();
1750
			Util.delete(libPath);
1751
		}
1751
		}
1752
	}
1752
	}
1753
//	 https://bugs.eclipse.org/bugs/show_bug.cgi?id=88364 - -extdirs extends the classpath before -classpath
1753
//	 https://bugs.eclipse.org/bugs/show_bug.cgi?id=88364 - -extdirs extends the classpath before -classpath
Lines 2375-2385 Link Here
2375
		        false);
2375
		        false);
2376
		final String userDir = System.getProperty("user.dir");
2376
		final String userDir = System.getProperty("user.dir");
2377
		File f = new File(userDir, "X.java");
2377
		File f = new File(userDir, "X.java");
2378
		if (!f.delete()) {
2378
		if (!Util.delete(f)) {
2379
			System.out.println("Could not delete X");
2379
			System.out.println("Could not delete X");
2380
		}
2380
		}
2381
		f = new File(userDir, "p" + File.separator + "Y.java");
2381
		f = new File(userDir, "p" + File.separator + "Y.java");
2382
		if (!f.delete()) {
2382
		if (!Util.delete(f)) {
2383
			System.out.println("Could not delete Y");
2383
			System.out.println("Could not delete Y");
2384
		}
2384
		}
2385
		
2385
		
Lines 3285-3292 Link Here
3285
	} catch (IOException e) {
3285
	} catch (IOException e) {
3286
		fail("could not create jar file");
3286
		fail("could not create jar file");
3287
	}
3287
	}
3288
	new File(outputDirName + File.separator + "Y.class").delete();
3288
	Util.delete(outputDirName + File.separator + "Y.class");
3289
	new File(outputDirName + File.separator + "Y.java").delete();
3289
	Util.delete(outputDirName + File.separator + "Y.java");
3290
	this.runConformTest(
3290
	this.runConformTest(
3291
		new String[] {
3291
		new String[] {
3292
			"d/X.java",
3292
			"d/X.java",
Lines 3334-3341 Link Here
3334
	} catch (IOException e) {
3334
	} catch (IOException e) {
3335
		fail("could not create jar file");
3335
		fail("could not create jar file");
3336
	}
3336
	}
3337
	new File(outputDirName + File.separator + "Y.class").delete();
3337
	Util.delete(outputDirName + File.separator + "Y.class");
3338
	new File(outputDirName + File.separator + "Y.java").delete();
3338
	Util.delete(outputDirName + File.separator + "Y.java");
3339
	this.runConformTest(
3339
	this.runConformTest(
3340
		new String[] {
3340
		new String[] {
3341
			"d/X.java",
3341
			"d/X.java",
Lines 4145-4151 Link Here
4145
			"public class X {}");
4145
			"public class X {}");
4146
		Util.zip(sourceDir,	OUTPUT_DIR + File.separator + "X.jar");
4146
		Util.zip(sourceDir,	OUTPUT_DIR + File.separator + "X.jar");
4147
		if (standardXOutputFile.exists()) {
4147
		if (standardXOutputFile.exists()) {
4148
			standardXOutputFile.delete();
4148
			Util.delete(standardXOutputFile);
4149
		}
4149
		}
4150
	} catch (IOException e) {
4150
	} catch (IOException e) {
4151
		fail("could not create jar file");
4151
		fail("could not create jar file");
Lines 4197-4203 Link Here
4197
			"public class X {}");
4197
			"public class X {}");
4198
		Util.zip(sourceDir,	OUTPUT_DIR + File.separator + "X.jar");
4198
		Util.zip(sourceDir,	OUTPUT_DIR + File.separator + "X.jar");
4199
		if (standardXOutputFile.exists()) {
4199
		if (standardXOutputFile.exists()) {
4200
			standardXOutputFile.delete();
4200
			Util.delete(standardXOutputFile);
4201
		}
4201
		}
4202
	} catch (IOException e) {
4202
	} catch (IOException e) {
4203
		fail("could not create jar file");
4203
		fail("could not create jar file");
Lines 4248-4254 Link Here
4248
			"public class X {}");
4248
			"public class X {}");
4249
		Util.zip(sourceDir,	OUTPUT_DIR + File.separator + "X.jar");
4249
		Util.zip(sourceDir,	OUTPUT_DIR + File.separator + "X.jar");
4250
		if (standardXOutputFile.exists()) {
4250
		if (standardXOutputFile.exists()) {
4251
			standardXOutputFile.delete();
4251
			Util.delete(standardXOutputFile);
4252
		}
4252
		}
4253
	} catch (IOException e) {
4253
	} catch (IOException e) {
4254
		fail("could not create jar file");
4254
		fail("could not create jar file");
(-)src/org/eclipse/jdt/core/tests/compiler/regression/LookupTest.java (-1 / +1 lines)
Lines 1516-1522 Link Here
1516
		},
1516
		},
1517
		"SUCCESS");
1517
		"SUCCESS");
1518
	// delete binary file Dumbo$Clyde (i.e. simulate removing it from classpath for subsequent compile)
1518
	// delete binary file Dumbo$Clyde (i.e. simulate removing it from classpath for subsequent compile)
1519
	new File(OUTPUT_DIR, "p" + File.separator + "Dumbo$Clyde.class").delete();
1519
	Util.delete(new File(OUTPUT_DIR, "p" + File.separator + "Dumbo$Clyde.class"));
1520
	
1520
	
1521
	this.runConformTest(
1521
	this.runConformTest(
1522
		new String[] {
1522
		new String[] {
(-)src/org/eclipse/jdt/core/tests/eval/DebugEvaluationTest.java (-6 / +2 lines)
Lines 156-167 Link Here
156
	}
156
	}
157
	public void removeTempClass(String className) {
157
	public void removeTempClass(String className) {
158
		resetEnv(); // needed to reinitialize the caches
158
		resetEnv(); // needed to reinitialize the caches
159
		File sourceFile = new File(SOURCE_DIRECTORY + File.separator + className + ".java");
159
		Util.delete(SOURCE_DIRECTORY + File.separator + className + ".java");
160
		sourceFile.delete();
160
		Util.delete(EvaluationSetup.EVAL_DIRECTORY + File.separator + LocalVMLauncher.REGULAR_CLASSPATH_DIRECTORY + File.separator + className + ".class");
161
	
162
		File binaryFile = new File(EvaluationSetup.EVAL_DIRECTORY + File.separator + LocalVMLauncher.REGULAR_CLASSPATH_DIRECTORY + File.separator + className + ".class");
163
	
164
		binaryFile.delete();
165
	}
161
	}
166
	/*public static Test suite(Class evaluationTestClass) {
162
	/*public static Test suite(Class evaluationTestClass) {
167
		junit.framework.TestSuite suite = new junit.framework.TestSuite();
163
		junit.framework.TestSuite suite = new junit.framework.TestSuite();
(-)src/org/eclipse/jdt/core/tests/util/Util.java (-35 / +439 lines)
Lines 15-20 Link Here
15
import java.util.*;
15
import java.util.*;
16
import java.util.zip.*;
16
import java.util.zip.*;
17
17
18
import org.eclipse.core.resources.IContainer;
19
import org.eclipse.core.resources.IResource;
20
import org.eclipse.core.runtime.CoreException;
18
import org.eclipse.jdt.core.compiler.IProblem;
21
import org.eclipse.jdt.core.compiler.IProblem;
19
import org.eclipse.jdt.core.tests.compiler.regression.Requestor;
22
import org.eclipse.jdt.core.tests.compiler.regression.Requestor;
20
import org.eclipse.jdt.internal.compiler.Compiler;
23
import org.eclipse.jdt.internal.compiler.Compiler;
Lines 27-32 Link Here
27
import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
30
import org.eclipse.jdt.internal.compiler.problem.DefaultProblem;
28
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
31
import org.eclipse.jdt.internal.compiler.problem.DefaultProblemFactory;
29
public class Util {
32
public class Util {
33
	// Trace for delete operation
34
	/*
35
	 * Maximum time wasted repeating delete operations while running JDT/Core tests.
36
	 */
37
	private static int DELETE_MAX_TIME = 0;
38
	/**
39
	 * Trace deletion operations while running JDT/Core tests.
40
	 */
41
	public static boolean DELETE_DEBUG = false;
42
	/**
43
	 * Maximum of time in ms to wait in deletion operation while running JDT/Core tests.
44
	 * Default is 10 seconds. This number cannot exceed 1 minute (ie. 60000).
45
	 * <br>
46
	 * To avoid too many loops while waiting, the ten first ones are done waiting
47
	 * 10ms before repeating, the ten loops after are done waiting 100ms and
48
	 * the other loops are done waiting 1s...
49
	 */
50
	public static int DELETE_MAX_WAIT = 10000;
51
30
	private static final boolean DEBUG = false;
52
	private static final boolean DEBUG = false;
31
	/**
53
	/**
32
	 * Initially, output directory was located in System.getProperty("user.home")+"\comptest".
54
	 * Initially, output directory was located in System.getProperty("user.home")+"\comptest".
Lines 37-43 Link Here
37
	 */
59
	 */
38
	private final static String OUTPUT_DIRECTORY;
60
	private final static String OUTPUT_DIRECTORY;
39
	/**
61
	/**
40
	 * Let user specify the delay in hours before output directories  are removed from file system
62
	 * Let user specify the delay in hours before output directories are removed from file system
41
	 * while starting a new test run. Default value is 2 hours.
63
	 * while starting a new test run. Default value is 2 hours.
42
	 * <p>
64
	 * <p>
43
	 * Note that this value may be a float and so have time less than one hour.
65
	 * Note that this value may be a float and so have time less than one hour.
Lines 90-96 Link Here
90
				for (int i=0,l=testDirs.length; i<l; i++) {
112
				for (int i=0,l=testDirs.length; i<l; i++) {
91
					if (testDirs[i].isDirectory()) {
113
					if (testDirs[i].isDirectory()) {
92
						if ((now - testDirs[i].lastModified()) > delay) {
114
						if ((now - testDirs[i].lastModified()) > delay) {
93
							rmdir(testDirs[i]);
115
							delete(testDirs[i]);
94
						}
116
						}
95
					}
117
					}
96
				}
118
				}
Lines 242-249 Link Here
242
		try {
264
		try {
243
			in = new FileInputStream(source);
265
			in = new FileInputStream(source);
244
			File destFile = new File(dest, source.getName());
266
			File destFile = new File(dest, source.getName());
245
			if (destFile.exists() && !destFile.delete()) {
267
			if (destFile.exists()) {
246
				throw new IOException(destFile + " is in use");
268
				if (!Util.delete(destFile)) {
269
					throw new IOException(destFile + " is in use");
270
				}
247
			}
271
			}
248
		 	out = new FileOutputStream(destFile);
272
		 	out = new FileOutputStream(destFile);
249
			int bufferLength = 1024;
273
			int bufferLength = 1024;
Lines 316-321 Link Here
316
	zip(sourcesDir, zipPath);
340
	zip(sourcesDir, zipPath);
317
}
341
}
318
/**
342
/**
343
 * Delete a file or directory and insure that the file is no longer present
344
 * on file system. In case of directory, delete all the hierarchy underneath.
345
 * 
346
 * @param file The file or directory to delete
347
 * @return true iff the file was really delete, false otherwise
348
 */
349
public static boolean delete(File file) {
350
	// flush all directory content
351
	if (file.isDirectory()) {
352
		flushDirectoryContent(file);
353
	}
354
	// remove file
355
	file.delete();
356
	if (isFileDeleted(file)) {
357
		return true;
358
	}
359
	return waitUntilFileDeleted(file);
360
}
361
/**
362
 * Delete a file or directory and insure that the file is no longer present
363
 * on file system. In case of directory, delete all the hierarchy underneath.
364
 * 
365
 * @param resource The resource to delete
366
 * @return true iff the file was really delete, false otherwise
367
 */
368
public static boolean delete(IResource resource) {
369
	try {
370
		resource.delete(true, null);
371
		if (isResourceDeleted(resource)) {
372
			return true;
373
		}
374
	}
375
	catch (CoreException e) {
376
		//	skip
377
	}
378
	return waitUntilResourceDeleted(resource);
379
}
380
/**
381
 * Delete a file or directory and insure that the file is no longer present
382
 * on file system. In case of directory, delete all the hierarchy underneath.
383
 * 
384
 * @param path The path of the file or directory to delete
385
 * @return true iff the file was really delete, false otherwise
386
 */
387
public static boolean delete(String path) {
388
	return delete(new File(path));
389
}
390
/**
319
 * Generate a display string from the given String.
391
 * Generate a display string from the given String.
320
 * @param inputString the given input string
392
 * @param inputString the given input string
321
 *
393
 *
Lines 527-558 Link Here
527
	writeToFile(displayString, destinationFilePath);
599
	writeToFile(displayString, destinationFilePath);
528
}
600
}
529
/**
601
/**
530
 * Delete a directory and all its hierarchy if not empty
531
 * 
532
 * @param dir The directory to delete
533
 */
534
public static void rmdir(File dir) {
535
	// flush all directory content
536
	flushDirectoryContent(dir);
537
	// remove dir
538
	dir.delete();
539
}
540
/**
541
 * Flush content of a given directory (leaving it empty),
602
 * Flush content of a given directory (leaving it empty),
542
 * no-op if not a directory.
603
 * no-op if not a directory.
543
 */
604
 */
544
public static void flushDirectoryContent(File dir) {
605
public static void flushDirectoryContent(File dir) {
545
	if (dir.isDirectory()) {
606
	File[] files = dir.listFiles();
546
		String[] files = dir.list();
607
	if (files == null) return;
547
		if (files == null) return;
608
	for (int i = 0, max = files.length; i < max; i++) {
548
		for (int i = 0, max = files.length; i < max; i++) {
609
		delete(files[i]);
549
			File current = new File(dir, files[i]);
550
			if (current.isDirectory()) {
551
				flushDirectoryContent(current);
552
			}
553
			if (!current.delete()) 
554
				System.err.println("Could not delete " + current.getName());
555
		}
556
	}
610
	}
557
}
611
}
558
/**
612
/**
Lines 645-650 Link Here
645
public static String getOutputDirectory() {
699
public static String getOutputDirectory() {
646
	return OUTPUT_DIRECTORY;
700
	return OUTPUT_DIRECTORY;
647
}
701
}
702
/**
703
 * Returns the parent's child file matching the given file or null if not found.
704
 * 
705
 * @param file The searched file in parent
706
 * @return The parent's child matching the given file or null if not found.
707
 */
708
private static File getParentChildFile(File file) {
709
	File parent = file.getParentFile();
710
	if (parent == null || !parent.exists()) return null;
711
	File[] files = parent.listFiles();
712
	int length = files==null ? 0 : files.length;
713
	if (length > 0) {
714
		for (int i=0; i<length; i++) {
715
			if (files[i] == file) {
716
				return files[i];
717
			} else if (files[i].equals(file)) {
718
				return files[i];
719
			} else if (files[i].getPath().equals(file.getPath())) {
720
				return files[i];
721
			}
722
		}
723
	}
724
	return null;
725
}
726
/**
727
 * Returns parent's child resource matching the given resource or null if not found.
728
 * 
729
 * @param resource The searched file in parent
730
 * @return The parent's child matching the given file or null if not found.
731
 */
732
private static IResource getParentChildResource(IResource resource) {
733
	IContainer parent = resource.getParent();
734
	if (parent == null || !parent.exists()) return null;
735
	try {
736
		IResource[] members = parent.members();
737
		int length = members ==null ? 0 : members.length;
738
		if (length > 0) {
739
			for (int i=0; i<length; i++) {
740
				if (members[i] == resource) {
741
					return members[i];
742
				} else if (members[i].equals(resource)) {
743
					return members[i];
744
				} else if (members[i].getFullPath().equals(resource.getFullPath())) {
745
					return members[i];
746
				}
747
			}
748
		}
749
	}
750
	catch (CoreException ce) {
751
		// skip
752
	}
753
	return null;
754
}
755
/**
756
 * Returns the test name from stack elements info.
757
 * 
758
 * @return The name of the test currently running
759
 */
760
private static String getTestName() {
761
	StackTraceElement[] elements = new Exception().getStackTrace();
762
	int idx = 0, length=elements.length;
763
	while (idx<length && !elements[idx++].getClassName().startsWith("org.eclipse.jdt")) {
764
		// loop until JDT/Core class appears in the stack
765
	}
766
	if (idx<length) {
767
		StackTraceElement testElement = null;
768
		while (idx<length && elements[idx].getClassName().startsWith("org.eclipse.jdt")) {
769
			testElement = elements[idx++];
770
		}
771
		if (testElement != null) {
772
			return testElement.getClassName() + " - " + testElement.getMethodName();
773
		}
774
	}
775
	return "?";
776
}
648
public static String indentString(String inputString, int indent) {
777
public static String indentString(String inputString, int indent) {
649
	if (inputString == null)
778
	if (inputString == null)
650
		return "";
779
		return "";
Lines 663-672 Link Here
663
	}
792
	}
664
	return buffer.toString();
793
	return buffer.toString();
665
}
794
}
795
/**
796
 * Returns whether a file is really deleted or not.
797
 * Does not only rely on {@link File#exists()} method but also
798
 * look if it's not in its parent children {@link #getParentChildFile(File)}.
799
 * 
800
 * @param file The file to test if deleted
801
 * @return true if the file does not exist and was not found in its parent children.
802
 */
803
public static boolean isFileDeleted(File file) {
804
	return !file.exists() && getParentChildFile(file) == null;
805
}
666
public static boolean isMacOS() {
806
public static boolean isMacOS() {
667
	return System.getProperty("os.name").indexOf("Mac") != -1;
807
	return System.getProperty("os.name").indexOf("Mac") != -1;
668
}
808
}
669
/**
809
/**
810
 * Returns whether a resource is really deleted or not.
811
 * Does not only rely on {@link IResource#isAccessible()} method but also
812
 * look if it's not in its parent children {@link #getParentChildResource(IResource)}.
813
 * 
814
 * @param resource The resource to test if deleted
815
 * @return true if the resource is not accessible and was not found in its parent children.
816
 */
817
public static boolean isResourceDeleted(IResource resource) {
818
	return !resource.isAccessible() && getParentChildResource(resource) == null;
819
}
820
/**
821
 * Print given file information with specified indentation.
822
 * These information are:<ul>
823
 * 	<li>read {@link File#canRead()}</li>
824
 * 	<li>write {@link File#canWrite()}</li>
825
 * 	<li>exists {@link File#exists()}</li>
826
 * 	<li>is file {@link File#isFile()}</li>
827
 * 	<li>is directory {@link File#isDirectory()}</li>
828
 * 	<li>is hidden {@link File#isHidden()}</li>
829
 * </ul>
830
 * May recurse several level in parents hierarchy.
831
 * May also display children, but then will not recusre in parent
832
 * hierarchy to avoid infinite loop...
833
 * 
834
 * @param file The file to display information
835
 * @param indent Number of tab to print before the information
836
 * @param recurse Display also information on <code>recurse</code>th parents in hierarchy.
837
 * 	If negative then display children information instead.
838
 */
839
private static void printFileInfo(File file, int indent, int recurse) {
840
	String tab = "";
841
	for (int i=0; i<indent; i++) tab+="\t";
842
	System.out.print(tab+"- "+file.getName()+" file info: ");
843
	String sep = "";
844
	if (file.canRead()) {
845
		System.out.print("read");
846
		sep = ", ";
847
	}
848
	if (file.canWrite()) {
849
		System.out.print(sep+"write");
850
		sep = ", ";
851
	}
852
	if (file.exists()) {
853
		System.out.print(sep+"exist");
854
		sep = ", ";
855
	}
856
	if (file.isDirectory()) {
857
		System.out.print(sep+"dir");
858
		sep = ", ";
859
	}
860
	if (file.isFile()) {
861
		System.out.print(sep+"file");
862
		sep = ", ";
863
	}
864
	if (file.isHidden()) {
865
		System.out.print(sep+"hidden");
866
		sep = ", ";
867
	}
868
	System.out.println();
869
	File[] files = file.listFiles();
870
	int length = files==null ? 0 : files.length;
871
	if (length > 0) {
872
		boolean children = recurse < 0;
873
		System.out.print(tab+"	+ children: ");
874
		if (children) System.out.println();
875
		for (int i=0; i<length; i++) {
876
			if (children) { // display children
877
				printFileInfo(files[i], indent+2, -1);
878
			} else {
879
				if (i>0) System.out.print(", ");
880
				System.out.print(files[i].getName());
881
				if (files[i].isDirectory()) System.out.print("[dir]");
882
				else if (files[i].isFile()) System.out.print("[file]");
883
				else System.out.print("[?]");
884
			}
885
		}
886
		if (!children) System.out.println();
887
	}
888
	if (recurse > 0) {
889
		File parent = file.getParentFile();
890
		if (parent != null) printFileInfo(parent, indent+1, recurse-1);
891
	}
892
}
893
/**
894
 * Print stack trace with only JDT/Core elements.
895
 * 
896
 * @param exception Exception of the stack trace. May be null, then a fake exception is used.
897
 * @param indent Number of tab to display before the stack elements to display.
898
 */
899
private static void printJdtCoreStackTrace(Exception exception, int indent) {
900
	String tab = "";
901
	for (int i=0; i<indent; i++) tab+="\t";
902
	StackTraceElement[] elements = (exception==null?new Exception():exception).getStackTrace();
903
	int idx = 0, length=elements.length;
904
	while (idx<length && !elements[idx++].getClassName().startsWith("org.eclipse.jdt")) {
905
		// loop until JDT/Core class appears in the stack
906
	}
907
	if (idx<length) {
908
		System.out.print(tab+"- stack trace");
909
		if (exception == null)
910
			System.out.println(":");
911
		else
912
			System.out.println(" for exception "+exception+":");
913
		while (idx<length && elements[idx].getClassName().startsWith("org.eclipse.jdt")) {
914
			StackTraceElement testElement = elements[idx++];
915
			System.out.println(tab+"	-> "+testElement);
916
		}
917
	} else {
918
		exception.printStackTrace(System.out);
919
	}
920
}
921
/**
670
 * Makes the given path a path using native path separators as returned by File.getPath()
922
 * Makes the given path a path using native path separators as returned by File.getPath()
671
 * and trimming any extra slash.
923
 * and trimming any extra slash.
672
 */
924
 */
Lines 729-734 Link Here
729
		}
981
		}
730
	}
982
	}
731
}
983
}
984
/**
985
 * Wait until the file is _really_ deleted on file system.
986
 * 
987
 * @param file Deleted file
988
 * @return true if the file was finally deleted, false otherwise
989
 */
990
private static boolean waitUntilFileDeleted(File file) {
991
	if (DELETE_DEBUG) {
992
		System.out.println();
993
		System.out.println("WARNING in test: "+getTestName());
994
		System.out.println("	- problems occured while deleting "+file);
995
		printJdtCoreStackTrace(null, 1);
996
		printFileInfo(file.getParentFile(), 1, -1); // display parent with its children
997
		System.out.print("	- wait for ("+DELETE_MAX_WAIT+"ms max): ");
998
	}
999
	int count = 0;
1000
	int delay = 10; // ms
1001
	int maxRetry = DELETE_MAX_WAIT / delay;
1002
	int time = 0;
1003
	while (count < maxRetry) {
1004
		try {
1005
			count++;
1006
			Thread.sleep(delay);
1007
			time += delay;
1008
			if (time > DELETE_MAX_TIME) DELETE_MAX_TIME = time;
1009
			if (DELETE_DEBUG) System.out.print('.');
1010
			if (file.exists()) {
1011
				if (file.delete()) {
1012
					// SUCCESS
1013
					if (DELETE_DEBUG) {
1014
						System.out.println();
1015
						System.out.println("	=> file really removed after "+time+"ms (max="+DELETE_MAX_TIME+"ms)");
1016
						System.out.println();
1017
					}
1018
					return true;
1019
				}
1020
			}
1021
			if (isFileDeleted(file)) {
1022
				// SUCCESS
1023
				if (DELETE_DEBUG) {
1024
					System.out.println();
1025
					System.out.println("	=> file disappeared after "+time+"ms (max="+DELETE_MAX_TIME+"ms)");
1026
					System.out.println();
1027
				}
1028
				return true;
1029
			}
1030
			// Increment waiting delay exponentially
1031
			if (count >= 10 && delay <= 100) {
1032
				count = 1;
1033
				delay *= 10;
1034
				maxRetry = DELETE_MAX_WAIT / delay;
1035
				if ((DELETE_MAX_WAIT%delay) != 0) {
1036
					maxRetry++;
1037
				}
1038
			}
1039
		}
1040
		catch (InterruptedException ie) {
1041
			break; // end loop
1042
		}
1043
	}
1044
	if (!DELETE_DEBUG) {
1045
		System.out.println();
1046
		System.out.println("WARNING in test: "+getTestName());
1047
		System.out.println("	- problems occured while deleting "+file);
1048
		printJdtCoreStackTrace(null, 1);
1049
		printFileInfo(file.getParentFile(), 1, -1); // display parent with its children
1050
	}
1051
	System.out.println();
1052
	System.out.println("	!!! ERROR: "+file+" was never deleted even after having waited "+DELETE_MAX_TIME+"ms!!!");
1053
	System.out.println();
1054
	return false;
1055
}
1056
/**
1057
 * Wait until a resource is _really_ deleted on file system.
1058
 * 
1059
 * @param resource Deleted resource
1060
 * @return true if the file was finally deleted, false otherwise
1061
 */
1062
private static boolean waitUntilResourceDeleted(IResource resource) {
1063
	File file = resource.getLocation().toFile();
1064
	if (DELETE_DEBUG) {
1065
		System.out.println();
1066
		System.out.println("WARNING in test: "+getTestName());
1067
		System.out.println("	- problems occured while deleting resource "+resource);
1068
		printJdtCoreStackTrace(null, 1);
1069
		printFileInfo(file.getParentFile(), 1, -1); // display parent with its children
1070
		System.out.print("	- wait for ("+DELETE_MAX_WAIT+"ms max): ");
1071
	}
1072
	int count = 0;
1073
	int delay = 10; // ms
1074
	int maxRetry = DELETE_MAX_WAIT / delay;
1075
	int time = 0;
1076
	while (count < maxRetry) {
1077
		try {
1078
			count++;
1079
			Thread.sleep(delay);
1080
			time += delay;
1081
			if (time > DELETE_MAX_TIME) DELETE_MAX_TIME = time;
1082
			if (DELETE_DEBUG) System.out.print('.');
1083
			if (resource.isAccessible()) {
1084
				try {
1085
					resource.delete(true, null);
1086
					if (isResourceDeleted(resource) && isFileDeleted(file)) {
1087
						// SUCCESS
1088
						if (DELETE_DEBUG) {
1089
							System.out.println();
1090
							System.out.println("	=> resource really removed after "+time+"ms (max="+DELETE_MAX_TIME+"ms)");
1091
							System.out.println();
1092
						}
1093
						return true;
1094
					}
1095
				}
1096
				catch (CoreException e) {
1097
					//	skip
1098
				}
1099
			}
1100
			if (isResourceDeleted(resource) && isFileDeleted(file)) {
1101
				// SUCCESS
1102
				if (DELETE_DEBUG) {
1103
					System.out.println();
1104
					System.out.println("	=> resource disappeared after "+time+"ms (max="+DELETE_MAX_TIME+"ms)");
1105
					System.out.println();
1106
				}
1107
				return true;
1108
			}
1109
			// Increment waiting delay exponentially
1110
			if (count >= 10 && delay <= 100) {
1111
				count = 1;
1112
				delay *= 10;
1113
				maxRetry = DELETE_MAX_WAIT / delay;
1114
				if ((DELETE_MAX_WAIT%delay) != 0) {
1115
					maxRetry++;
1116
				}
1117
			}
1118
		}
1119
		catch (InterruptedException ie) {
1120
			break; // end loop
1121
		}
1122
	}
1123
	if (!DELETE_DEBUG) {
1124
		System.out.println();
1125
		System.out.println("WARNING in test: "+getTestName());
1126
		System.out.println("	- problems occured while deleting resource "+resource);
1127
		printJdtCoreStackTrace(null, 1);
1128
		printFileInfo(file.getParentFile(), 1, -1); // display parent with its children
1129
	}
1130
	System.out.println();
1131
	System.out.println("	!!! ERROR: "+resource+" was never deleted even after having waited "+DELETE_MAX_TIME+"ms!!!");
1132
	System.out.println();
1133
	return false;
1134
}
732
public static void writeToFile(String contents, String destinationFilePath) {
1135
public static void writeToFile(String contents, String destinationFilePath) {
733
	File destFile = new File(destinationFilePath);
1136
	File destFile = new File(destinationFilePath);
734
	FileOutputStream output = null;
1137
	FileOutputStream output = null;
Lines 752-758 Link Here
752
public static void zip(File rootDir, String zipPath) throws IOException {
1155
public static void zip(File rootDir, String zipPath) throws IOException {
753
	ZipOutputStream zip = null;
1156
	ZipOutputStream zip = null;
754
	try {
1157
	try {
755
		zip  = new ZipOutputStream(new FileOutputStream(zipPath));
1158
		File zipFile = new File(zipPath);
1159
		if (zipFile.exists()) delete(zipFile);
1160
		zip = new ZipOutputStream(new FileOutputStream(zipFile));
756
		zip(rootDir, zip, rootDir.getPath().length()+1); // 1 for last slash
1161
		zip(rootDir, zip, rootDir.getPath().length()+1); // 1 for last slash
757
	} finally {
1162
	} finally {
758
		if (zip != null) {
1163
		if (zip != null) {
Lines 761-780 Link Here
761
	}
1166
	}
762
}
1167
}
763
private static void zip(File dir, ZipOutputStream zip, int rootPathLength) throws IOException {
1168
private static void zip(File dir, ZipOutputStream zip, int rootPathLength) throws IOException {
764
	String[] list = dir.list();
1169
	File[] files = dir.listFiles();
765
	if (list != null) {
1170
	if (files != null) {
766
		for (int i = 0, length = list.length; i < length; i++) {
1171
		for (int i = 0, length = files.length; i < length; i++) {
767
			String name = list[i];
1172
			File file = files[i];
768
			File file = new File(dir, name);
1173
			if (file.isFile()) {
769
			if (file.isDirectory()) {
770
				zip(file, zip, rootPathLength);
771
			} else {
772
				String path = file.getPath();
1174
				String path = file.getPath();
773
				path = path.substring(rootPathLength);
1175
				path = path.substring(rootPathLength);
774
				ZipEntry entry = new ZipEntry(path.replace('\\', '/'));
1176
				ZipEntry entry = new ZipEntry(path.replace('\\', '/'));
775
				zip.putNextEntry(entry);
1177
				zip.putNextEntry(entry);
776
				zip.write(org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(file));
1178
				zip.write(org.eclipse.jdt.internal.compiler.util.Util.getFileByteContent(file));
777
				zip.closeEntry();
1179
				zip.closeEntry();
1180
			} else {
1181
				zip(file, zip, rootPathLength);
778
			}
1182
			}
779
		}
1183
		}
780
	}
1184
	}
(-)src/org/eclipse/jdt/core/tests/util/AbstractCompilerTest.java (-12 / +8 lines)
Lines 458-466 Link Here
458
	}
458
	}
459
	
459
	
460
	// Output files management
460
	// Output files management
461
	protected IPath 
461
	protected IPath outputRootDirectoryPath = new Path(Util.getOutputDirectory());
462
		outputRootDirectoryPath = new Path(Util.getOutputDirectory()),
462
	protected File outputTestDirectory;
463
		outputTestDirectoryPath;
464
463
465
	/**
464
	/**
466
	 * Create a test specific output directory as a subdirectory of 
465
	 * Create a test specific output directory as a subdirectory of 
Lines 470-480 Link Here
470
	 * @param suffixPath a valid relative path for the subdirectory
469
	 * @param suffixPath a valid relative path for the subdirectory
471
	 */
470
	 */
472
	protected void createOutputTestDirectory(String suffixPath) {
471
	protected void createOutputTestDirectory(String suffixPath) {
473
		this.outputTestDirectoryPath = 
472
		this.outputTestDirectory =  new File(this.outputRootDirectoryPath.toFile(), suffixPath);
474
			((IPath) this.outputRootDirectoryPath.clone()).append(suffixPath);
473
		if (!this.outputTestDirectory.exists()) {
475
		File dir = this.outputTestDirectoryPath.toFile();
474
			this.outputTestDirectory.mkdirs();
476
		if (!dir.exists()) {
477
			dir.mkdirs();
478
		}
475
		}
479
	}
476
	}
480
	/*
477
	/*
Lines 488-502 Link Here
488
		for (int i = 0, length = testFiles.length; i < length; ) {
485
		for (int i = 0, length = testFiles.length; i < length; ) {
489
			String fileName = testFiles[i++];
486
			String fileName = testFiles[i++];
490
			String contents = testFiles[i++];
487
			String contents = testFiles[i++];
491
			IPath filePath = 
488
			File file = new File(this.outputTestDirectory, fileName);
492
				((IPath) this.outputTestDirectoryPath.clone()).append(fileName);
493
			if (fileName.lastIndexOf('/') >= 0) {
489
			if (fileName.lastIndexOf('/') >= 0) {
494
				File dir = filePath.removeLastSegments(1).toFile();
490
				File dir = file.getParentFile();
495
				if (!dir.exists()) {
491
				if (!dir.exists()) {
496
					dir.mkdirs();
492
					dir.mkdirs();
497
				}
493
				}
498
			}
494
			}
499
			Util.writeToFile(contents, filePath.toString());
495
			Util.writeToFile(contents, file.getPath());
500
		}
496
		}
501
	}
497
	}
502
	
498
	
(-)src/org/eclipse/jdt/core/tests/runtime/LocalVirtualMachine.java (-7 / +11 lines)
Lines 12-17 Link Here
12
12
13
import java.io.*;
13
import java.io.*;
14
14
15
import org.eclipse.jdt.core.tests.util.Util;
16
15
/**
17
/**
16
 * Wrapper around the external process that is running a local VM.
18
 * Wrapper around the external process that is running a local VM.
17
 * This allows to kill this process when we exit this vm.
19
 * This allows to kill this process when we exit this vm.
Lines 46-56 Link Here
46
		this.process.destroy();
48
		this.process.destroy();
47
	}
49
	}
48
}
50
}
49
/**
51
/*
50
 * Cleans up the given directory by removing all the files it contains as well
52
 * Cleans up the given directory by removing all the files it contains as well
51
 * but leaving the directory.
53
 * but leaving the directory.
52
 * @throws TargetException if the target path could not be cleaned up
54
 * @throws TargetException if the target path could not be cleaned up
53
 */
55
 *
54
private void cleanupDirectory(File directory) throws TargetException {
56
private void cleanupDirectory(File directory) throws TargetException {
55
	if (!directory.exists()) {
57
	if (!directory.exists()) {
56
		return;
58
		return;
Lines 70-75 Link Here
70
		}
72
		}
71
	}
73
	}
72
}
74
}
75
*/
73
/**
76
/**
74
 * Cleans up this context's target path by removing all the files it contains
77
 * Cleans up this context's target path by removing all the files it contains
75
 * but leaving the directory.
78
 * but leaving the directory.
Lines 79-89 Link Here
79
	if (this.evalTargetPath == null) return;
82
	if (this.evalTargetPath == null) return;
80
	String targetPath = this.evalTargetPath;
83
	String targetPath = this.evalTargetPath;
81
	if (LocalVMLauncher.TARGET_HAS_FILE_SYSTEM) {
84
	if (LocalVMLauncher.TARGET_HAS_FILE_SYSTEM) {
82
		cleanupDirectory(new File(targetPath, LocalVMLauncher.REGULAR_CLASSPATH_DIRECTORY));
85
		Util.delete(new File(targetPath, LocalVMLauncher.REGULAR_CLASSPATH_DIRECTORY));
83
		cleanupDirectory(new File(targetPath, LocalVMLauncher.BOOT_CLASSPATH_DIRECTORY));
86
		Util.delete(new File(targetPath, LocalVMLauncher.BOOT_CLASSPATH_DIRECTORY));
84
		File file = new File(targetPath, RuntimeConstants.SUPPORT_ZIP_FILE_NAME);
87
		File file = new File(targetPath, RuntimeConstants.SUPPORT_ZIP_FILE_NAME);
85
88
86
		// workaround pb with Process.exitValue() that returns the process has exited, but it has not free the file yet
89
		/* workaround pb with Process.exitValue() that returns the process has exited, but it has not free the file yet
87
		int count = 10;
90
		int count = 10;
88
		for (int i = 0; i < count; i++) {
91
		for (int i = 0; i < count; i++) {
89
			if (file.delete()) {
92
			if (file.delete()) {
Lines 94-104 Link Here
94
			} catch (InterruptedException e) {
97
			} catch (InterruptedException e) {
95
			}
98
			}
96
		}
99
		}
97
		if (file.exists()) {
100
		*/
101
		if (!Util.delete(file)) {
98
			throw new TargetException("Could not delete " + file.getPath());
102
			throw new TargetException("Could not delete " + file.getPath());
99
		}
103
		}
100
	} else {
104
	} else {
101
		cleanupDirectory(new File(targetPath));
105
		Util.delete(targetPath);
102
	}
106
	}
103
}
107
}
104
/**
108
/**
(-)src/org/eclipse/jdt/core/tests/builder/TestingEnvironment.java (-27 / +17 lines)
Lines 16-21 Link Here
16
16
17
import org.eclipse.jdt.core.*;
17
import org.eclipse.jdt.core.*;
18
import org.eclipse.jdt.core.tests.util.AbstractCompilerTest;
18
import org.eclipse.jdt.core.tests.util.AbstractCompilerTest;
19
import org.eclipse.jdt.core.tests.util.Util;
19
20
20
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
21
import org.eclipse.jdt.internal.compiler.impl.CompilerOptions;
21
import org.eclipse.jdt.internal.core.ClasspathEntry;
22
import org.eclipse.jdt.internal.core.ClasspathEntry;
Lines 601-635 Link Here
601
		return (IProject)fProjects.get(projectPath.lastSegment());
602
		return (IProject)fProjects.get(projectPath.lastSegment());
602
	}
603
	}
603
604
604
private File tmpDirectory;
605
	private File tmpDirectory;
605
File getTmpDirectory() {
606
	File getTmpDirectory() {
606
	if (this.tmpDirectory == null) {
607
		if (this.tmpDirectory == null) {
607
		this.tmpDirectory = new File(System.getProperty("java.io.tmpdir") + 
608
			this.tmpDirectory = new File(System.getProperty("java.io.tmpdir") + 
608
				File.separator + "org.eclipse.jdt.core.builder.tests.tmp");
609
					File.separator + "org.eclipse.jdt.core.builder.tests.tmp");
609
		if (this.tmpDirectory.exists() && !this.tmpDirectory.isDirectory()) {
610
			if (this.tmpDirectory.exists() && !this.tmpDirectory.isDirectory()) {
610
			this.tmpDirectory.delete();
611
				Util.delete(this.tmpDirectory);
612
			}
613
			this.tmpDirectory.mkdir();
614
		}
615
		return this.tmpDirectory;
616
	}
617
	void deleteTmpDirectory() {
618
		if (this.tmpDirectory != null) {
619
			Util.delete(this.tmpDirectory);
620
			this.tmpDirectory = null;
611
		}
621
		}
612
		this.tmpDirectory.mkdir();
613
	}
622
	}
614
	return this.tmpDirectory;
615
}
616
void deleteTmpDirectory() {
617
	if (this.tmpDirectory != null) {
618
		deleteDirectory(this.tmpDirectory);
619
		this.tmpDirectory = null;
620
	}
621
}
622
private void deleteDirectory(File dir) {
623
	File[] files = dir.listFiles();
624
	for (int i = 0 ; i < files.length ; i++) {
625
		if (files[i].isDirectory()) {
626
			deleteDirectory(files[i]);
627
		} else {
628
			files[i].delete();
629
		}
630
	}
631
	dir.delete();
632
}
633
623
634
	/**
624
	/**
635
	* Returns the workspace.
625
	* Returns the workspace.

Return to bug 166977