Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 334715 - resolve process must fail when hook throws exception or is unregistered.
Summary: resolve process must fail when hook throws exception or is unregistered.
Status: RESOLVED FIXED
Alias: None
Product: Equinox
Classification: Eclipse Project
Component: Framework (show other bugs)
Version: 3.7   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: 3.7 M6   Edit
Assignee: Thomas Watson CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-01-18 16:45 EST by Thomas Watson CLA
Modified: 2011-02-01 16:57 EST (History)
2 users (show)

See Also:


Attachments
patch and test changes (49.53 KB, patch)
2011-02-01 16:41 EST, Thomas Watson CLA
no flags Details | Diff
patch and test changes (48.54 KB, text/plain)
2011-02-01 16:45 EST, Thomas Watson CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thomas Watson CLA 2011-01-18 16:45:51 EST
The current implementation continues with the current resolve process if a hook factory participating in the resolve process is unregistered or if a hook instance throws an exception.  In both cases the resolve process should fail and if possible an exception must be thrown to the caller which triggered the resolve process.  If the caller is not available then a framework event error must be fired.
Comment 1 Thomas Watson CLA 2011-02-01 16:41:13 EST
Created attachment 188092 [details]
patch and test changes

In order to implement this in a reasonable way I had to simplify the way we select singletons.  Previously we used a two pass resolver algorithm.  In the first pass we would treat all bundles as non-singleton and get a reference count to all singleton bundles.  Then we would try to select the version of each singleton that contained the highest reference count.  The idea was that this version would allow more bundles to resolve.  Then we would unresolve the unselected singletons from the first pass and start a second pass to resolve the bundles again.

The problem with this approach is that it uses the State to record interim decisions between the first pass and the second pass.  So if a hook throws an exception during the second pass then the State would be left in a weird state with the interim decisions about what bundles are resolved.  This patch ensures that we do not record any resolution data until the end after the final resolution decisions have been made.  This way if a hook throws an exception then the state is still intact and has not been changed.  I had to add a new ResolverHookException so I could throw this from the resolver to the state and then report the error in the StateDelta.  This was necessary because the State resolver process actually has two parts.  1) to unresolve a graph of bundles 2) to attempt to resolve the set of unresolved bundles in the state.  ResolverHooks only participate in the second part.  We need to always have a StateDelta even when a hook fails so that we can correctly reflect the unresolved bundles from step 1 in the framework.

I had to update the testcases to reflect the different singleton selection algorithm.
Comment 2 Thomas Watson CLA 2011-02-01 16:45:45 EST
Created attachment 188094 [details]
patch and test changes

previous patch contained extra changes to BundleHost unrelated to this fix.
Comment 3 Thomas Watson CLA 2011-02-01 16:57:50 EST
patch released.