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.
Summary: | NPE when using search&replace makes IDE unusable | ||
---|---|---|---|
Product: | utilities | Reporter: | Max Sauer <msauer> |
Component: | Search | Assignee: | Marian Petras <mpetras> |
Status: | VERIFIED FIXED | ||
Severity: | blocker | CC: | mmirilovic |
Priority: | P2 | ||
Version: | 6.x | ||
Hardware: | All | ||
OS: | All | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | |||
Bug Blocks: | 89637 | ||
Attachments: | NPE stack trace |
Description
Max Sauer
2006-11-24 08:36:22 UTC
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 |