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 101642 - user will manually have to remove unused references
Summary: user will manually have to remove unused references
Status: VERIFIED FIXED
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: _ edwingo
URL:
Keywords:
Depends on: 100114 110040
Blocks:
  Show dependency tree
 
Reported: 2007-04-18 19:12 UTC by sjangity
Modified: 2007-10-10 22:28 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Source File Error page shown on simple use case (146.58 KB, application/octet-stream)
2007-04-18 19:17 UTC, sjangity
Details
Creator Project with complib (7.78 MB, application/x-compressed)
2007-07-11 07:17 UTC, Yousuf Haider
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sjangity 2007-04-18 19:12:46 UTC
NB 6 4/17 - VWP 070418_4

http://visualweb.netbeans.org/source/browse/visualweb/www/qe/nb60/System_Testing/test_specs/projectmigration/data/Creator2U1ComplibProjectv2.zip
1. Import the above project into NB 6
> Observe the Source File Error page shown

Note: This is a simple Creator 2 Update 1 project making use of the poweredby
complibs.

Will attach several screenshots.
Comment 1 sjangity 2007-04-18 19:14:29 UTC
The following exception was shown in the pop-up dialog:

java.lang.NullPointerException
	at org.netbeans.core.output2.AbstractLines.addListener(AbstractLines.java:512)
	at org.netbeans.core.output2.OutWriter.println(OutWriter.java:513)
	at org.netbeans.core.output2.OutWriter.println(OutWriter.java:502)
	at org.netbeans.core.output2.NbWriter.println(NbWriter.java:46)
	at org.netbeans.modules.visualweb.insync.Util.displayError(Util.java:1356)
	at
org.netbeans.modules.visualweb.insync.Util.displayErrorForFileObject(Util.java:1337)
	at
org.netbeans.modules.visualweb.insync.InSyncServiceProvider$RaveErrorHandlerImpl.displayErrorForFileObject(InSyncServiceProvider.java:599)
	at
org.netbeans.modules.visualweb.insync.InSyncServiceProvider$RaveErrorHandlerImpl.displayError(InSyncServiceProvider.java:561)
	at org.netbeans.modules.visualweb.insync.ModelSet.showSyncErrors(ModelSet.java:759)
	at org.netbeans.modules.visualweb.insync.ModelSet.syncAll(ModelSet.java:738)
	at
org.netbeans.modules.visualweb.insync.models.FacesModelSet.syncAll(FacesModelSet.java:1300)
	at
org.netbeans.modules.visualweb.insync.models.FacesModelSet.<init>(FacesModelSet.java:331)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
	at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
	at org.netbeans.modules.visualweb.insync.ModelSet.getInstance(ModelSet.java:344)
	at org.netbeans.modules.visualweb.insync.ModelSet.getInstance(ModelSet.java:317)
	at org.netbeans.modules.visualweb.insync.Model.getInstance(Model.java:66)
	at
org.netbeans.modules.visualweb.insync.models.FacesModel.getInstance(FacesModel.java:157)
	at
org.netbeans.modules.visualweb.designer.jsf.JsfForm.getFacesModel(JsfForm.java:192)
	at
org.netbeans.modules.visualweb.designer.jsf.JsfForm.getFacesModel(JsfForm.java:200)
	at org.netbeans.modules.visualweb.designer.jsf.JsfForm.getJsfForm(JsfForm.java:208)
	at
org.netbeans.modules.visualweb.designer.jsf.DesignerJsfServiceImpl.createDesignerMultiViewElement(DesignerJsfServiceImpl.java:48)
	at
org.netbeans.modules.visualweb.project.jsfloader.JsfJavaEditorSupport$DesignerDesc.createElement(JsfJavaEditorSupport.java:514)
	at
org.netbeans.core.multiview.MultiViewModel.getElementForDescription(MultiViewModel.java:191)
	at
org.netbeans.core.multiview.MultiViewModel.getActiveElement(MultiViewModel.java:111)
	at
org.netbeans.core.multiview.MultiViewModel.getActiveElement(MultiViewModel.java:107)
	at
org.netbeans.core.multiview.MultiViewPeer.showCurrentElement(MultiViewPeer.java:242)
	at
org.netbeans.core.multiview.MultiViewPeer.peerComponentOpened(MultiViewPeer.java:210)
	at
org.netbeans.core.multiview.MultiViewCloneableTopComponent.componentOpened(MultiViewCloneableTopComponent.java:132)
	at org.openide.windows.WindowManager.componentOpenNotify(WindowManager.java:280)
	at
org.netbeans.core.windows.WindowManagerImpl.notifyTopComponentOpened(WindowManagerImpl.java:955)
	at org.netbeans.core.windows.Central.addModeOpenedTopComponent(Central.java:719)
	at org.netbeans.core.windows.ModeImpl.addOpenedTopComponent(ModeImpl.java:273)
	at
