You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Stamatis Zampetakis (Jira)" <ji...@apache.org> on 2020/07/31 09:22:00 UTC
[jira] [Created] (CALCITE-4151) Forbid usages of
Exception#printStackTrace variants
Stamatis Zampetakis created CALCITE-4151:
--------------------------------------------
Summary: Forbid usages of Exception#printStackTrace variants
Key: CALCITE-4151
URL: https://issues.apache.org/jira/browse/CALCITE-4151
Project: Calcite
Issue Type: Improvement
Reporter: Stamatis Zampetakis
Assignee: Stamatis Zampetakis
Exception#printStackTrace is a convenient way to print stack trace related information to standard error and potentially other output streams. However, most of the time (if not always) is a bad idea to do so. There are many articles online, outlining why it is not a good idea to use these APIs.
Briefly instead of calling Exception#printStackTrace someone should:
* Log it using a logger and the appropriate level (e.g [LOG.error|http://www.slf4j.org/apidocs/org/slf4j/Logger.html#error(java.lang.String,java.lang.Throwable)], [LOG.info|http://www.slf4j.org/apidocs/org/slf4j/Logger.html#info(java.lang.String,java.lang.Throwable)], etc.)
* Re-throw the exception wrapping it if necessary
* Let the exception propagate and let other callers act as they see fit
In this issue we aim to replace existing calls with appropriate alternatives (as mentioned above) and add the API to the list of forbidden signatures.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)