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 126749

Summary: surround with try/catch adds poor code
Product: java Reporter: Vince Kraemer <vkraemer>
Component: HintsAssignee: Jan Lahoda <jlahoda>
Status: RESOLVED DUPLICATE    
Severity: blocker    
Priority: P3    
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: DEFECT Exception Reporter:

Description Vince Kraemer 2008-02-05 17:39:13 UTC
When I use the surround with try/catch hint, I see the following code generated in the catch...

catch (MethodCException ex) {
    Logger.getLogger(NewClass.class.getName()).log(Level.SEVERE, null, ex);
}

This use of log is not correct with respect to the recommended use of logging.

It looks like the javadoc for Level would recommend using Level.FINER...

See http://java.sun.com/j2se/1.5.0/docs/api/java/util/logging/Level.html#SEVERE and
http://java.sun.com/j2se/1.5.0/docs/api/java/util/logging/Level.html#FINER...
Comment 1 Jan Lahoda 2008-02-06 15:29:46 UTC
The javadoc speaks about default exception handling - so this does not strictly relate to explicit exception handling.
Anyway, using FINER as default seems like sweeping problem under the rug. There is enhancement #116818 about more
flexible (e.g. user customizable) logger statement.
Comment 2 Vince Kraemer 2008-02-06 17:26:09 UTC
this is really a dup of 116818
Comment 3 Vince Kraemer 2008-02-06 17:26:34 UTC

*** This issue has been marked as a duplicate of 116818 ***