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 - Wrong braces generated for addActionListener
Summary: Wrong braces generated for addActionListener
Status: VERIFIED FIXED
Alias: None
Product: guibuilder
Classification: Unclassified
Component: Code (show other bugs)
Version: 3.x
Hardware: PC Windows ME/2000
: P1 blocker (vote)
Assignee: Tomas Pavek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-04-18 10:23 UTC by aldobrucale
Modified: 2003-04-29 08:32 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
binary patch (for both trunk and 3.5) (45.77 KB, application/octet-stream)
2003-04-22 14:22 UTC, Tomas Pavek
Details
context diff for release35 (1018 bytes, text/plain)
2003-04-22 14:37 UTC, Tomas Pavek
Details

Note You need to log in before you can comment on or make changes to this bug.
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