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 129262

Summary: generated methods in servlet are folded with http servlets methods
Product: javaee Reporter: Radim Roska <rroska>
Component: CodeAssignee: pslechta <pslechta>
Status: VERIFIED FIXED    
Severity: blocker CC: sustaining
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Radim Roska 2008-03-05 10:57:57 UTC
1. Create web project
2. create servlet

doGet and doPost methods are folded as desc="HttpServlet methods...

thats ok.

But if user generate another methods (e.g. rightclick->enterprise resource->send JMS Message), these methods are folded
in the same "block" as doGet and doPost and are collapsed by default. This may be confusing.

I suggest to place these new methods somewhere before "doGet & doPost block"..so its not collapsed automatically.
Comment 1 Jan Horvath 2008-03-05 12:21:56 UTC
it looks more like a defect rather then enhancement
Comment 2 Pavel Buzek 2008-03-20 06:45:42 UTC
Priority correct at P3. Not critical for 6.1.
Comment 3 pslechta 2008-04-14 11:20:36 UTC
Reproduced in 6.1 dev build on WinXP.
The generated code is placed after folded block only in there is some code after the block (variable declaration is
sufficient). It seems that cursor position does not influence where the generated code goes.
Comment 4 pslechta 2008-04-16 15:47:47 UTC
I looked through NB APIs used for Java source code modification (a lot of compilation trees and diffs) and don't see any
way how to fix the problem using these APIs. However, I found that the problem may be eliminated just by changing
template for servlet code generation...
Comment 5 pslechta 2008-04-16 16:18:31 UTC
Fixed.

http://hg.netbeans.org/main/rev/ae8df03336ec

The fix is very simple and everybody may apply it to his/her NetBeans installation -- just change template for servlet
code generation:

(1) Tools > Templates > Web > Servlet > Open in Editor.
(2) Modify the template according to the diff (see the link above). The most important change is to attach "//
</editor-fold>" comment directly after "}".
(3) Save the template.

Now all new methods should be inserted outside of the folded methods.
Comment 6 pslechta 2008-04-16 17:44:26 UTC
*** Issue 117977 has been marked as a duplicate of this issue. ***
Comment 7 Radim Roska 2008-04-17 09:53:12 UTC
verified
Comment 8 pslechta 2008-04-28 15:19:15 UTC
The fix has been ported into the release61_fixes branch.

http://hg.netbeans.org/release61_fixes/rev/c6e692de4846