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.
Using Search and replace makes IDE unusable -- following NPE is thrown almost upon every action. The search output window has to be closed in order to stop this. Reproducible almost every time. java.lang.NullPointerException at javax.swing.JList$1.getSize(JList.java:425) at javax.swing.plaf.basic.BasicListUI.updateLayoutState(BasicListUI.java:1319) at javax.swing.plaf.basic.BasicListUI.maybeUpdateLayoutState(BasicListUI.java:1288) at javax.swing.plaf.basic.BasicListUI.getPreferredSize(BasicListUI.java:560) at javax.swing.JComponent.getPreferredSize(JComponent.java:1627) ... (whole stack trace attached) Steps to reproduce: ------------------- 1) Start IDE with fresh userdir 2) Create a new j2se project 3) From project's Explorer context menu, invoke "Find" 4) Fill in "Main" for searched item, and "some" for replace item 5) Confirm dialog => NPE 6) Try to ie. view some window from Window menu => NPE --- NetBeans IDE Dev (Build 061124) 1.6.0-rc; Java HotSpot(TM) Server VM 1.6.0-rc-b104 Linux version 2.6.12-1.1390_FC4smp running on i386 en_US (nb); UTF-8
This is a showstopper for M5.
Max, please attach the whole stack trace, thanks in advance.
Created attachment 36263 [details] NPE stack trace
There is always an exception preceding the already reported exception: java.lang.IllegalStateException: Buffer is gone at ...search.MatchingObject.write(MatchingObject.java:607) at ...search.ReplaceTask.doReplace(ReplaceTask.java:144) at ...search.ReplaceTask.replace(ReplaceTask.java:91) at ...search.ReplaceTask.run(ReplaceTask.java:77) ... (invoked form a RequestProcessor) ...
Fixed (in the trunk). The cause of the bug was the following: When modifying the file's contents, the file's content is always read from the file, even if it has already been read before. In other words, the cached content is not used. But when writing the content back to file, it is the cached content that is written. The bug was that the special method for reading the file's content from the file (skipping the cache) did not refresh (or fill) the cache (text buffer) which is then used when writing. If the cache had not been filled earlier by some other operation, it was empty (null) at the moment of writing the content back to the file. The fix is simple - change the method that forcibly reads the text from the file always stores the read text to the cache. The reason why I did not catch this bug was that before performing the 'replace' operation, I apparently always made some other operation that filled the cache (buffer). For example, previewing the file's content in the right panel of the results window reads the file's content and saves it to the cache. Modified file: utilities/src/org/netbeans/modules/search/MatchingObject.java (1.2) Diff: http://utilities.netbeans.org/source/browse/utilities/src/org/netbeans/modules/search/MatchingObject.java?r1=1.1&r2=1.2&diff_format=u
Oops! The fix still contained a bug. Now fixed: Modified file: utilities/src/org/netbeans/modules/search/MatchingObject.java (1.3) Diff: http://utilities.netbeans.org/source/browse/utilities/src/org/netbeans/modules/search/MatchingObject.java?r1=1.2&r2=1.3&diff_format=u
Verified. Thanx for the quick fix, Marian.. --- NetBeans IDE Dev (Build 20061124-1716) 1.6.0-rc; Java HotSpot(TM) Client VM 1.6.0-rc-b104 Linux version 2.6.11.3 running on i386 cs_CZ (nb); ISO-8859-2