Issue Details (XML | Word | Printable)

Key: OSGI-440
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Costin Leau
Reporter: Gerd Wütherich
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
Spring OSGi

Erroneous implementation in org.springframework.osgi.io.internal.resolver.PackageAdminResolver

Created: 16/Apr/08 03:58 PM   Updated: 17/Apr/08 10:12 AM
Component/s: CORE
Affects Version/s: 1.1 M1
Fix Version/s: 1.1 M2

Time Tracking:
Not Specified


 Description  « Hide
Hey Costin,

I think the implementation of the method getImportedBundles() in class PackageAdminresolver is erroneous. In line 77 you retrieve the index of the second " in the definition of a required Bundle:

int secondQuoteIndex = entry.indexOf("\"", firstQuoteIndex);

The statement has to be
int secondQuoteIndex = entry.indexOf("\"", firstQuoteIndex + 1);

Otherwise secondQuoteIndex == firstQuoteIndex and version will always be "" !

The statement in line 81 is also erroneous:

Bundle requiredBundle = pa.getBundles(entries[i], version)[0];

The first parameter of pa.getBundle() must be the symbolic name of the required bundle. if entries[i] contains a version number (e.g. org.springframework.bundle.osgi.web;bundle-version="1.1.0"), the string has to be splitted so that only the symbolic name is set as the first parameter. In your code the whole string is set as the symbolic name (including the bundle-version directive).



 All   Comments   Work Log   Change History   FishEye   Related Builds      Sort Order: Ascending order - Click to sort in descending order
Costin Leau added a comment - 17/Apr/08 10:12 AM
Thanks Gerd. That piece of code was not considering all the cases so I've refactored and test it to handle not just versions but also ranges.