Skip to content

Commit 2398bde

Browse files
committed
Avoid use of JDBC4-only isClosed()
1 parent 75fdccc commit 2398bde

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

core/src/main/scala/org/apache/spark/rdd/JdbcRDD.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,21 +99,21 @@ class JdbcRDD[T: ClassTag](
9999

100100
override def close() {
101101
try {
102-
if (null != rs && ! rs.isClosed()) {
102+
if (null != rs) {
103103
rs.close()
104104
}
105105
} catch {
106106
case e: Exception => logWarning("Exception closing resultset", e)
107107
}
108108
try {
109-
if (null != stmt && ! stmt.isClosed()) {
109+
if (null != stmt) {
110110
stmt.close()
111111
}
112112
} catch {
113113
case e: Exception => logWarning("Exception closing statement", e)
114114
}
115115
try {
116-
if (null != conn && ! conn.isClosed()) {
116+
if (null != conn) {
117117
conn.close()
118118
}
119119
logInfo("closed connection")

sql/core/src/main/scala/org/apache/spark/sql/jdbc/JDBCRDD.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -369,21 +369,21 @@ private[sql] class JDBCRDD(
369369
def close() {
370370
if (closed) return
371371
try {
372-
if (null != rs && ! rs.isClosed()) {
372+
if (null != rs) {
373373
rs.close()
374374
}
375375
} catch {
376376
case e: Exception => logWarning("Exception closing resultset", e)
377377
}
378378
try {
379-
if (null != stmt && ! stmt.isClosed()) {
379+
if (null != stmt) {
380380
stmt.close()
381381
}
382382
} catch {
383383
case e: Exception => logWarning("Exception closing statement", e)
384384
}
385385
try {
386-
if (null != conn && ! conn.isClosed()) {
386+
if (null != conn) {
387387
conn.close()
388388
}
389389
logInfo("closed connection")

0 commit comments

Comments
 (0)