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 33044

Summary: Wrong braces generated for addActionListener
Product: guibuilder Reporter: aldobrucale <aldobrucale>
Component: CodeAssignee: Tomas Pavek <tpavek>
Status: VERIFIED FIXED    
Severity: blocker    
Priority: P1    
Version: 3.x   
Hardware: PC   
OS: Windows ME/2000   
Issue Type: DEFECT Exception Reporter:
Attachments: binary patch (for both trunk and 3.5)
context diff for release35

Description aldobrucale 2003-04-18 10:23:52 UTC
The 3.5beta version of NB generates wrong code for an 
action listener:

try {
    panelAlarmFiltering.addActionListener(new 
java.awt.event.ActionListener() {
        public void actionPerformed
(java.awt.event.ActionEvent evt) {
            panelAlarmFilteringActionPerformed(evt);
        }
    }} catch (java.util.TooManyListenersException e1) {
        e1.printStackTrace();
    }
);

The closing brace of addActionListener ");" and the 
closing curly brace of the catch statement are swapped.

With NB 3.4.1 I get:

try {
    panelAlarmFiltering.addActionListener(new 
java.awt.event.ActionListener() {
        public void actionPerformed
(java.awt.event.ActionEvent evt) {
            panelAlarmFilteringActionPerformed(evt);
        }
    });
} catch (java.util.TooManyListenersException e1) {
    e1.printStackTrace();
}
Comment 1 Jaromir Uhrik 2003-04-18 15:36:40 UTC
It is reproducible in 3.5 Beta build and it needs to be fixed in 3.5 -
there is no way to repair the malformed code.
Comment 2 Tomas Pavek 2003-04-22 14:17:25 UTC
I see. It's really shame I integrated such a bug... However it's just
a trivial typo, the fix is quite simple (swapping two lines, I'll
attach the diff).
Comment 3 Tomas Pavek 2003-04-22 14:22:02 UTC
Created attachment 10066 [details]
binary patch (for both trunk and 3.5)
Comment 4 Tomas Pavek 2003-04-22 14:30:23 UTC
Fixed in trunk.

/cvs/form/src/org/netbeans/modules/form/JavaCodeGenerator.java
new revision: 1.127; previous revision: 1.126
Comment 5 Tomas Pavek 2003-04-22 14:37:58 UTC
Created attachment 10067 [details]
context diff for release35
Comment 6 Miloslav Metelka 2003-04-22 14:45:17 UTC
I have checked the fix and it should be OK.
Comment 7 Jaromir Uhrik 2003-04-22 15:31:46 UTC
QA-result of checking: The patch works perfectly (tested 
in #200304212350).
Comment 8 _ ttran 2003-04-22 16:51:02 UTC
approved for 3.5
Comment 9 Tomas Pavek 2003-04-22 17:06:06 UTC
Integrated to release35.

/cvs/form/src/org/netbeans/modules/form/JavaCodeGenerator.java
new revision: 1.125.2.2; previous revision: 1.125.2.1
Comment 10 Jaromir Uhrik 2003-04-29 08:32:53 UTC
Verified in RC1(build 200304282350) of NetBeans3.5