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 126462 - Components theme lost intermittently
Summary: Components theme lost intermittently
Status: VERIFIED FIXED
Alias: None
Product: obsolete
Classification: Unclassified
Component: visualweb (show other bugs)
Version: 6.x
Hardware: All Windows XP
: P2 blocker (vote)
Assignee: Peter Zavadsky
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-31 22:43 UTC by _ krystyna
Modified: 2008-02-12 21:52 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
screenshot (198.44 KB, image/jpeg)
2008-01-31 22:44 UTC, _ krystyna
Details
screenshot (220.07 KB, image/jpeg)
2008-01-31 22:44 UTC, _ krystyna
Details
Solaris-nocleanandbuild (212.88 KB, image/jpeg)
2008-02-01 02:29 UTC, _ krystyna
Details

Note You need to log in before you can comment on or make changes to this bug.
Description _ krystyna 2008-01-31 22:43:24 UTC
NetBeans IDE Dev (Build 200801311204)
Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19
System: Windows XP version 5.1


It takes some repetition to reproduce, butI have been able to reproduce four times 
where the component theme is lost for all pages of a project.

Scenario:

Combination of page tab switch, clean and build, drag and drop.
More often seen with 1.4 projects but did reproduce with ee5.

1. create a project with two pages, 
2. drop a button on each page
3. tab switch to page1 and Build > Clean and Build (or use shortcut).

Repeat steps 2 and 3  until theme is lost on component drop. 
All components on the page will lose their theme. Tab switch
to alternate page to see the same.

Designer refresh will restore the theme.
Loss of theme was first seen when #125965 was filed, as well after a memory fix was reverted to fix it.


Attaching screenshots. 
In the messages.log - there is a filesystems warning occurring
in the log same as issue #126454 - it  precedes the theme loss but 
not immediately.
Comment 1 _ krystyna 2008-01-31 22:44:18 UTC
Created attachment 55879 [details]
screenshot
Comment 2 _ krystyna 2008-01-31 22:44:46 UTC
Created attachment 55880 [details]
screenshot
Comment 3 _ krystyna 2008-02-01 01:37:00 UTC
Just reproduced this on Solaris:
NetBeans IDE Dev (Build 200801311204)
Java: 1.6.0_02-ea; Java HotSpot(TM) Client VM 1.6.0_02-ea-b02
System: SunOS version 5.10 

This would rule out the filesystem warning mentioned in desc1.
Comment 4 _ krystyna 2008-02-01 02:27:22 UTC
Could reproduce without having to use clean and build.

Used Design/JSP/Java tab switching and drag and drop.
Eventually new components dropped would have no theme 
- so not all components on the page lost theme as previous -

Attaching screenshot. 
 
Comment 5 _ krystyna 2008-02-01 02:29:27 UTC
Created attachment 55887 [details]
Solaris-nocleanandbuild
Comment 6 Winston Prakash 2008-02-04 15:28:08 UTC
Even though, Krys showed this to me (so the bug do exist!), in my environment
I could not reproduce it. Also krys sees this during random attempts, but 
could not reproduce it at will (which is more scarier).

I'm trying to find a way to reproduce this at will, so that I can pin point
where the bug occurs.

Krys, if you find a concrete way to reproduce it, please put the steps here,
which will help me a lot to locate the bug.
Comment 7 _ krystyna 2008-02-04 20:16:43 UTC
1. Create an ee5 project and drop a table
2. delete the table
3. build and clean
4. drop another table

Repeat steps 3 and 4, until the drop fails to show the theme. 
I have seen it fail in one or two repetitions
on Windows; three or four repetions on Solaris.



Comment 8 Winston Prakash 2008-02-05 01:07:56 UTC
OK, I have a definitive way of reproducing it. 

- Continuously Click the "Clean and Build" button several times  
- Drag and drop the table, you would see the lost theme problem.

I see couple of informational exception in the IDE

java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory:
javax.faces.application.ApplicationFactory
        at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:256)
        at org.netbeans.modules.visualweb.jsfsupport.container.RaveFacesContext.getApplication(RaveFacesContext.java:243)
        at javax.faces.component.UIViewRoot.getLocale(UIViewRoot.java:834)
        at com.sun.webui.jsf.util.ThemeUtilities.getTheme(ThemeUtilities.java:81)
        at com.sun.webui.jsf.renderkit.html.HeadRenderer.renderAttributes(HeadRenderer.java:123)
        at com.sun.webui.jsf.renderkit.html.AbstractRenderer.encodeBegin(AbstractRenderer.java:156)
        at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:788)
