| Summary: | Sporadic ConcurrentModificationException when importing existing plugin projects | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] PDE | Reporter: | Brian de Alwis <bsd> | ||||||
| Component: | UI | Assignee: | Darin Wright <darin.eclipse> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | critical | ||||||||
| Priority: | P3 | CC: | darin.eclipse, eclipse, jcompagner, karasiuk, leo.dos.santos, nicolas.bros | ||||||
| Version: | 3.6 | ||||||||
| Target Milestone: | 3.6 M7 | ||||||||
| Hardware: | Macintosh | ||||||||
| OS: | Mac OS X | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Brian de Alwis
Created attachment 161696 [details]
Binary plugin project for LarvaLabs' Java5-enabled commons-collections variant
Importing this project (Import -> Existing Projects into Workspace) seems to reliably trigger the ConcurrentModificationException in BundleModel#load().
Possible dup of bug 302766? DJ, did you mean bug 304766? I looked into the problem. Fortunately it's a simple programming error rather than a race condition.
This problem is caused by a MANIFEST.MF header field with no value:
Implementation-Vendor-Id:
The code in BundleModel#load(InputStream,boolean) loads the MANIFEST.MF into a instance of Bundle, and then iterates over the Bundle's header, rewriting the values using Bundle.setHeader(). But Bundle.setHeader() will remove the header if the value is null or empty -- leading to the CME. (Rewriting the same header being iterated against seems risque anyways.)
The following patch fixes the problem by iterating over a copy of the Bundle's header (against org.eclipse.pde.core v20100308).
--- src/org/eclipse/pde/internal/core/bundle/BundleModel.java.orig 2010-03-11 09:54:44.000000000 -0500
+++ src/org/eclipse/pde/internal/core/bundle/BundleModel.java 2010-03-11 09:54:52.000000000 -0500
@@ -60,7 +60,7 @@
setLoaded(true);
// format headers
BundleModelFactory factory = new BundleModelFactory(this);
- Map headers = fBundle.getHeaders();
+ Map headers = new HashMap(fBundle.getHeaders());
Iterator it = headers.entrySet().iterator();
while (it.hasNext()) {
Entry entry = (Entry) it.next();
Yup, bug 304766 is a dupe: I saw the same NPEs on validation as reported by Leo after the initial CME. *** Bug 304766 has been marked as a duplicate of this bug. *** (In reply to comment #4) > I looked into the problem. Fortunately it's a simple programming error rather > than a race condition. > > This problem is caused by a MANIFEST.MF header field with no value: Same symptom, same cause. Nice find Brian! *** Bug 305845 has been marked as a duplicate of this bug. *** Looks like this was introduced by the fix to bug 303122 Created attachment 162104 [details]
alternate patch
Fixed. Please verify, Curtis. *** Bug 305969 has been marked as a duplicate of this bug. *** *** Bug 306930 has been marked as a duplicate of this bug. *** *** Bug 308560 has been marked as a duplicate of this bug. *** |