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 12001 - MOD: NPE thrown when you click on WEB-INF node
Summary: MOD: NPE thrown when you click on WEB-INF node
Status: CLOSED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Code (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P2 blocker (vote)
Assignee: Petr Pisl
URL:
Keywords:
: 11952 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-05-07 17:19 UTC by L Martinek
Modified: 2003-07-02 08:26 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
This is the excetption, that is displayed in to console (1.90 KB, text/plain)
2001-07-20 20:32 UTC, Petr Pisl
Details
This is diffs for patch in WebContextLoader. I try it and it seems that work OK. (545 bytes, patch)
2001-07-20 20:32 UTC, Petr Pisl
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description L Martinek 2001-05-07 17:19:44 UTC
010505

After some circumstances (I don't known them yet) exception is thown with every 
click on WEB-INF node.


Mon May 07 18:14:12 GMT+02:00 2001: java.lang.NullPointerException: Posted 
StackTrace
Annotation: Exception occurred in Request Processor
org.openide.util.RequestProcessor$Holder: Posted StackTrace(task 
org.openide.util.actions.NodeAction$NodesL@377801 [-38, 9, -1])
        at 
org.openide.util.RequestProcessor$Task.createHolder(RequestProcessor.java:322)
        at 
org.openide.util.RequestProcessor$Task.schedule(RequestProcessor.java:346)
        at 
org.openide.util.actions.NodeAction$NodesL.propertyChange(NodeAction.java:190)
        at 
java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:1
52)
        at 
org.netbeans.core.windows.RegistryImpl.tryFireChanges(RegistryImpl.java:312)
        at 
org.netbeans.core.windows.RegistryImpl.selectedNodesChanged(RegistryImpl.java:26
8)
        at 
org.netbeans.core.windows.frames.DefaultContainerImpl.doActivateComponent(Defaul
tContainerImpl.java:521)
        at 
org.netbeans.core.windows.frames.DefaultContainerImpl.reactivateSelectedComponen
t(DefaultContainerImpl.java:633)
        at 
org.netbeans.core.windows.frames.DefaultContainerImpl$2.run(DefaultContainerImpl
.java:768)
[catch] at 
org.netbeans.core.windows.frames.DefaultContainerImpl$4.run(DefaultContainerImpl
.java:783)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:154)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:317)
        at 
java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:84)
 
Mon May 07 18:14:12 GMT+02:00 2001: java.lang.NullPointerException: null
java.lang.NullPointerException
        at 
org.netbeans.modules.web.context.WebInfObject.getCookie(WebInfObject.java:80)
        at org.openide.loaders.DataNode.getCookie(DataNode.java:287)
        at 
org.openide.loaders.DataFolder$FolderNode.getCookie(DataFolder.java:1270)
        at org.openide.nodes.FilterNode.getCookie(FilterNode.java:455)
        at org.openide.nodes.FilterNode.getCookie(FilterNode.java:455)
        at 
org.openide.util.actions.CookieAction.resolveSupported(CookieAction.java:150)
        at org.openide.util.actions.CookieAction.doEnable(CookieAction.java:124)
        at org.openide.util.actions.CookieAction.enable(CookieAction.java:119)
        at 
org.openide.util.actions.NodeAction$NodesL.checkEnabled(NodeAction.java:248)
        at org.openide.util.actions.NodeAction$NodesL.run(NodeAction.java:203)
        at org.openide.util.Task.run(Task.java:124)