[catch] at org.netbeans.modules.visualweb.insync.faces.FacesPageUnit.renderBean(FacesPageUnit.java:1289)
        at org.netbeans.modules.visualweb.insync.faces.FacesPageUnit.renderNode(FacesPageUnit.java:1549)
        at org.netbeans.modules.visualweb.insync.faces.FacesPageUnit.renderBean(FacesPageUnit.java:1337)
        at org.netbeans.modules.visualweb.insync.faces.FacesPageUnit.renderNode(FacesPageUnit.java:1549)
        at org.netbeans.modules.visualweb.insync.faces.FacesPageUnit.renderBean(FacesPageUnit.java:1337)
        at org.netbeans.modules.visualweb.insync.faces.FacesPageUnit.getFacesRenderTree(FacesPageUnit.java:1107)
        at org.netbeans.modules.visualweb.insync.faces.FacesPageUnit.renderHtml(FacesPageUnit.java:1675)
        at org.netbeans.modules.visualweb.insync.faces.FacesPageUnit.renderHtml(FacesPageUnit.java:1628)
        at org.netbeans.modules.visualweb.insync.models.FacesModel.getHtmlDomFragment(FacesModel.java:1614)
        at org.netbeans.modules.visualweb.insync.models.FacesModel.findHtmlBody(FacesModel.java:1638)
        at org.netbeans.modules.visualweb.insync.models.FacesModel.getHtmlBody(FacesModel.java:1626)
        at org.netbeans.modules.visualweb.insync.Util.isGridMode(Util.java:834)
        at org.netbeans.modules.visualweb.designer.jsf.JsfForm.isGridMode(JsfForm.java:1011)
        at org.netbeans.modules.visualweb.designer.jsf.DomProviderImpl.isGridMode(DomProviderImpl.java:1240)
        at org.netbeans.modules.visualweb.designer.WebForm.isGridMode(WebForm.java:1034)
        at org.netbeans.modules.visualweb.css2.PageBox.initializeGrid(PageBox.java:1149)
        at org.netbeans.modules.visualweb.css2.ContainerBox.initialize(ContainerBox.java:101)
        at org.netbeans.modules.visualweb.css2.DocumentBox.relayout(DocumentBox.java:240)
        at org.netbeans.modules.visualweb.css2.PageBox.layout(PageBox.java:550)
        at org.netbeans.modules.visualweb.css2.PageBox.relayout(PageBox.java:617)
        at org.netbeans.modules.visualweb.css2.DocumentBox.redoLayout(DocumentBox.java:466)
        at org.netbeans.modules.visualweb.css2.PageBox.redoLayout(PageBox.java:631)
        at org.netbeans.modules.visualweb.css2.DocumentBox.changed(DocumentBox.java:924)
        at org.netbeans.modules.visualweb.designer.WebForm.changeNode(WebForm.java:1433)
        at org.netbeans.modules.visualweb.designer.jsf.ui.JsfTopComponent.nodeChanged(JsfTopComponent.java:2487)
        at org.netbeans.modules.visualweb.designer.jsf.ui.JsfMultiViewElement.nodeChanged(JsfMultiViewElement.java:177)
        at org.netbeans.modules.visualweb.designer.jsf.JsfForm.notifyViewsNodeChanged(JsfForm.java:1348)
        at org.netbeans.modules.visualweb.designer.jsf.JsfForm.nodeChanged(JsfForm.java:919)
        at org.netbeans.modules.visualweb.designer.jsf.DomSynchronizer.processUpdates(DomSynchronizer.java:785)
        at org.netbeans.modules.visualweb.designer.jsf.DomSynchronizer.run


