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 140605 - Schema view shows no information
Summary: Schema view shows no information
Status: VERIFIED FIXED
Alias: None
Product: xml
Classification: Unclassified
Component: Schema Tools (show other bugs)
Version: 6.x
Hardware: All All
: P1 blocker (vote)
Assignee: Samaresh Panda
URL:
Keywords:
Depends on:
Blocks: 140706 141415
  Show dependency tree
 
Reported: 2008-07-17 19:07 UTC by tonybeckham
Modified: 2008-08-01 17:34 UTC (History)
5 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Image of issue (170.42 KB, image/png)
2008-07-17 19:08 UTC, tonybeckham
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tonybeckham 2008-07-17 19:07:42 UTC
When opening a schema that has been closed (not opened automatically after creating a new one) the schema view is empty.

System:
Product Version: NetBeans IDE Dev (Build 200807170007)
Java: 1.6.0_05; Java HotSpot(TM) 64-Bit Server VM 1.6.0_05-b13-52
System: Mac OS X version 10.5.4 running on x86_64; MacRoman; en_US (nb)

Steps:
Open a schema, that's all.
Comment 1 tonybeckham 2008-07-17 19:08:50 UTC
Created attachment 64891 [details]
Image of issue
Comment 2 Samaresh Panda 2008-07-17 19:33:44 UTC
Tony, do you see any error in the console or the log?
Comment 3 tonybeckham 2008-07-17 19:40:23 UTC
There is a warning.

WARNING [org.openide.loaders]: Should override getLookup() in class org.netbeans.modules.xml.schema.SchemaDataObject,
e.g.: [MultiDataObject.this.]getCookieSet().getLookup()
Comment 4 tonybeckham 2008-07-17 19:49:04 UTC
...and the warning only shows on the first attempt and is in the console not the IDE.  Subsequent schema openings do not
show the warning.
Comment 5 Samaresh Panda 2008-07-17 19:54:51 UTC
Seems like few things have changed in openide.nodes APIs and we're seeing these new issues.
Comment 6 tonybeckham 2008-07-17 22:20:58 UTC
Workaround: Right click schema and select open in the context menu.
Comment 7 Samaresh Panda 2008-07-18 17:10:39 UTC
Related to http://wiki.netbeans.org/FitnessViaLaziness. As per yarda, assigning to openide.nodes.
Comment 8 Jaroslav Tulach 2008-07-23 19:55:51 UTC
I'll investigate tomorrow.
Comment 9 Ivan Sidorkin 2008-07-24 01:18:59 UTC
now it reproducible for newly created schema.
added elements not showed
Comment 10 Michael Nazarov 2008-07-24 07:42:34 UTC
I see stable fail as well. Looks like I saw this in previous build but it was unstable and I was
unable to reproduce.
Also this issue actually shows just the same behavior which cause CV test to fail -- required XML schema column absent.
Comment 11 Jaroslav Tulach 2008-07-24 10:43:47 UTC
I need help from owner of the code.

Nodes and Explorers from core seem to be working correctly. Switch to treeview in the editor to see that. The problem 
is only with ColumnListView for some reason it sticks with DummySchemaNode and is not updated to AdvancedSchemaNode.  
I am not sure what part of your code shall do it, so please help me investigate this.

I do not know why there is a change in the behaviour, the only difference is that now we call your code with 
Children.MUTEX.readAccess, which delays changes to node hierarchies. However, if you correctly update the node for 
ColumnListView, things seem to work. I tried following patch and the result is acceptable from my point of view:

diff -r 9038326f2d74 xml.schema.ui.basic/src/org/netbeans/modules/xml/schema/ui/basic/SchemaColumn.java
--- a/xml.schema.ui.basic/src/org/netbeans/modules/xml/schema/ui/basic/SchemaColumn.java        Wed Jul 23 15:14:16 
2008 +0200
+++ b/xml.schema.ui.basic/src/org/netbeans/modules/xml/schema/ui/basic/SchemaColumn.java        Thu Jul 24 11:43:20 
2008 +0200
@@ -136,7 +136,7 @@
         list.setCellRenderer(new ColumnListCellRenderer());
         if (rootNode != null) {
             if (rootNode.getCookie(DummySchemaNode.class) == null &&
-                    rootNode.getCookie(SchemaNode.class) != null) {
+                    rootNode.getCookie(SchemaNode.class) == null) {
                 rootNode = new DummySchemaNode(rootNode);
             }
             getExplorerManager().setRootContext(rootNode);


I removed dependency on node issue 140801, as right now I think the bug is in the ColumnListView explorer and is just 
manifested by our changes.

Comment 12 Samaresh Panda 2008-07-24 15:29:03 UTC
Sorry, the original owners do not work in this anymore. Let me look into this and I'll get back.
Comment 13 Samaresh Panda 2008-07-24 16:40:27 UTC
The patch will not work. The initial view should look like this:
http://xml.netbeans.org/images/screenshots/columnView.png. In any case, I'm looking into it and if you can think of
anything that might cause this, let me know.
Comment 14 Samaresh Panda 2008-07-24 18:05:10 UTC
So the the lazy initialization (of children) is causing the problem. Here is the new diff.

diff -r 4b09793c5455 xml.schema.ui.basic/src/org/netbeans/modules/xml/schema/ui/
basic/SchemaColumn.java
--- a/xml.schema.ui.basic/src/org/netbeans/modules/xml/schema/ui/basic/SchemaCol
umn.java        Thu Jul 24 08:16:36 2008 -0700
+++ b/xml.schema.ui.basic/src/org/netbeans/modules/xml/schema/ui/basic/SchemaCol
umn.java        Thu Jul 24 11:59:52 2008 -0500
@@ -137,6 +137,8 @@
         if (rootNode != null) {
             if (rootNode.getCookie(DummySchemaNode.class) == null &&
                     rootNode.getCookie(SchemaNode.class) != null) {
+                //call getChildren.getNodes() once
+                rootNode.getChildren().getNodes();
                 rootNode = new DummySchemaNode(rootNode);
             }
             getExplorerManager().setRootContext(rootNode);

What I do not understand is, why the same call (original.getChildren().getNodes()) inside createKeys() returns 0.

In any case, attaching a jar for QE to verify.
Comment 15 Samaresh Panda 2008-07-24 18:06:03 UTC
I mean createKey() of DummySchemaNode.java.
Comment 16 Samaresh Panda 2008-07-24 18:44:49 UTC
Fixed: Fixed: http://hg.netbeans.org/main?cmd=changeset;node=634fd002109c.
Comment 17 Jesse Glick 2008-07-24 20:28:02 UTC
It is very suspect for any code outside of the actual explorer views to be calling Children.getNodes(). Generally this
is a layering violation - nodes should only _display_ data available in a more authoritative form in some other way.
Comment 18 Samaresh Panda 2008-07-24 21:17:14 UTC
Like I said, it should have worked inside createKey() of DummySchemaNode because it is the same node that is being
passed to DummySchemaNode from SchemaColumn. I'll appreciate if experts in this area take a look at it. This code used
to work until recent changes in nodes/explorer.
Comment 19 tonybeckham 2008-08-01 17:34:15 UTC
Fix Verified

Product Version: NetBeans IDE Dev (Build 200808010201)
Java: 1.5.0_13; Java HotSpot(TM) Client VM 1.5.0_13-119
System: Mac OS X version 10.5.4 running on i386; MacRoman; en_US (nb)