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 - surround with try/catch adds poor code
Summary: surround with try/catch adds poor code
Status: RESOLVED DUPLICATE of bug 116818
Alias: None
Product: java
Classification: Unclassified
Component: Hints (show other bugs)
Version: 6.x
Hardware: All All
: P3 blocker (vote)
Assignee: Jan Lahoda
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-02-05 17:39 UTC by Vince Kraemer
Modified: 2008-02-06 17:26 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 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 ***