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.
Build: NetBeans IDE Dev (Build 110113-37061888d658) VM: Java HotSpot(TM) Server VM, 11.3-b02, Java(TM) SE Runtime Environment, 1.6.0_13-b03 OS: SunOS User Comments: vkvashin: My project contains file objects that do not correspond to files. This leads to NPEs. That's obviously incorrect. Stacktrace: java.lang.NullPointerException at org.netbeans.modules.search.MatchingObject.getName(MatchingObject.java:387) at org.netbeans.modules.search.NodeRenderer.getTreeCellRendererComponent(NodeRenderer.java:177) at javax.swing.plaf.basic.BasicTreeUI$NodeDimensionsHandler.getNodeDimensions(BasicTreeUI.java:2717) at javax.swing.tree.AbstractLayoutCache.getNodeDimensions(AbstractLayoutCache.java:475) at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.updatePreferredSize(VariableHeightLayoutCache.java:1342) at javax.swing.tree.VariableHeightLayoutCache$TreeStateNode.getXOrigin(VariableHeightLayoutCache.java:1125)
Created attachment 104974 [details] stacktrace
My project contains file objects that do not correspond to files. This leads to NPEs, which is obviously incorrect.
The remedy is to switch to FileObject instead of file. MatchingObject has only one constructor; it gets FileObject in it, so it isn't an issue. All usages of getFile can be replaced by use of FileObjects. The only place file is needed is in NodeListener.java:632, where it is canonicalized. It can be converted to file in this place.
Steps to reproduce: - activate C/C++ support, - go to services pane > C/C++ development hosts, set up a host - via context menu of the newly added host, add to Favorites some its directory - select this directory in favorites, try searching something in it If search finds some occurrences, tons of NPEs occur in UI thread, this makes IDE not functional at all
Reproduced. While reproducing this issue I faced and filed another one: https://netbeans.org/bugzilla/show_bug.cgi?id=194598 Looks like "Add to Favorites" functionality wasn't tested enough (http://hg.netbeans.org/main/rev/c2ed5a6ca6e5).
Created attachment 105591 [details] fix for review
Should be fixed now. http://hg.netbeans.org/core-main/rev/3a331f02b4f1 Excepting the problem that happens in case if remote system is Mac. The remote files have wrong modification date in this case and are treated as invalid for search. See #194598
Created attachment 105593 [details] fix for review (with -w option for diff) The fix is integrated but review and testing is very welcome.
I tried the fix, it seems to work ok. I also had a brief glance at code changes and noticed one possible issue: MatchingObject.java:385, method getName() returns getFileObject().getName() while previously it returned File.getName(). Most likely it should return FileObject.getNameExt() (I was also trapped into that many times while moving my code from files to file objects...)
Thank you, Vladimir. Will fix.
The fix with Vladimir's recommendation makes sense, my test-case works for me. Thanks
Integrated into 'main-golden', will be available in build *201102030000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/3a331f02b4f1 User: Yulia Novozhilova <ynov@netbeans.org> Log: Fix #194326 - NullPointerException at org.netbeans.modules.search.MatchingObject.getName
Integrated into 'main-golden', will be available in build *201102040000* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main/rev/db6424f6d366 User: Yulia Novozhilova <ynov@netbeans.org> Log: Correct tests for BufferedCharSequence to test recent implementation changes(#194326)