Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 337219

Summary: Metatype Impl failing CT due to recent change in Bundle Wiring API
Product: [Eclipse Project] Equinox Reporter: John Ross <jwross>
Component: CompendiumAssignee: John Ross <jwross>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: tjwatson
Version: unspecified   
Target Milestone: 3.7 M6   
Hardware: All   
OS: All   
Whiteboard:
Bug Depends on: 334582    
Bug Blocks:    
Attachments:
Description Flags
initial patch
none
Updated patch using BundleWiring findEntries and listResources
none
Corrected updated patch using only findEntries
none
Corrected complete patch using only findEntries tjwatson: iplog+

Description John Ross CLA 2011-02-15 09:52:10 EST
Build Identifier: 

The Metatype Service implementation is currently failing the CT due to a recent change in the Bundle Wiring API where the getFragmentRevisions() method was removed. This needs to be fixed and the RI updated.

java.lang.NoSuchMethodError: org.osgi.framework.wiring.BundleWiring.getFragmentRevisions()Ljava/util/List;
at org.eclipse.equinox.metatype.FragmentUtils.findEntryPaths(FragmentUtils.java:42)
at org.eclipse.equinox.metatype.MetaTypeProviderImpl.readMetaFiles(MetaTypeProviderImpl.java:88)
at org.eclipse.equinox.metatype.MetaTypeProviderImpl.<init>(MetaTypeProviderImpl.java:56)
at org.eclipse.equinox.metatype.MetaTypeInformationImpl.<init>(MetaTypeInformationImpl.java:36)
at org.eclipse.equinox.metatype.MetaTypeServiceImpl$1.run(MetaTypeServiceImpl.java:76)
at org.eclipse.equinox.metatype.MetaTypeServiceImpl$1.run(MetaTypeServiceImpl.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.equinox.metatype.MetaTypeServiceImpl.getMetaTypeProvider(MetaTypeServiceImpl.java:74)
at org.eclipse.equinox.metatype.MetaTypeServiceImpl.getMetaTypeInformation(MetaTypeServiceImpl.java:52)
at org.osgi.test.cases.metatype.junit.AdMinOnlyTest.setUp(AdMinOnlyTest.java:130)
at junit.framework.TestCase.runBare(TestCase.java:128)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at aQute.junit.Activator.test(Activator.java:200)
at aQute.junit.Activator.automatic(Activator.java:97)
at aQute.junit.Activator.run(Activator.java:47)


Reproducible: Always
Comment 1 Thomas Watson CLA 2011-02-15 09:58:09 EST
Created attachment 189007 [details]
initial patch

Here is a quick patch that migrates to using BundleWire objects from the osgi.wiring.host namespace to discover fragment revisions.  I think we should consider changing the code to using BundleWiring.findEntries instead.
Comment 2 John Ross CLA 2011-02-15 13:23:16 EST
Created attachment 189030 [details]
Updated patch using BundleWiring findEntries and listResources

Here is an updated patch that uses BundleWiring.findEntries and listResources. Tested against the CT.
Comment 3 John Ross CLA 2011-02-15 16:20:17 EST
Created attachment 189045 [details]
Corrected updated patch using only findEntries

We don't want classpath scanning.
Comment 4 Thomas Watson CLA 2011-02-16 09:58:41 EST
(In reply to comment #3)
> Created attachment 189045 [details]
> Corrected updated patch using only findEntries
> 
> We don't want classpath scanning.

Is this the complete patch.  When applied to head I get a compile error in 

org.eclipse.equinox.metatype.MetaTypeProviderImpl.readMetaFiles(Bundle, SAXParserFactory)

To a call to the old FragmentUtils.findEntryPaths method.
Comment 5 John Ross CLA 2011-02-16 10:24:21 EST
Created attachment 189105 [details]
Corrected complete patch using only findEntries

The previous patch only included FragmentUtils changes. Needed the MetatypeProviderImpl changes as well.
Comment 6 Thomas Watson CLA 2011-02-16 16:09:04 EST
I released the patch.