[catch] at 
org.openide.util.RequestProcessor$ProcessorThread.run(RequestProcessor.java:626)
Comment 1 Petr Jiricka 2001-05-07 20:08:28 UTC
Probably a consequence of bugtraq bug 4390908.
Comment 2 Petr Pisl 2001-05-11 14:50:30 UTC
You can reproduce this bug:
1) Create local cvs file system
2) Convert this fs to web module
3) commit all to the CVS
4) Unmount this fs
5) mount new working directory with the same repository directory as it was.
6) check out from the CVS


 
Comment 3 Petr Pisl 2001-05-11 14:52:45 UTC
Created attachment 1353 [details]
This is the excetption, that is displayed in to console
Comment 4 Petr Pisl 2001-05-11 14:57:23 UTC
I think there is problem with recognizing web-inf structure and then are is 
created WebInfObject before WebContextObject. WebInfObject is created in spite 
of the exception that is showen in consele window. The WebInfObject supposes 
that there is WebContextObject done. 
Comment 5 Petr Jiricka 2001-05-11 15:18:47 UTC
The workaround is to unmount and mount the web module.
Comment 6 sgleason 2001-05-15 21:00:42 UTC
This doesn't appear to be a consequence of 4390908. That bug is fixed
and integrated, while this one is still happening. 
Also, I found that the reason the bug is occurring is that the 
web context object (WebInfoObject.wco) is null at the time the
web inf object is clicked on. It is null because of an NPE that 
happens earlier -- when the web context directory is checked outfrom CVS. 
Here is the stacktrace: 
java.lang.NullPointerException
	at
org.openide.loaders.DataLoaderPool.getPreferredLoader(DataLoaderPool.java:390)
	at org.openide.loaders.DataLoaderPool.findDataObject(DataLoaderPool.java:345)
	at org.openide.loaders.DataLoaderPool.findDataObject(DataLoaderPool.java:319)
	at org.openide.loaders.DataObject.find(DataObject.java:425)
	at org.netbeans.modules.vcscore.VcsAction.assureFilesSaved(VcsAction.java:389)
	at org.netbeans.modules.vcscore.VcsAction.doCommand(VcsAction.java:267)
	at org.netbeans.modules.vcscore.VcsAction.doCommand(VcsAction.java:248)
	at org.netbeans.modules.vcscore.VcsAction.doCommand(VcsAction.java:234)
	at
org.netbeans.modules.vcs.cmdline.commands.CvsCommit.doCommit(CvsCommit.java:265)
	at org.netbeans.modules.vcs.cmdline.commands.CvsCommit.exec(CvsCommit.java:315)
	at
org.netbeans.modules.vcscore.cmdline.ExecuteCommand.runClass(ExecuteCommand.java:416)
	at
org.netbeans.modules.vcscore.cmdline.ExecuteCommand.run(ExecuteCommand.java:479)
	at java.lang.Thread.run(Thread.java:484)
java.lang.ClassCastException: org.openide.loaders.DataFolder
	at
org.netbeans.modules.web.context.WebContextLoader.findContext(WebContextLoader.java:163)
	at org.netbeans.modules.web.context.WebInfObject.init(WebInfObject.java:69)
	at org.netbeans.modules.web.context.WebInfObject.<init>(WebInfObject.java:64)
	at
org.netbeans.modules.web.context.WebInfLoader.handleFindDataObject(WebInfLoader.java:93)
	at org.openide.loaders.DataObjectPool.callHandleFind(DataObjectPool.java:93)
	at org.openide.loaders.DataLoader.findDataObject(DataLoader.java:183)
	at org.openide.loaders.DataLoaderPool.findDataObject(DataLoaderPool.java:359)
	at org.openide.loaders.FolderList.createBoth(FolderList.java:491)
	at org.openide.loaders.FolderList.getObjects(FolderList.java:311)
	at org.openide.loaders.FolderList.access$200(FolderList.java:40)
	at org.openide.loaders.FolderList$ListTask.run(FolderList.java:638)
	at org.openide.util.Task.run(Task.java:124)
	at
org.openide.util.RequestProcessor$ProcessorThread.run(RequestProcessor.java:626)
Comment 7 sgleason 2001-05-15 21:22:24 UTC
Oops. Spoke too soon. 4390908 is closed as a duplicate of 4455623, which
is a read-only copy of this very bug here. 

