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.
This hint produces something like Logger.getLogger(SwingTextView.class.getName()). log(Level.SEVERE, null, ex); But in the SwingTextView class there is static final Logger LOG = Logger.getLogger(SwingTextView.class.getName()); (the "final" is there because of a recent hint ;-) ) Shouldn't the try-catch hint produce LOG.log(Level.SEVERE, null, ex); Alternatively, or perhaps in addition, there could be a hint, something like, "use existing Logger" which would convert the try-catch output.
I will see what can be done.
If I may add a request. When it is necessary to create/get the default logger I'd rather see this.getClass().getName() used instead of MyClass.class.getName(). I find I sometimes copy/paste then edit. Since the results are equivalent but class independent, I think it'll be a wee bit better.
Sadly "this.getClass().getName()" can only be used in instance context, and not in static context.
Most of the time we already have a defined logger in the class, usualy it can be found in : - a static field named LOGGER - by a method .getLogger() So if the automatic try{} catch could check if those exist that would be great.
I just noticed this as well, and was going to add a bug and saw it was already here :-). Adding myself to the cc.
Actually an enhancement; the generated code is valid, although not optimal.
*** Bug 208460 has been marked as a duplicate of this bug. ***
(In reply to eclesia from comment #4) > usualy it can be found in : It could be defined as an option. See bug 252708.