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 20070821 Open Mobile project from 5.5 version with some code added manually, convert the old Visual MIDlet. Open the Converted file, Try to add some method from the Hints, and the follow GuardedException appears. org.netbeans.editor.GuardedException: Attempt to insert into guarded block at position 19,209. at org.netbeans.editor.GuardedDocument.preInsertCheck(GuardedDocument.java:156) at org.netbeans.editor.BaseDocument.insertString(BaseDocument.java:554) at org.netbeans.api.java.source.ModificationResult.commit(ModificationResult.java:94) Caused: java.io.IOException at org.netbeans.api.java.source.ModificationResult.commit(ModificationResult.java:105) at org.netbeans.api.java.source.ModificationResult.commit(ModificationResult.java:67) at org.netbeans.modules.java.hints.errors.Utilities.commitAndComputeChangeInfo(Utilities.java:216) at org.netbeans.modules.java.hints.errors.CreateMethodFix.implement(CreateMethodFix.java:177) at org.netbeans.modules.editor.hints.HintsUI$1.run(HintsUI.java:545) at org.openide.util.RequestProcessor$Task.run(RequestProcessor.java:539) [catch] at org.openide.util.RequestProcessor$Processor.run(RequestProcessor.java:964)
Created attachment 46986 [details] ZIP project
Low use-case, IMO, will not be so visible in production builds (exceptions are disabled there) and quite hard to fix.
I have run into this problem several times. I believe that the add method function tries to add methods in alphabetical order, and if it attempts to add a method between two guarded methods, it hits a guarded block. Maybe it can be easily fixed by either adding methods to the bottom of a class, similar to the encapsulate fields function, or making sure it doesn't hit a guarded block when adding space between 2 guarded methods.
*** Issue 158573 has been marked as a duplicate of this issue. ***
Resolving all issues with milestone "future" as LATER. If you feel strongly that it should be implemented please reopen and set the target milestone to "next".
NetBeans.org Migration: changing resolution from LATER to WONTFIX