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 200500 - ProjectOpenedHookImpl run twice
Summary: ProjectOpenedHookImpl run twice
Status: RESOLVED DUPLICATE of bug 224137
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 7.1
Hardware: PC Linux
: P4 normal (vote)
Assignee: Milos Kleint
URL:
Keywords: PERFORMANCE
Depends on: 200711 201617
Blocks:
  Show dependency tree
 
Reported: 2011-07-28 22:17 UTC by Jesse Glick
Modified: 2013-01-14 09:58 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Functional workaround, but requires an API change (2.83 KB, patch)
2011-08-05 19:48 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 2011-07-28 22:17:45 UTC
Perhaps in project lookup twice as a result of a bad lookup merger? Potentially inefficient.
Comment 1 Jesse Glick 2011-08-05 17:45:10 UTC
core-main #d90c6e4868ea has a temporary solution, but there is a deeper underlying problem in how LookupMerger works.
Comment 2 Jesse Glick 2011-08-05 19:25:56 UTC
A safer workaround would be to avoid nesting cCL to begin with:

diff --git a/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java b/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java
--- a/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java
+++ b/maven/src/org/netbeans/modules/maven/NbMavenProjectImpl.java
@@ -871,7 +871,7 @@
             }
             if (!newPackaging.equals(packaging)) {
                 packaging = newPackaging;
-                setLookups(LookupProviderSupport.createCompositeLookup(lookup, "Projects/org-netbeans-modules-maven/" + packaging + "/Lookup"));
+                setLookups(lookup, Lookups.forPath("Projects/org-netbeans-modules-maven/" + packaging + "/Lookup"));
             }
         }
 
but this causes a test failure for unknown reasons:

junit.framework.AssertionFailedError: null expected:<[base[, jar]]> but was:<[base[]]>
	at org.netbeans.modules.maven.NbMavenProjectImplTest.assertLookupObject(NbMavenProjectImplTest.java:95)
	at org.netbeans.modules.maven.NbMavenProjectImplTest.testPackagingTypeSpecificLookup(NbMavenProjectImplTest.java:77)
Comment 3 Jesse Glick 2011-08-05 19:48:20 UTC
Created attachment 109823 [details]
Functional workaround, but requires an API change

The simple patch does not work because DelegatingLookupImpl checks only the providerLookup, not baseLookup, for LookupProvider's and MetaLookupMerger's.

Alternate API change would be to allow the caller to pass an arbitrary providerLookup (rather than just a SFS path), though in this case it must be clearly documented what items are allowed in each lookup: only LP and MLM in pL, none of those in bL.

It might also work to supply DLI with a single lookup, whereby providerResult and metaMergers are retrieved as now (deleting isAllJustLookupProviders), and baseLookup is computed using Lookups.exclude.
Comment 4 Quality Engineering 2011-08-06 14:00:29 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/d90c6e4868ea
User: Jesse Glick <jglick@netbeans.org>
Log: Temporary solution for #200500 (project open hook run twice).
Comment 5 Jesse Glick 2011-10-12 20:30:26 UTC
Had to back out fix.
Comment 6 Quality Engineering 2011-10-14 15:06:55 UTC
Integrated into 'main-golden'
Changeset: http://hg.netbeans.org/main-golden/rev/a1e1ee18d049
User: Jesse Glick <jglick@netbeans.org>
Log: #201617: IllegalArgumentException: Attempt to remove nonexistent path C:\Program Files\Java\jdk1.7.0\jre\lib\resources.jar;C:\Program Files\Java\jdk1.7.0\jre\lib\rt.jar;C:\Program Files\Java\jdk1.7.0\jre\lib\s
Backing out fix of bug #200500 which seems to have introduced regressions.
Comment 7 Milos Kleint 2013-01-14 09:58:28 UTC

*** This bug has been marked as a duplicate of bug 224137 ***