java.lang.NullPointerException
        at com.sun.faces.application.ApplicationImpl.createValueBinding(ApplicationImpl.java:467)
        at org.netbeans.modules.visualweb.insync.faces.FacesBean.updateBindingLive(FacesBean.java:178)
        at org.netbeans.modules.visualweb.insync.faces.FacesBean.performInstanceParenting(FacesBean.java:160)
        at org.netbeans.modules.visualweb.insync.live.LiveUnit.newDesignBean(LiveUnit.java:654)
        at org.netbeans.modules.visualweb.insync.live.LiveUnit.newDesignBean(LiveUnit.java:704)
        at org.netbeans.modules.visualweb.insync.live.LiveUnit.createBeanOrFacet(LiveUnit.java:838)
        at org.netbeans.modules.visualweb.insync.live.LiveUnit.createBean(LiveUnit.java:859)
        at org.netbeans.modules.visualweb.designer.jsf.FacesDndSupport.createBean(FacesDndSupport.java:1542)
        at org.netbeans.modules.visualweb.designer.jsf.FacesDndSupport.createBeans(FacesDndSupport.java:1426)
        at org.netbeans.modules.visualweb.designer.jsf.FacesDndSupport.importBean(FacesDndSupport.java:638)
        at org.netbeans.modules.visualweb.designer.jsf.FacesDndSupport.importData(FacesDndSupport.java:416)
        at org.netbeans.modules.visualweb.designer.jsf.FacesDndSupport.importData(FacesDndSupport.java:3699)
        at org.netbeans.modules.visualweb.designer.jsf.DndSupport.importData(DndSupport.java:586)
        at org.netbeans.modules.visualweb.designer.jsf.DomProviderImpl.importData(DomProviderImpl.java:1194)
        at org.netbeans.modules.visualweb.designer.WebForm.importData(WebForm.java:2235)
        at org.netbeans.modules.visualweb.designer.DndHandler.importDataExt(DndHandler.java:493)
        at org.netbeans.modules.visualweb.designer.DndHandler.importData(DndHandler.java:351)
        at org.netbeans.modules.visualweb.designer.DesignerTransferHandler.importData(DesignerTransferHandler.java:92)
        at
org.netbeans.modules.visualweb.designer.DesignerPaneDropTarget$DefaultTransferHandlerDropTargetListener.drop(DesignerPaneDropTarget.java:235)
        at java.awt.dnd.DropTarget.drop(DropTarget.java:430)
        at org.netbeans.modules.visualweb.designer.DesignerPaneDropTarget.drop(DesignerPaneDropTarget.java:153)
Comment 9 Winston Prakash 2008-02-05 15:31:24 UTC
So far I could not reproduce this with out "clean and build". Some theory on why this is happening
 
- This was always the case, but exposed by recent memory leak fix.
  Earlier the Classloader was leaked
- Happens as a race condition when the classloader change causes the re-initialization of Faces Application and 
  full page rendering happens (see below)
- Usually the dropped component only gets rendered not the "header" component which includes theme initialization.
- Header gets rendered only when the whole page is resurrected.
- Another place where whole page rendering happens is when designer redo the whole page layout. See the first 
  trace at desc9.
Comment 10 _ sandipchitale 2008-02-07 22:11:13 UTC
We did the following steps when the theme loss occurred on the page:

- Used CTRL+SHIFT+F2 to dump the html that is rendered and save it to a file A
- refreshed the designer thus restoring the theme
- Used CTRL+SHIFT+F2 again to dump the html that is rendered and save it to a file B
- Compared the files A and B

There was no difference in the file A and B that will explain the theme loss...this may indicate the problem with
rendering. Assigning to visual editor for further investigation.
Comment 11 Peter Zavadsky 2008-02-07 22:29:51 UTC
I am going to have a look at that now.
Comment 12 Peter Zavadsky 2008-02-08 19:48:53 UTC
OK, now I found the problem (thanks to Krys for help).
The cache storing the style sheet nodes in batik doesn't get refreshed sometimes (probably because of race condition).
It happen to point to old removed link elements (even though same as the new ones). But thanks to last memory leak fixes
those nodes get garbaged leaving the cache empty with no relevant styles (before the memory leak fixes this was not to
be observed because the old element were kept alive).
Going to fix it by assuring the cache is up-to-date before its usage.
Comment 13 Peter Zavadsky 2008-02-08 21:23:13 UTC
Fixed.

changeset:   66428:1d67eda0b2f2
user:        Peter Zavadsky <pzavadsky@netbeans.org>
date:        Fri Feb 08 13:20:20 2008 -0800
summary:     #126462 Fixing refreshing of style sheet node cache.
Comment 14 _ krystyna 2008-02-12 21:52:00 UTC
Verified in Product Version: NetBeans IDE Dev (Build 200802120006)
Java: 1.6.0_04; Java HotSpot(TM) Client VM 10.0-b19
System: Windows XP version 5.1