Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 181326 Details for
Bug 229042
[buildpath] could create build path error in case of invalid external JAR format
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
bug_229042.txt (text/plain), 22.21 KB, created by
Jay Arthanareeswaran
on 2010-10-20 14:24:26 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Jay Arthanareeswaran
Created:
2010-10-20 14:24:26 EDT
Size:
22.21 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/ClasspathEntry.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ClasspathEntry.java,v >retrieving revision 1.125 >diff -u -r1.125 ClasspathEntry.java >--- model/org/eclipse/jdt/internal/core/ClasspathEntry.java 7 Apr 2010 08:29:33 -0000 1.125 >+++ model/org/eclipse/jdt/internal/core/ClasspathEntry.java 20 Oct 2010 18:18:36 -0000 >@@ -2063,6 +2063,9 @@ > return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundSourceAttachment, new String [] {sourceAttachment.toString(), path.toString(), project.getElementName()})); > } > } >+ IJavaModelStatus status = validateLibraryContents(path, project, entryPathMsg); >+ if (status != JavaModelStatus.VERIFIED_OK) >+ return status; > break; > case IResource.FOLDER : // internal binary folder > if (sourceAttachment != null >@@ -2083,13 +2086,20 @@ > } else { > return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_illegalExternalFolder, new String[] {path.toOSString(), project.getElementName()})); > } >- } else if (sourceAttachment != null >- && !sourceAttachment.isEmpty() >- && JavaModel.getTarget(sourceAttachment, true) == null){ >- if (container != null) { >- return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundSourceAttachmentInContainedLibrary, new String [] {sourceAttachment.toString(), path.toOSString(), container})); >- } else { >- return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundSourceAttachment, new String [] {sourceAttachment.toString(), path.toOSString(), project.getElementName()})); >+ } else { >+ if (sourceAttachment != null >+ && !sourceAttachment.isEmpty() >+ && JavaModel.getTarget(sourceAttachment, true) == null){ >+ if (container != null) { >+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundSourceAttachmentInContainedLibrary, new String [] {sourceAttachment.toString(), path.toOSString(), container})); >+ } else { >+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind(Messages.classpath_unboundSourceAttachment, new String [] {sourceAttachment.toString(), path.toOSString(), project.getElementName()})); >+ } >+ } >+ if(file.isFile()) { >+ IJavaModelStatus status = validateLibraryContents(path, project, entryPathMsg); >+ if (status != JavaModelStatus.VERIFIED_OK) >+ return status; > } > } > } else { >@@ -2121,4 +2131,20 @@ > } > return JavaModelStatus.VERIFIED_OK; > } >+ >+ private static IJavaModelStatus validateLibraryContents(IPath path, IJavaProject project, String entryPathMsg) { >+ JavaModelManager manager = JavaModelManager.getJavaModelManager(); >+ ZipFile zip = null; >+ try { >+ zip = manager.getZipFile(path); >+ } catch (CoreException e) { >+ return new JavaModelStatus(IJavaModelStatusConstants.INVALID_CLASSPATH, Messages.bind( >+ Messages.classpath_illegalLibraryArchive, >+ new String[] {entryPathMsg, project.getElementName()})); >+ } >+ finally { >+ manager.closeZipFile(zip); >+ } >+ return JavaModelStatus.VERIFIED_OK; >+ } > } >#P org.eclipse.jdt.core.tests.builder >Index: src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core.tests.builder/src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java,v >retrieving revision 1.51 >diff -u -r1.51 BuildpathTests.java >--- src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java 9 Oct 2008 11:55:22 -0000 1.51 >+++ src/org/eclipse/jdt/core/tests/builder/BuildpathTests.java 20 Oct 2010 18:18:38 -0000 >@@ -13,6 +13,7 @@ > import junit.framework.*; > > import org.eclipse.core.resources.IMarker; >+import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.*; >@@ -25,6 +26,7 @@ > import org.eclipse.jdt.internal.core.*; > > import java.io.File; >+import java.io.FileInputStream; > import java.io.IOException; > import java.util.*; > >@@ -103,10 +105,28 @@ > } > } > >-public void testClosedProject() throws JavaModelException { >+public void testClosedProject() throws JavaModelException, IOException { > IPath project1Path = env.addProject("CP1"); //$NON-NLS-1$ >+ IProject project1 = ResourcesPlugin.getWorkspace().getRoot().getProject("CP1"); > env.addExternalJars(project1Path, Util.getJavaClassLibs()); >- IPath jarPath = env.addInternalJar(project1Path, "temp.jar", new byte[] {0}); //$NON-NLS-1$ >+ >+ String jarFile = project1.getLocation().toOSString() + File.separator + "temp.jar"; >+ >+ org.eclipse.jdt.core.tests.util.Util.createJar( >+ null, >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n", >+ }, >+ jarFile, >+ null, >+ JavaCore.VERSION_1_4); >+ >+ FileInputStream fis = new FileInputStream(jarFile); >+ int length = fis.available(); >+ byte[] jarContent = new byte[length]; >+ fis.read(jarContent); >+ IPath jarPath = env.addInternalJar(project1Path, "temp.jar", jarContent); //$NON-NLS-1$ > > IPath project2Path = env.addProject("CP2"); //$NON-NLS-1$ > env.addExternalJars(project2Path, Util.getJavaClassLibs()); >#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.69 >diff -u -r1.69 ClasspathInitializerTests.java >--- src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java 6 Oct 2010 17:32:30 -0000 1.69 >+++ src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java 20 Oct 2010 18:18:40 -0000 >@@ -10,6 +10,7 @@ > *******************************************************************************/ > package org.eclipse.jdt.core.tests.model; > >+import java.io.IOException; > import java.util.HashMap; > import java.util.Map; > >@@ -1313,7 +1314,7 @@ > * @bug 138599: [model][classpath] Need a way to mark a classpath variable as deprecated > * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=138599" > */ >-public void testVariableInitializerDeprecated() throws CoreException { >+public void testVariableInitializerDeprecated() throws CoreException, IOException { > try { > // Create initializer > String varName = "TEST_DEPRECATED"; >@@ -1326,7 +1327,10 @@ > > // Create project > IJavaProject project = createJavaProject("P1"); >- createFile("/P1/lib.jar", ""); >+ addLibrary(project, "lib.jar", null, new String[0], >+ new String[]{"META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n"} , >+ JavaCore.VERSION_1_4); > IClasspathEntry variable = JavaCore.newVariableEntry(new Path("TEST_DEPRECATED"), null, null); > IJavaModelStatus status = JavaConventions.validateClasspathEntry(project, variable, false); > assertStatus("Classpath variable 'TEST_DEPRECATED' in project 'P1' is deprecated: Test deprecated flag", status); >@@ -1367,7 +1371,7 @@ > * @bug 156226: [model][classpath] Allow classpath variable to be marked as non modifiable > * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=156226" > */ >-public void testVariableInitializerReadOnly() throws CoreException { >+public void testVariableInitializerReadOnly() throws CoreException, IOException { > try { > // Create initializer > String varName = "TEST_READ_ONLY"; >@@ -1380,7 +1384,10 @@ > > // Create project > IJavaProject project = createJavaProject("P1"); >- createFile("/P1/lib.jar", ""); >+ addLibrary(project, "lib.jar", null, new String[0], >+ new String[]{"META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n"} , >+ JavaCore.VERSION_1_4); > IClasspathEntry variable = JavaCore.newVariableEntry(new Path("TEST_READ_ONLY"), null, null); > IJavaModelStatus status = JavaConventions.validateClasspathEntry(project, variable, false); > assertStatus("OK", status); >@@ -1391,7 +1398,7 @@ > deleteProject("P1"); > } > } >-public void testVariableInitializerDeprecatedAndReadOnly() throws CoreException { >+public void testVariableInitializerDeprecatedAndReadOnly() throws CoreException, IOException { > try { > // Create initializer > String varName = "TEST_DEPRECATED_READ_ONLY"; >@@ -1405,7 +1412,10 @@ > > // Create project > IJavaProject project = createJavaProject("P1"); >- createFile("/P1/lib.jar", ""); >+ addLibrary(project, "lib.jar", null, new String[0], >+ new String[]{"META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n"} , >+ JavaCore.VERSION_1_4); > IClasspathEntry variable = JavaCore.newVariableEntry(new Path("TEST_DEPRECATED_READ_ONLY"), null, null); > IJavaModelStatus status = JavaConventions.validateClasspathEntry(project, variable, false); > assertStatus("Classpath variable 'TEST_DEPRECATED_READ_ONLY' in project 'P1' is deprecated: A deprecated and read-only initializer", status); >@@ -1422,7 +1432,7 @@ > * @bug 172207: [model] Marker for deprecated classpath variable should always have WARNING severity > * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=172207" > */ >-public void testVariableInitializerBug172207() throws CoreException { >+public void testVariableInitializerBug172207() throws CoreException, IOException { > try { > // Create initializer > String varName = "TEST_DEPRECATED_READ_ONLY"; >@@ -1436,7 +1446,10 @@ > > // Create project > IJavaProject project = createJavaProject("P1"); >- createFile("/P1/lib.jar", ""); >+ addLibrary(project, "lib.jar", null, new String[0], >+ new String[]{"META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n"} , >+ JavaCore.VERSION_1_4); > IClasspathEntry variable = JavaCore.newVariableEntry(new Path("TEST_DEPRECATED_READ_ONLY"), null, null); > IClasspathEntry[] entries = project.getRawClasspath(); > int length = entries.length; >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.218 >diff -u -r1.218 ClasspathTests.java >--- src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 11 Oct 2010 12:34:42 -0000 1.218 >+++ src/org/eclipse/jdt/core/tests/model/ClasspathTests.java 20 Oct 2010 18:18:43 -0000 >@@ -549,10 +549,18 @@ > /* > * Ensures that adding a library entry for an existing external ZIP archive doesn't generate a marker > */ >-public void testAddZIPArchive1() throws CoreException { >+public void testAddZIPArchive1() throws CoreException, IOException { > try { > IJavaProject p = createJavaProject("P"); >- createExternalFile("externalLib.abc", ""); >+ org.eclipse.jdt.core.tests.util.Util.createJar( >+ null, >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n", >+ }, >+ getExternalResourcePath("externalLib.abc"), >+ null, >+ JavaCore.VERSION_1_4); > setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path(getExternalResourcePath("externalLib.abc")), null, null)}); > assertMarkers("Unexpected markers", "", p); > } finally { >@@ -564,9 +572,17 @@ > /* > * Ensures that creating a project with a library entry for an existing external ZIP archive doesn't generate a marker > */ >-public void testAddZIPArchive2() throws CoreException { >+public void testAddZIPArchive2() throws CoreException, IOException { > try { >- createExternalFile("externalLib.abc", ""); >+ org.eclipse.jdt.core.tests.util.Util.createJar( >+ null, >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n", >+ }, >+ getExternalResourcePath("externalLib.abc"), >+ null, >+ JavaCore.VERSION_1_4); > IJavaProject p = createJavaProject("P", new String[0], new String[] {getExternalResourcePath("externalLib.abc")}, ""); > assertMarkers("Unexpected markers", "", p); > } finally { >@@ -614,13 +630,20 @@ > /* > * Ensures that creating an external ZIP archive referenced by a library entry and refreshing removes the marker > */ >-public void testAddZIPArchive5() throws CoreException { >+public void testAddZIPArchive5() throws CoreException, IOException { > try { > IJavaProject p = createJavaProject("P", new String[0], new String[] {getExternalResourcePath("externalLib.abc")}, ""); > refreshExternalArchives(p); > waitForAutoBuild(); >- >- createExternalFile("externalLib.abc", ""); >+ org.eclipse.jdt.core.tests.util.Util.createJar( >+ null, >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n", >+ }, >+ getExternalResourcePath("externalLib.abc"), >+ null, >+ JavaCore.VERSION_1_4); > refreshExternalArchives(p); > assertMarkers("Unexpected markers", "", p); > } finally { >@@ -633,13 +656,20 @@ > * Ensures that creating an external ZIP archive referenced by a library entry and refreshing after a restart > * removes the marker > */ >-public void testAddZIPArchive6() throws CoreException { >+public void testAddZIPArchive6() throws CoreException, IOException { > try { > simulateExitRestart(); > IJavaProject p = createJavaProject("P", new String[0], new String[] {getExternalResourcePath("externalLib.abc")}, ""); > refreshExternalArchives(p); >- >- createExternalFile("externalLib.abc", ""); >+ org.eclipse.jdt.core.tests.util.Util.createJar( >+ null, >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n", >+ }, >+ getExternalResourcePath("externalLib.abc"), >+ null, >+ JavaCore.VERSION_1_4); > refreshExternalArchives(p); > assertMarkers("Unexpected markers", "", p); > } finally { >@@ -651,13 +681,15 @@ > /* > * Ensures that adding a library entry for an existing internal ZIP archive doesn't generate a marker > */ >-public void testAddZIPArchive7() throws CoreException { >+public void testAddZIPArchive7() throws CoreException, IOException { > try { > IJavaProject p = createJavaProject("P"); > refreshExternalArchives(p); > waitForAutoBuild(); >- >- createFile("/P/internalLib.abc", ""); >+ addLibrary(p, "internalLib.abc", null, new String[0], >+ new String[]{"META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n"} , >+ JavaCore.VERSION_1_4); > setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("/P/internalLib.abc"), null, null)}); > assertMarkers("Unexpected markers", "", p); > } finally { >@@ -2729,7 +2761,15 @@ > String externalJarPath = getWorkspaceRoot().getLocation().append("external.jar").toOSString(); > try { > IJavaProject p = createJavaProject("P"); >- Util.writeToFile("", externalJarPath); >+ org.eclipse.jdt.core.tests.util.Util.createJar( >+ null, >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n", >+ }, >+ externalJarPath, >+ null, >+ JavaCore.VERSION_1_4); > setClasspath(p, new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("../external.jar"), null, null)}); > assertMarkers( > "Unexpected markers", >@@ -3122,8 +3162,15 @@ > waitUntilIndexesReady(); > waitForAutoBuild(); > // at this point, a marker indicates that test185733.jar has been created: "Project 'P' is missing required library: '[...]\test185733.jar'" >- >- createFile(new File(getExternalPath()), "test185733.jar", ""); >+ org.eclipse.jdt.core.tests.util.Util.createJar( >+ null, >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n", >+ }, >+ getExternalResourcePath("test185733.jar"), >+ null, >+ JavaCore.VERSION_1_4); > refreshExternalArchives(p); > assertMarkers( > "Unexpected markers", >@@ -3749,13 +3796,16 @@ > * Ensures that a marker is removed if adding an internal jar that is on the classpath in another project > * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=213723 ) > */ >-public void testFixClasspath1() throws CoreException { >+public void testFixClasspath1() throws CoreException, IOException { > try { > createProject("P1"); >- IJavaProject project = createJavaProject("P2", new String[0], new String[] {"/P1/lib.jar"}, "bin"); >+ IJavaProject project = createJavaProject("P2", new String[0], new String[0], "bin"); > waitForAutoBuild(); >- >- createFile("/P1/lib.jar", ""); >+ addLibrary(project, "lib.jar", null, new String[0], >+ new String[]{"META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n"} , >+ JavaCore.VERSION_1_4); >+ > assertMarkers( > "Unexpected markers", > "", >@@ -3769,11 +3819,19 @@ > * Ensures that a marker is removed if adding an external jar, restarting and refreshing > * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=216446 ) > */ >-public void testFixClasspath2() throws CoreException { >+public void testFixClasspath2() throws CoreException, IOException { > try { > IJavaProject p = createJavaProject("P", new String[0], new String[] {getExternalResourcePath("externalLib.abc")}, ""); > waitForAutoBuild(); // 1 marker >- createExternalFile("externalLib.abc", ""); >+ org.eclipse.jdt.core.tests.util.Util.createJar( >+ null, >+ new String[] { >+ "META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n", >+ }, >+ getExternalResourcePath("externalLib.abc"), >+ null, >+ JavaCore.VERSION_1_4); > > simulateExitRestart(); > refreshExternalArchives(p); >@@ -3939,11 +3997,15 @@ > * Ensures that a file not ending with .jar or .zip can be put on the classpath. > * (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=182360 ) > */ >-public void testInvalidInternalJar2() throws CoreException { >+public void testInvalidInternalJar2() throws CoreException, IOException { > try { >- createProject("P1"); >- createFile("/P1/existing.txt", ""); >- IJavaProject proj = createJavaProject("P2", new String[] {}, new String[] {"/P1/existing.txt"}, "bin"); >+ IJavaProject proj = createJavaProject("P1", new String[] {}, new String[0], "bin"); >+ >+ addLibrary(proj, "existing.txt", null, new String[0], >+ new String[]{"META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n"} , >+ JavaCore.VERSION_1_4); >+ proj = createJavaProject("P2", new String[] {}, new String[] {"/P1/existing.txt"}, "bin"); > assertMarkers( > "Unexpected markers", > "", >@@ -4933,12 +4995,15 @@ > * Ensures that duplicate entries due to resolution are not reported > * (regression test for https://bugs.eclipse.org/bugs/show_bug.cgi?id=175226 ) > */ >-public void testDuplicateEntries2() throws CoreException { >+public void testDuplicateEntries2() throws CoreException, IOException { > try { > IJavaProject project = createJavaProject("P"); > VariablesInitializer.setInitializer(new DefaultVariableInitializer(new String[] {"TEST_LIB", "/P/lib.jar"})); > ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P", "/P/lib.jar"})); >- createFile("/P/lib.jar", ""); >+ addLibrary(project, "lib.jar", null, new String[0], >+ new String[]{"META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n"} , >+ JavaCore.VERSION_1_4); > editFile( > "/P/.classpath", > "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + >@@ -4948,6 +5013,7 @@ > " <classpathentry kind=\"output\" path=\"bin\"/>\n" + > "</classpath>" > ); >+ waitForAutoBuild(); > assertMarkers( > "Unexpected markers", > "", >@@ -5497,13 +5563,18 @@ > /* > * Ensures that removing an internal ZIP archive referenced by a library entry creates a marker > */ >-public void testRemoveZIPArchive6() throws CoreException { >+public void testRemoveZIPArchive6() throws CoreException, IOException { > try { >- IJavaProject p = createJavaProject("P", new String[0], new String[] {"/P/internalLib.abc"}, ""); >- createFile("/P/internalLib.abc", ""); >+ IJavaProject p = createJavaProject("P", new String[0], new String[0], ""); >+ >+ addLibrary(p, "internalLib.abc", null, new String[0], >+ new String[]{"META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n"} , >+ JavaCore.VERSION_1_4); > waitForAutoBuild(); > > deleteFile("/P/internalLib.abc"); >+ waitForAutoBuild(); > assertMarkers( > "Unexpected markers", > "Project \'P\' is missing required library: \'internalLib.abc\'", >@@ -5517,12 +5588,15 @@ > * Ensures that renaming a .jar file and updating the classpath in a PRE_BUILD event doesn't leave markers > * (regression test for bug 177922 FlexibleProjectContainer refresh logic sporadically leaves project with "missing library" error on rename/delete) > */ >-public void testRenameJar() throws CoreException { >+public void testRenameJar() throws CoreException, IOException { > IResourceChangeListener listener = null; > try { >- final IJavaProject p = createJavaProject("P", new String[0], new String[] {"/P/lib/test1.jar"}, ""); >+ final IJavaProject p = createJavaProject("P", new String[0], new String[0], ""); > createFolder("/P/lib"); >- createFile("/P/lib/test1.jar", ""); >+ addLibrary(p, "lib/test1.jar", null, new String[0], >+ new String[]{"META-INF/MANIFEST.MF", >+ "Manifest-Version: 1.0\n"} , >+ JavaCore.VERSION_1_4); > // at this point no markers exist > > // register a listener that updates the classpath in a PRE_BUILD event >@@ -6813,6 +6887,25 @@ > deleteProject("ReferencedProject"); > } > } >- >+/** >+ * @bug 229042: [buildpath] could create build path error in case of invalid external JAR format >+ * >+ * Test that an invalid archive (JAR) creates a buildpath error >+ * >+ * @see "https://bugs.eclipse.org/bugs/show_bug.cgi?id=229042" >+ * @throws Exception >+ */ >+public void testBug229042() throws Exception { >+ try { >+ IJavaProject p = createJavaProject("P"); >+ createFile("/P/library.jar", ""); >+ setClasspath(p, new IClasspathEntry[] { JavaCore.newLibraryEntry(new Path("/P/library.jar"), null,null)}); >+ assertMarkers("Unexpected markers", >+ "Illegal type of archive for required library: \'library.jar\' in project \'P\'", p); >+ } finally { >+ deleteExternalResource("library.jar"); >+ deleteProject("P"); >+ } >+} > > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 229042
:
181326
|
181536
|
181618
|
181725
|
181732