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 219257 - Replace with multicatch hint adds unwanted spaces
Summary: Replace with multicatch hint adds unwanted spaces
Status: RESOLVED DUPLICATE of bug 238215
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 7.3
Hardware: PC Windows 7
: P4 normal (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-10-01 11:14 UTC by mienamoo
Modified: 2013-12-13 16:53 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mienamoo 2012-10-01 11:14:24 UTC
NetBeans IDE 7.3 Beta (Build 201209272333)
JDK 7u7 64-bit

When applying the "Replace with multicatch", you end up with a lot of unnecessary spaces. For example (LAF name removed for readability):

try {
    UIManager.setLookAndFeel("");
} catch (ClassNotFoundException ex) {
    Exceptions.printStackTrace(ex);
} catch (InstantiationException ex) {
    Exceptions.printStackTrace(ex);
} catch (IllegalAccessException ex) {
    Exceptions.printStackTrace(ex);
} catch (UnsupportedLookAndFeelException ex) {
    Exceptions.printStackTrace(ex);
}

is transformed into

try {
    UIManager.setLookAndFeel("");
} catch (            ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
    Exceptions.printStackTrace(ex);
}

Note the spaces after catch (. The number of spaces appear to be independent of the number of exceptions. Nothing a quick code format can't fix, but it is still annoying.
Comment 1 Jiri Prox 2013-03-27 15:37:10 UTC
reproducible.

This happens when the try-catch is located deeper in the block (e.g. it is not directly in class method)

Sample code:

       if (true) {
            if (true) {
                try {
                    m();
                } catch (FileNotFoundException exception) {
                    Logger.getLogger(ClassB.class.getCanonicalName()).log(Level.SEVERE, "", exception);
                } catch (MalformedURLException exception) {
                    Logger.getLogger(ClassB.class.getCanonicalName()).log(Level.SEVERE, "", exception);
                }
            }
        }
Comment 2 Svata Dedic 2013-12-13 16:53:35 UTC

*** This bug has been marked as a duplicate of bug 238215 ***