This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 80702 - ISE: "Should have found a provider of: ..." from ModuleManager.maybeAddToEnableList
Summary: ISE: "Should have found a provider of: ..." from ModuleManager.maybeAddToEnab...
Status: RESOLVED FIXED
Alias: None
Product: platform
Classification: Unclassified
Component: Module System (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jesse Glick
URL:
Keywords:
Depends on:
Blocks: 34699
  Show dependency tree
 
Reported: 2006-07-20 10:18 UTC by Jesse Glick
Modified: 2008-12-23 08:40 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Log file (3.32 KB, text/plain)
2006-07-20 10:19 UTC, Jesse Glick
Details
Proposed patch (14.28 KB, patch)
2006-11-21 00:29 UTC, Jesse Glick
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jesse Glick 2006-07-20 10:18:27 UTC
Encountered while testing a suite (built against a dev build) which had a dep on
projectuiapi but did not include projectui. Fixed by adding to a suite module

OpenIDE-Module-Provides:
org.netbeans.modules.project.uiapi.ProjectChooserFactory,
org.netbeans.modules.project.uiapi.ActionsFactory,
org.netbeans.modules.project.uiapi.OpenProjectsTrampoline

but the module system should have reported this as an inability to turn on the
suite module + projectuiapi, not an ISE.
Comment 1 Jesse Glick 2006-07-20 10:19:48 UTC
Created attachment 32036 [details]
Log file
Comment 2 Jaroslav Tulach 2006-08-07 12:14:35 UTC
I need help, Jesse, I do not know where to put the warning. I have just 
written:

core/startup/test/unit/src/org/netbeans/core/startup/ModuleManagerTest.java,v  
<--  ModuleManagerTest.java
new revision: 1.9; previous revision: 1.8

and it shows that all the pieces seem to work fine. However when I call:

moduleSystem = new ModuleSystem(rep);
moduleSystem.loadBootModules();
moduleSystem.readList();
moduleSystem.restore();

then the exception is thrown. I am not sure where I should put the check. 
Please identify such place.
Comment 3 Jesse Glick 2006-11-21 00:27:11 UTC
I can still reproduce by making a suite which includes all of platform cluster,
and all of ide cluster except projectui, and running. I have changed the failure
message a bit to be an assertion error. Still do not know how to reproduce in a
unit test; I suspect a rather complicated setup is needed.

What I have found so far from debugging:

1. maybeAddToEnableList is called with m = projectuiapi.

2. missingDependencies(m).isEmpty() incorrectly returns true, so the rest of the
method is run. It should not.

3. _missingDependencies(projectuiapi,check) is incorrectly returning an empty
set since that is a cached value.

4. The cached empty set value was placed in moduleProblems earlier, as a result
of a deeply (~4x) nested call to _mD on projectuiapi (from java/project, from
i18n, from i18n/form).

5. The original caching call to _mD on projectuiapi was passed a long
nonOrderingCheck list; I do not understand the purpose of passing the same list
from one call to a recursively nested call, but that is what happened.

Besides the difficulty in coming up with a unit test, I had a hard time doing
anything with this because I do not really follow the intended logic of the
mD/_mD section of your original patch for #34699, which causes this problem. It
seems to be flawed; mD(projectuiapi) should be nonempty if projectui does not
exist. Another point is that mD pays attention to OpenIDE-Module-Recommends even
though this cannot ever affect the correct result.

I will attach a proposed rewrite for you to review. It tries to follow the
original style of mD a bit more, but with two parallel passes: one which ignores
OIDE-M-Needs entirely and (as in the original code) rejects cycles; and one
which looks at OIDE-M-Needs (treating like OIDE-M-Requires) and accepts cycles.
Seems to pass the unit tests we have, and also behaves correctly with the
projectui example (correctly reports projectuiapi as impossible to enable due to
lack of appropriate tokens). Whether it is really correct, I am not sure.

I had some problems with your doRecommendsWithAProviderWithoutAProvider:

1. It has a recommends parameter which it does not use. I do not understand well
enough what you were trying to test to see what should be parametrized.

2. It claimed that for

M1: prov 'foo', needs 'bla'
M2: recom 'foo'

that simulateEnable(M2) should be {}. But it should be {M2}. When corrected, the
test passes.

Note that there are two assertion errors in mATEL:

1. providers == null, dep != RECOM: this is what was thrown in the projectui
example.

2. !foundOne, dep != RECOM: this has also been thrown sometimes (for myself as
well as for other people - reported on mailing lists), but I have not been able
to reproduce.

Probably both failures share the same cause, but I am not sure.
Comment 4 Jesse Glick 2006-11-21 00:29:13 UTC
Created attachment 36152 [details]
Proposed patch
Comment 5 Jesse Glick 2006-12-05 20:31:25 UTC
I guess you have no comment, so I will apply the patch. Seems to have fixed
another occurence of this exception:

[BEFORE]

java.lang.AssertionError: Should have found a nonproblematic provider of
recommends org.netbeans.spi.lexer.LanguageProvider among [......]
	at org.netbeans.ModuleManager.maybeAddToEnableList(ModuleManager.java:1109)
	at org.netbeans.ModuleManager.maybeAddToEnableList(ModuleManager.java:1072)
	at org.netbeans.ModuleManager.maybeAddToEnableList(ModuleManager.java:1072)
	at org.netbeans.ModuleManager.maybeAddToEnableList(ModuleManager.java:1072)
	at org.netbeans.ModuleManager.simulateEnable(ModuleManager.java:1024)
	at org.netbeans.core.startup.ModuleList.installNew(ModuleList.java:354)
[...]


[AFTER]

Warning - could not install some modules:
	Java Source Debug - The module Experimental Editor Highlights was requested in
implementation version "061203" but only "061205" was found.
	Java Hints - The module Java Editor was requested in implementation version
"061203" but only "061205" was found.
	JPDA Debugger UI - None of the modules providing the capability
org.netbeans.api.debugger.jpda.JPDADebuggerEngineImpl could be installed.WARNING
[org.netbeans.core.modules]: the module org.openide.text uses
org.openide.options which is deprecated: Use org.openide.util.NbPreferences instead.
Comment 6 Jesse Glick 2006-12-05 20:34:32 UTC
Checking in startup/test/unit/src/org/netbeans/core/startup/ModuleManagerTest.java;
/shared/data/ccvs/repository/core/startup/test/unit/src/org/netbeans/core/startup/ModuleManagerTest.java,v
 <--  ModuleManagerTest.java
new revision: 1.12; previous revision: 1.11
done
Checking in bootstrap/src/org/netbeans/ModuleManager.java;
/shared/data/ccvs/repository/core/bootstrap/src/org/netbeans/ModuleManager.java,v
 <--  ModuleManager.java
new revision: 1.21; previous revision: 1.20
done