org.netbeans.core.windows.WindowManagerImpl.topComponentOpenAtTabPosition(WindowManagerImpl.java:1060)
	at
org.netbeans.core.windows.WindowManagerImpl.topComponentOpen(WindowManagerImpl.java:1028)
	at org.openide.windows.TopComponent.open(TopComponent.java:354)
	at org.openide.windows.TopComponent.open(TopComponent.java:345)
	at
org.openide.windows.CloneableOpenSupport.openCloneableTopComponent(CloneableOpenSupport.java:177)
	at
org.netbeans.modules.visualweb.project.jsfloader.JsfJavaEditorSupport.doOpenDesigner(JsfJavaEditorSupport.java:140)
	at
org.netbeans.modules.visualweb.project.jsfloader.JsfJspEditorSupport$JspEditorTopComponent.open(JsfJspEditorSupport.java:377)
	at org.openide.windows.TopComponent.open(TopComponent.java:345)
	at
org.openide.windows.CloneableOpenSupport.openCloneableTopComponent(CloneableOpenSupport.java:177)
	at org.openide.windows.CloneableOpenSupport$1.run(CloneableOpenSupport.java:76)
	at org.openide.util.Mutex.doEvent(Mutex.java:1181)
	at org.openide.util.Mutex.writeAccess(Mutex.java:376)
	at org.openide.windows.CloneableOpenSupport.open(CloneableOpenSupport.java:73)
	at org.openide.text.CloneableEditorSupport.open(CloneableEditorSupport.java:403)
	at
org.netbeans.modules.visualweb.project.jsfloader.JsfJspDataObject$OpenEdit.edit(JsfJspDataObject.java:175)
	at
org.netbeans.modules.project.ui.ProjectUtilities$1.open(ProjectUtilities.java:87)
	at
org.netbeans.modules.project.ui.ProjectUtilities.openProjectFiles(ProjectUtilities.java:495)
	at org.netbeans.modules.project.ui.OpenProjectList$5.run(OpenProjectList.java:688)
	at org.netbeans.modules.project.ui.OpenProjectList$5.run(OpenProjectList.java:686)
	at org.openide.util.Mutex$1AWTWorker.run(Mutex.java:1216)
[catch] at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:177)
	at java.awt.Dialog$1.run(Dialog.java:1039)
	at java.awt.Dialog$3.run(Dialog.java:1091)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.awt.Dialog.show(Dialog.java:1089)
	at org.netbeans.core.windows.services.NbPresenter.superShow(NbPresenter.java:812)
	at org.netbeans.core.windows.services.NbPresenter.doShow(NbPresenter.java:846)
	at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:834)
	at org.netbeans.core.windows.services.NbPresenter.run(NbPresenter.java:82)
	at org.openide.util.Mutex.doEventAccess(Mutex.java:1201)
	at org.openide.util.Mutex.readAccess(Mutex.java:220)
	at org.netbeans.core.windows.services.NbPresenter.show(NbPresenter.java:819)
	at java.awt.Component.show(Component.java:1419)
	at java.awt.Component.setVisible(Component.java:1372)
	at java.awt.Window.setVisible(Window.java:801)
	at java.awt.Dialog.setVisible(Dialog.java:979)
	at
org.netbeans.spi.java.project.support.ui.BrokenReferencesSupport$1.run(BrokenReferencesSupport.java:166)
	at
org.netbeans.spi.java.project.support.ui.BrokenReferencesSupport$2.run(BrokenReferencesSupport.java:179)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
	at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:177)
	at java.awt.Dialog$1.run(Dialog.java:1039)
	at java.awt.Dialog$3.run(Dialog.java:1091)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.awt.Dialog.show(Dialog.java:1089)
	at java.awt.Component.show(Component.java:1419)
	at java.awt.Component.setVisible(Component.java:1372)
	at java.awt.Window.setVisible(Window.java:801)
	at java.awt.Dialog.setVisible(Dialog.java:979)
	at org.netbeans.modules.project.ui.OpenProjectList.open(OpenProjectList.java:253)
	at
org.netbeans.modules.project.ui.actions.OpenProject.actionPerformed(OpenProject.java:113)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
	at javax.swing.AbstractButton.doClick(AbstractButton.java:357)
	at javax.swing.plaf.basic.BasicMenuItemUI.doClick(BasicMenuItemUI.java:1216)
	at
javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(BasicMenuItemUI.java:1257)
	at java.awt.Component.processMouseEvent(Component.java:6038)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3260)
	at java.awt.Component.processEvent(Component.java:5803)
	at java.awt.Container.processEvent(Container.java:2058)
	at java.awt.Component.dispatchEventImpl(Component.java:4410)
	at java.awt.Container.dispatchEventImpl(Container.java:2116)
	at java.awt.Component.dispatchEvent(Component.java:4240)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4322)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3986)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3916)
	at java.awt.Container.dispatchEventImpl(Container.java:2102)
	at java.awt.Window.dispatchEventImpl(Window.java:2429)
	at java.awt.Component.dispatchEvent(Component.java:4240)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
	at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
	at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Comment 2 sjangity 2007-04-18 19:17:56 UTC
Created attachment 41191 [details]
Source File Error page shown on simple use case
Comment 3 _ edwingo 2007-04-20 03:36:49 UTC
When I try the project, I see a problem with "unresolved references", but I
don't get the File Error Page in your attachment. Could you provide more details
on how to reproduce the File Error Page and exception?

The "unresolved references" problem is not easily solved because of a NetBeans
limitation. I asked on nbdev. At least not right now. I could add a workaround
but it may negatively affect performance. The NB limitation may be fixed in the
future. The user workaround is to manually use Project->Properties and delete
the unresolved references.
Comment 4 _ edwingo 2007-04-24 00:37:15 UTC
As I wrote in my earlier comment, the provided project will work in NB6.
However, the UI shows an unresolved references warning which can be ignored and
the project will work. If you want to remove the warning, the workaround is to
manually use Project->Properties and remove any unresolved Library References
from the "Libraries" and "Packaging" nodes. So I am downgrading this to P2.
Fixing this is dependent on a NetBeans API that Po-Ting tells me will be
provided in the future.
Comment 5 _ edwingo 2007-04-24 00:39:14 UTC
As I wrote in my earlier comment, the provided project will work in NB6.
However, the UI shows an unresolved references warning which can be ignored and
the project will work. If you want to remove the warning, the workaround is to
manually use Project->Properties and remove any unresolved Library References
from the "Libraries" and "Packaging" nodes. So I am downgrading this to P2.

Fixing this is dependent on a NetBeans API that Po-Ting tells me will be
provided in the future.
Po-Ting: what is the issue number for the NetBeans API to find the unresolved
references and remove them?
Comment 6 _ potingwu 2007-04-24 00:57:17 UTC
I don't know any NetBeans API or filed issues to find the unresolved references
and remove them.

You can use JsfProjectUtils.removeLibraryReferences(Project project, Library[]
libraries) to remove the library references.
Comment 7 _ edwingo 2007-04-24 01:32:02 UTC
I tried that but it does not work. I spent quite a bit of time debugging it and
I believe the problem is that the old Library Refs are recorded in a different
way in the project from the new refs. So creating a fake Lib Def and then
checking if there is a Lib Ref that points to it, and then removing it not work.
The part that does not work is the last step of removing the Lib Ref.
Comment 8 _ potingwu 2007-04-24 20:40:27 UTC
Are you using removeLibraryReferences with ClassPath.COMPILE/EXECUTE argument?
That one is not working. But if you use removeLibraryReferences without this
argument, then it should work unless the library you are going to remove is not
valid.
Comment 9 _ edwingo 2007-04-24 23:07:00 UTC
Talked to Po-Ting about this and he says that the NB APIs will be fixed in M10
(issue 100114), and then he will need to fix something in his code, then I need
to fix something in complib module. Then the unresolved reference problem will
be solved. For now, though, you need to manually remove the unresolved
references in Project->Properties: "Libraries" and "Packaging" nodes.
Comment 10 sjangity 2007-04-26 07:17:46 UTC
No longer seeing a Source File Error page. However, the issue remains that the
user will manually have to remove the old references.
Comment 11 _ edwingo 2007-07-11 01:06:36 UTC
Sandeep: Could you attach a Creator 2 Update 1 project that I can use to test with?
Comment 12 Yousuf Haider 2007-07-11 07:15:10 UTC
Edwin,
 Since I've taken over migration testing I am attaching a creator project that uses the Blue Prints Ajax components.
Once the project is imported in NB6 the following happens:

1. Unresolved References Problem dialog pops up.

2. Another window pops up saying that the Ajax BluePrints components embedded in the project will be installed in the
IDE. As a result the following happens automatically:
 a. The component library jars embedded in the proejct are copied in the userdir 
 b. A new library is created in the IDE with those jars 
 c. This library is then added to the project. 

At this point the project can be built and compiled without any problems and the page is displayed correctly.

3. In spite of that the project will still show unresolved references for the blueprints ajax library. Removing the
missing libraries will resolve the problem and the project will no longer be badged. 

