Bug 417096 - [manifest][validation] Missing comma not detected after multiple optional parameters
Summary: [manifest][validation] Missing comma not detected after multiple optional par...
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.3   Edit
Hardware: PC Mac OS X
: P3 major (vote)
Target Milestone: 4.4 M2   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords: noteworthy
Depends on:
Blocks: 417544
  Show dependency tree
 
Reported: 2013-09-12 10:05 EDT by Jan Koehnlein CLA
Modified: 2013-09-18 16:22 EDT (History)
1 user (show)

See Also:


Attachments
example workspace with two projects (4.02 KB, application/zip)
2013-09-12 10:05 EDT, Jan Koehnlein CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jan Koehnlein CLA 2013-09-12 10:05:06 EDT
Created attachment 235425 [details]
example workspace with two projects

This happens in a list of entries that allow options, such as 
  bundle-version="xxx"
  resolution:=optional
etc.
When I miss a comma after a list entry with more than two such options, I don't even get a warning. Instead, the entire plug-in silently doesn't compile anymore and leads to compile errors in all dependent plug-ins. This is pretty hard to track down in a complex workspace.

The attached workspace contains two projects: 
- 'bar' depends on 'foo'.
- 'foo' is missing a comma in foo/META-INF/MANIFEST.MF.
- Nevertheless, 'foo' appears to be completely intact.
- OTOH, 'bar' has plenty of compile errors due to the error in the other plug-in.

In my case, the missing comma resulted from a git merge conflict. So this is not a very pathological example.

A missing comma is detected only if there are zero or one options on a list entry.
Comment 1 Curtis Windatt CLA 2013-09-12 12:54:36 EDT
When we ask OSGi to create a bundle description for the project, it throws a BundleException because of the bad header (duplicate attributes).  PDE hides this error and still creates a model without a bundle description (probably to support pre-OSGi plug-ins).

The BundleErrorReporter only does limited checking if no bundle description is available.

I will look at throwing the exception so it would be logged. If possible the BundleErrorReporter should report any broken headers.
Comment 2 Curtis Windatt CLA 2013-09-12 14:17:05 EDT
Fixed in master
http://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=b2962fcdb28f4ab8efccf2d588cf099d4a2a37de

We now log the BundleException (just the message, not a full stack trace).  This can pollute the log a bit if you have a broken manifest and keep restarting or modifying the plug-in.  I think this is acceptable over silently failing.

If no bundle description was created, the error reporter attempts to create one again to replicate the BundleException. While it would be smarter to save some sort of error state on the model, there isn't time to make such a major change. If there is some other way to validate the manifest headers we could do that instead, but as far as I know the only other validation is jar manifest syntax which we already check.
Comment 3 Jan Koehnlein CLA 2013-09-12 14:20:30 EDT
Just for clarification: Will that also cause an error marker on the MANIFEST.MF or just a log message?
Comment 4 Curtis Windatt CLA 2013-09-12 14:38:54 EDT
(In reply to Jan Koehnlein from comment #3)
> Just for clarification: Will that also cause an error marker on the
> MANIFEST.MF or just a log message?

Both. When the model state fails to create a bundle description, the error is logged.  When the PDE Builder (Bundle error reporter) runs and sees that no bundle description exists, it tries to create a bundle description and creates an error marker from the message.
Comment 5 Jan Koehnlein CLA 2013-09-13 03:32:04 EDT
Great. Thanks a lot!