I found another way to get the class cast exception mentioned in 4390908:
mount a non-web module directory, then (outside the IDE) copy the WEB-INF
directory from a web module the mounted directory. The following class cast
exception ensues: 

java.lang.ClassCastException: org.openide.loaders.DataFolder
	at
org.netbeans.modules.web.context.WebContextLoader.findContext(WebContextLoader.java:163)
	at org.netbeans.modules.web.context.WebInfObject.init(WebInfObject.java:69)
	at org.netbeans.modules.web.context.WebInfObject.<init>(WebInfObject.java:64)
	at
org.netbeans.modules.web.context.WebInfLoader.handleFindDataObject(WebInfLoader.java:93)
	at org.openide.loaders.DataObjectPool.callHandleFind(DataObjectPool.java:93)
	at org.openide.loaders.DataLoader.findDataObject(DataLoader.java:183)
	at org.openide.loaders.DataLoaderPool.findDataObject(DataLoaderPool.java:359)
	at org.openide.loaders.FolderList.createBoth(FolderList.java:491)
	at org.openide.loaders.FolderList.getObjects(FolderList.java:311)
	at org.openide.loaders.FolderList.access$200(FolderList.java:40)
	at org.openide.loaders.FolderList$ListTask.run(FolderList.java:638)
	at org.openide.util.Task.run(Task.java:124)
	at
org.openide.util.RequestProcessor$ProcessorThread.run(RequestProcessor.java:626)


George just sent me this email:
This is a really tough one.  We need to check to see if the root
dataobject is a webcontextobject (in webinfobject.init()) and if not,
then setValid(false), then get the webcontextobject that results from
the file being recognized correctly.  An easier way to do this might
be to unmount and remount the filesystem but thats chancy.

Comment 8 Petr Pisl 2001-05-16 08:36:11 UTC
I know where problem is. There are problem with recognizing for 
WebContextLoader and WebInfLoader. 

The WebContextLoader has conditions:
1) FO is root (hasn't parent)
2) isWebApplication (is not defaul FS and has web.xml file in WEB-INF)
3) canBeContext (FS is not hidden nor read only)

The WebInfLoader has conditions:
1) FO is WEB-INF folder
2) isWebApplication (is not defaul FS and has web.xml file in WEB-INF)
3) canBeContext (FS is not hidden nor read only)

The secodn and third conditions are the same. This works only if the folder 
structure is done. But you will be create this structure manually or choeckout 
from CVS, then the exception java.lang.ClassCastException: 
org.openide.loaders.DataFolder occurs.

I think the reason is:

1) On mounted FS create WEB-INF folder. This FO is not recognizing neighter 
WebContextLoader nor WebInfLoader (doesn't exist web.xml file) but standard 
FolderLoader, that create DataFolder (data object) for this folder.

2) Now create web.xml file on WEB-INF folder. The WebContextLoader is 
recognizing that root must be WebContextObject and is trying do it. But the 
constructor ends with exception Data Object already exist for this FO. And 
WebContextLoader returns null. 

3) The conditions are true for WebInfLoader and it is trying create 
WebInfObject. But it is not possibele, because the WebContextObject isn't 
existing in the moment.
Comment 9 Petr Pisl 2001-05-16 13:38:15 UTC
Created attachment 1375 [details]
This is diffs for patch in WebContextLoader. I try it and it seems that work OK.
Comment 10 Petr Pisl 2001-06-01 09:04:14 UTC
I commited the patch (was attached before) to the CVS - pilsen.
Comment 11 L Martinek 2001-06-14 09:56:09 UTC
I haven't seen the exception no more so it seems to be fixed.
Comment 12 Petr Pisl 2001-06-18 10:34:27 UTC
*** Issue 11952 has been marked as a duplicate of this issue. ***
Comment 13 Quality Engineering 2003-07-02 08:26:50 UTC
Resolved for 3.4.x or earlier, no new info since then -> closing.