Skip to content

Commit

Permalink
SPARK-2869 - Fix tiny bug in JdbcRdd for closing jdbc connection (ref…
Browse files Browse the repository at this point in the history
…ormat with braces)
  • Loading branch information
javadba committed Aug 5, 2014
1 parent 6518d36 commit 363be4f
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions core/src/main/scala/org/apache/spark/rdd/JdbcRDD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -96,17 +96,23 @@ class JdbcRDD[T: ClassTag](

override def close() {
try {
if (null != rs && ! rs.isClosed()) rs.close()
if (null != rs && ! rs.isClosed()) {
rs.close()
}
} catch {
case e: Exception => logWarning("Exception closing resultset", e)
}
try {
if (null != stmt && ! stmt.isClosed()) stmt.close()
if (null != stmt && ! stmt.isClosed()) {
stmt.close()
}
} catch {
case e: Exception => logWarning("Exception closing statement", e)
}
try {
if (null != conn && ! conn.isClosed()) conn.close()
if (null != conn && ! conn.isClosed()) {
conn.close()
}
logInfo("closed connection")
} catch {
case e: Exception => logWarning("Exception closing connection", e)
Expand Down

0 comments on commit 363be4f

Please sign in to comment.