Lines 13-18
Link Here
|
13 |
import java.io.ByteArrayInputStream; |
13 |
import java.io.ByteArrayInputStream; |
14 |
import java.io.File; |
14 |
import java.io.File; |
15 |
import java.io.FileOutputStream; |
15 |
import java.io.FileOutputStream; |
|
|
16 |
import java.io.FilenameFilter; |
16 |
import java.io.IOException; |
17 |
import java.io.IOException; |
17 |
import java.util.Hashtable; |
18 |
import java.util.Hashtable; |
18 |
import java.util.Map; |
19 |
import java.util.Map; |
Lines 89-95
Link Here
|
89 |
static { |
90 |
static { |
90 |
// Names of tests to run: can be "testBugXXXX" or "BugXXXX") |
91 |
// Names of tests to run: can be "testBugXXXX" or "BugXXXX") |
91 |
// TESTS_PREFIX = "testClasspathDuplicateExtraAttribute"; |
92 |
// TESTS_PREFIX = "testClasspathDuplicateExtraAttribute"; |
92 |
// TESTS_NAMES = new String[] {"testClasspathValidation42"}; |
93 |
TESTS_NAMES = new String[] {"testBug335986"}; |
93 |
// TESTS_NUMBERS = new int[] { 23, 28, 38 }; |
94 |
// TESTS_NUMBERS = new int[] { 23, 28, 38 }; |
94 |
// TESTS_RANGE = new int[] { 21, 38 }; |
95 |
// TESTS_RANGE = new int[] { 21, 38 }; |
95 |
} |
96 |
} |
Lines 6747-6751
Link Here
|
6747 |
ContainerInitializer.setInitializer(null); |
6748 |
ContainerInitializer.setInitializer(null); |
6748 |
} |
6749 |
} |
6749 |
} |
6750 |
} |
|
|
6751 |
public void testBug335986() throws Exception { |
6752 |
try { |
6753 |
final IJavaProject p = this.createJavaProject("P", new String[] {}, "bin"); |
6754 |
createFolder("/P/lib"); |
6755 |
final File libFolder = new File(p.getProject().getLocation().append("lib").toOSString()); |
6756 |
addLibrary(p, "lib/lib_a.jar", null, new String[0], |
6757 |
new String[] { |
6758 |
"META-INF/MANIFEST.MF", |
6759 |
"Manifest-Version: 1.0\n" + |
6760 |
"Class-Path: \n", |
6761 |
}, |
6762 |
JavaCore.VERSION_1_4); |
6763 |
|
6764 |
class WebContainer extends DefaultContainerInitializer.DefaultContainer { |
6765 |
File libraryFolder; |
6766 |
public WebContainer(char[][] libPaths) { |
6767 |
super(libPaths); |
6768 |
this.libPaths = libPaths; |
6769 |
} |
6770 |
public IClasspathEntry[] getClasspathEntries() { |
6771 |
this.libraryFolder = new File(ResourcesPlugin.getWorkspace().getRoot().getProject("P").getLocation().append("lib").toOSString()); |
6772 |
if (this.libraryFolder.exists()) { |
6773 |
String[] jars = this.libraryFolder.list(new FilenameFilter() { |
6774 |
public boolean accept(File dir, String name) { |
6775 |
if (name.endsWith("jar")) |
6776 |
return true; |
6777 |
return false; |
6778 |
} |
6779 |
}); |
6780 |
IClasspathEntry[] classpath = new IClasspathEntry[jars.length]; |
6781 |
for (int i=0; i < jars.length; i++) { |
6782 |
classpath[i] = JavaCore.newLibraryEntry(new Path("/P/lib").append(jars[i]), null, null, true); |
6783 |
} |
6784 |
return classpath; |
6785 |
} |
6786 |
return new IClasspathEntry[0]; |
6787 |
} |
6788 |
} |
6789 |
IClasspathEntry[] classpath = new IClasspathEntry[1]; |
6790 |
ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P", ""}) { |
6791 |
protected DefaultContainerInitializer.DefaultContainer newContainer(final char[][] libPaths) { |
6792 |
return new WebContainer(libPaths); |
6793 |
} |
6794 |
} |
6795 |
); |
6796 |
classpath[0] = JavaCore.newContainerEntry(new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER")); |
6797 |
setClasspath(p, classpath); |
6798 |
startDeltas(); |
6799 |
File jarFile = new File(libFolder, "lib_a.jar"); |
6800 |
jarFile.delete(); |
6801 |
p.getProject().refreshLocal(IResource.DEPTH_INFINITE, null); |
6802 |
assertDeltas("Unexpected delta", |
6803 |
"P[*]: {CHILDREN | CONTENT | RESOLVED CLASSPATH CHANGED}\n" + |
6804 |
" lib/lib_a.jar[*]: {REMOVED FROM CLASSPATH}", false); |
6805 |
|
6806 |
} finally { |
6807 |
deleteProject("P"); |
6808 |
ContainerInitializer.setInitializer(null); |
6809 |
} |
6810 |
} |
6750 |
|
6811 |
|
6751 |
} |
6812 |
} |