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 121498 - Refactoring "Move inner to outer level" + generated try-catch
Summary: Refactoring "Move inner to outer level" + generated try-catch
Status: RESOLVED WONTFIX
Alias: None
Product: java
Classification: Unclassified
Component: Source (show other bugs)
Version: 6.x
Hardware: All All
: P4 blocker (vote)
Assignee: Svata Dedic
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-11-08 17:06 UTC by devon_c_miller
Modified: 2016-07-07 07:15 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 devon_c_miller 2007-11-08 17:06:11 UTC
This is with 6.0beta2

Refactoring "Move inner to outer level" does not alter the class passed to Logger.getLogger().

When NB generates a try-catch block in an inner class, the first argument to Logger.getLogger() is
outerclass.class.getName(). If the inner is refactored to an outer class, the argument remains unchanged and the class
winds up logging as its former outer class. So, given the code below, if "Inner" is refactored to "Outer", the first
argument to getLogger will remain Main.class.getName().

Your call whether this is a bug in the refactoring or a bug in the try-catch generation.

The fact that if I change the argument to getLogger() to read "Inner.class.getName()", then refactoring changes it to
"Outer.class.getName()", make me think it's more likely a try-catch generation bug.

package test;
public class Main {
    public static class Inner {
        public Inner() {}
        public void exampleMethod() {
            try {
               // statements...
            }
            catch (Exception ex) {
               Logger.getLogger(Main.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }
}
Comment 1 Rastislav Komara 2009-02-03 10:53:21 UTC
Overtake.
Comment 2 Jan Lahoda 2009-08-20 09:58:37 UTC
Reassigning all moonko's java/source bugs to myself.
Comment 3 Martin Balin 2016-07-07 07:15:46 UTC
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue.

Thanks for your cooperation,
NetBeans IDE 8.2 Release Boss