Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 251970 - [ds tooling] "Hello OSGi Declarative Services" template generates invalid MANIFEST.MF
Summary: [ds tooling] "Hello OSGi Declarative Services" template generates invalid MAN...
Status: RESOLVED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5 M3   Edit
Assignee: Chris Aniszczyk CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-24 03:19 EDT by Jacek Pospychala CLA
Modified: 2008-10-24 10:59 EDT (History)
1 user (show)

See Also:


Attachments
patch (2.16 KB, patch)
2008-10-24 03:55 EDT, Jacek Pospychala CLA
caniszczyk: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jacek Pospychala CLA 2008-10-24 03:19:14 EDT
Build-ID: N20081020-2000

Manifest generated from "Hello OSGi Declarative Services" contains following header:

Import-Package: org.eclipse.osgi.framework.console;version="1.0.0";version="0.0.0",
org.osgi.framework;version="1.3.0";version="0.0.0"

Whereas it should be:

Import-Package: org.eclipse.osgi.framework.console;version="1.0.0",
 org.osgi.framework;version="1.3.0"


Note two problems here:
1. excesive 'version="1.0.0"' string for every imported package
-> as a result dependencies are unresolved (errors in code)
2. missing white space at the beginning of header second line
-> as a result Manifest has error "':' is required after the header name"
Comment 1 Jacek Pospychala CLA 2008-10-24 03:23:19 EDT
ok, the problem occurs for other templates as well, e.g. OSGi Service template produces following header:

Import-Package: org.osgi.framework;version="1.3.0";version="0.0.0",
org.osgi.util.tracker;version="1.3.1";version="0.0.0"
Comment 2 Jacek Pospychala CLA 2008-10-24 03:38:01 EDT
It's caused by patch to bug 247553

NewProjectCreationOperation.getCommaValuesFromPackagesSet(Set package, String version)

is often passed following packages set:

'org.eclipse.osgi.framework.console;version="1.0.0"' 

so with "version=..." attached.

I imagine that when version argument is null, method could don't add the "version=1.0.0" part.

 
Comment 3 Jacek Pospychala CLA 2008-10-24 03:55:35 EDT
Created attachment 116021 [details]
patch

I'm not quite sure why the version argument to the method is used only if there's only one package exported and not more, but am assuming this is according to bug 247553.
I don't see any advantage of generating version=0.0.0 over leaving no version specified.

This patch makes that if version argument is set to null or there's more than one package, nothing is generated.
It also adds a space in the subsequent lines of Export-Package header. 

Ben, please review this patch. Won't it break fix for bug 247553?
Comment 4 Chris Aniszczyk CLA 2008-10-24 10:49:08 EDT
Correct, no version implies 0.0.0 by default.
Comment 5 Chris Aniszczyk CLA 2008-10-24 10:49:27 EDT
Good catch Jacek.
Comment 6 Benjamin Cabé CLA 2008-10-24 10:55:12 EDT
Sorry for the delay
I'm fine with the patch except that we should change

+	 * If there's only one package and version is not null, package is exported with that version number. 

into 

+	 * If there's only one package and version is not null, package is flagged with that version number. 

because it reflects better what really happens
Comment 7 Benjamin Cabé CLA 2008-10-24 10:59:44 EDT
About the need to add a space after the "\n", this may be related to another bug, i'im investigating (because it works just well for export-package entries when creating a new plug-in, it should just work the same way for import-package entries)