Note:
If you see any red badging on the Data source node in the project just ignore it since John is working on it and its a
separate issue.
Comment 13 Yousuf Haider 2007-07-11 07:17:38 UTC
Created attachment 44922 [details]
Creator Project with complib
Comment 14 _ edwingo 2007-07-11 21:56:58 UTC
Fixing this bug requires using new lower level NetBeans 6 APIs. I've asked Petr for some suggestions on how to fix this.
Comment 15 Yousuf Haider 2007-07-20 00:45:43 UTC
As per Cindy's request here are the workarounds for various situations:

NB 5.5 or 5.5.1 projects that originally had target server as Tomcat when migrated will face this issue:

   * Migrated Project will show unresolved references for 'JSF-Runtime' and 'JSF-Designtime' libraries. If using
Glassfish in NB6 as target server resolve this issue by removing the unresolved references:
         1. In Project Properties, remove the badged 'jsf-designtime' entry from Libraries node.
         2. In Project Properties, remove the badged 'jsf-runtime' entry from the Packaging node.

If using Bundled Tomcat 6.0.13 as target server for migrated project users will have to add jsf1.1 jars to the project
manually or through the update center. The JSF1.1 issue is still pending. Once a decision has been made the solution for
this situation will become more clear.

Another issue for 5.5.x projects is :

   * For 5.5.x projects that use Ajax BluePrint components NB6 will initially show that the embedded BP component
library has been installed in the IDE and added to the project but will still show 1 Unresolved Reference for library
"WebApplication1_ui_37818" ( or something similar to this). User will have to remove this from both the Libraries and
Packaging node under project properties. Similarly for other complibs.


Workarounds for Creator Projects:

    * Creator Project with Web Service Still shows Unresolved References after Importing project.
http://www.netbeans.org/issues/show_bug.cgi?id=106904 .The IDE will still show unresolved library refernces for
"WEBSVC_SUPPORT_LIB", even though project will deploy and run without any problems.To remove the red badge from the
project remove the 'Web Service Support' library from:
          o Project Properties->Libraries.
          o Project Properties->Building->Packaging.

    * Creator projects using the Ajax BluePrint complib will still show 2 unresolved references for the blueprints ajax
library (One for runtime and the other for design time.) Removing the missing libraries from the Libraries node and
packaging node will resolve the problem and the project will no longer be badged. Similarly for other complib files.
Comment 16 _ edwingo 2007-07-20 16:42:06 UTC
Thanks Yousuf for the detailed info. In most cases, you can ignore the broken reference warning and the project will
continue to work. If you want to remove the warning, then you can use Project->Properties and remove the broken library
references from the "Libraries" and "Build->Packaging" nodes. The confusing part of the UI is that it tells the user to
resolve them instead, but visualweb does not control that. I am also changing this to a P3 since the QE manager agrees
that this is a lower priority. However, I still think this is important to fix and would like to fix it after Petr Pisl
fixes issue 110040.
Comment 17 Joseph Silber 2007-07-24 14:58:27 UTC
Thank you indeed for all the new information. I have updated and committed the two migration guides with this information.
Comment 18 _ edwingo 2007-08-14 22:51:00 UTC
I discussed this with others on visualweb team and think this is a serious usability problem with Creator migration so
am raising this back to a P2.

MarkD wanted me to include another workaround that was considered for completeness, quoted from email:

Mark Dey wrote:
> One workaround that I haven't seen discussed in these bugs is to ship VisualWeb with empty library definitions to
stand in for the ones that have been removed since the last release. Yes, it adds clutter to the list of bundled
libraries but it should:
>
> 1. allow these projects to be imported without causing these confusing error messages and
> 2. not require us to modify the project when it is opened simply to correct these missing references.

Something like this can be implemented for component libraries. Empty legacy library definitions would need to be
created when a project is opened. For each component library in a project, then you would have a single new style
library ref (already working) plus two empty legacy library refs which would eliminate the warning/error message. I
think it's an ugly hack and should be a last resort as it has other downsides. Since the user can manually remove these
references via the UI, there should already be existing code to do this, the problem is that this is not exposed via an
API. I suppose I could spend the time to learn the NB code and propose a patch, but I would want some assurance that it
would be used.

Also, I think Quy ran into some problems with web services but don't know the details.

-Edwin
Comment 19 _ edwingo 2007-08-31 19:13:22 UTC
The dependent issue #110040 has not been resolved so I am deferring this issue to beta2.
Comment 20 _ edwingo 2007-09-29 02:49:47 UTC
Code changes checked into trunk. Involved moving interface from visualweb/complib module into a new
visualweb/complib/api module. Other modules can now reference visualweb/complib/api instead of visualweb/complib directly.
Comment 21 Yousuf Haider 2007-10-10 22:28:41 UTC
Verified on :
Product Version: NetBeans IDE Dev (Build 200710100000)
Java: 1.6.0_03; Java HotSpot(TM) Client VM 1.6.0_03-b02
System: Windows XP version 5.1 running on x86; Cp1252; en_US (nb)