[
https://issues.apache.org/jira/browse/OOZIE-2541?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15311407#comment-15311407
]
Robert Kanter commented on OOZIE-2541:
--------------------------------------
Plus, that Exception gets rethrown and handled elsewhere.
One minor thing:
- The {{con}} is only used in the first few lines in the {{try}}. The latter
code doesn't need to be in the {{try}}, and we can close the {{con}} before
that.
> Resource leak in Hive2Credentials
> ---------------------------------
>
> Key: OOZIE-2541
> URL: https://issues.apache.org/jira/browse/OOZIE-2541
> Project: Oozie
> Issue Type: Bug
> Components: core
> Reporter: Peter Bacsko
> Assignee: Peter Bacsko
> Priority: Trivial
> Attachments: OOZIE-2541-001.patch, OOZIE-2541-002.patch
>
>
> Connection to Hive is not closed in case of an SQLException:
> {code}
> Connection con = DriverManager.getConnection(url);
> XLog.getLog(getClass()).debug("Connected successfully to " + url);
> // get delegation token for the given proxy user
> String tokenStr =
> ((HiveConnection)con).getDelegationToken(jobconf.get(USER_NAME), principal);
> XLog.getLog(getClass()).debug("Got token");
> {code}
> Close the Connection in a finally block.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)