Ticket #730 (closed task: fixed)
Removal of e.printStackTrace() from the codebase
| Reported by: | callan | Owned by: | dwhitehurst-x |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | General | Version: | |
| Keywords: | Cc: | jmoore |
Description
There should be no locations where e.printStackTrace() is used as it only drops debugging information on the console.
For example:
try { compressThumbnailToDisk(metadata, image); } catch (IOException e) { e.printStackTrace(); throw new ResourceError(e.getMessage()); }
should be...
try { compressThumbnailToDisk(metadata, image); } catch (IOException e) { final Writer result = new StringWriter(); final PrintWriter printWriter = new PrintWriter(result); e.printStackTrace(printWriter); log.error(result.toString()); throw new ResourceError(e.getMessage() + " Please check server log."); }
If needed, the logger should be created in the class as follows:
/** The logger for this class. */ private static Log log = LogFactory.getLog(ThumbnailBean.class);
Change History
Note: See
TracTickets for help on using
tickets.
