Skip to content

Commit e1c0727

Browse files
committed
update ut for redactPassword in JdbcUtils
1 parent b4a52e2 commit e1c0727

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

kyuubi-common/src/main/scala/org/apache/kyuubi/util/JdbcUtils.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ object JdbcUtils extends Logging {
100100

101101
def redactPassword(password: Option[String]): String = {
102102
password match {
103-
case Some(s) if !StringUtils.isBlank(s) => s"${"*" * s.length}(length:${s.length})"
104-
case None => "(empty)"
103+
case Some(s) if StringUtils.isNotBlank(s) => s"${"*" * s.length}(length:${s.length})"
104+
case _ => "(empty)"
105105
}
106106
}
107107
}

kyuubi-common/src/test/scala/org/apache/kyuubi/util/JdbcUtilsSuite.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,5 +69,15 @@ class JdbcUtilsSuite extends KyuubiFunSuite {
6969
assertResult("****************(length:16)") {
7070
JdbcUtils.redactPassword(Some("sample_pass_word"))
7171
}
72+
73+
assertResult("(empty)") {
74+
JdbcUtils.redactPassword(Some(""))
75+
}
76+
77+
assertResult("(empty)") {
78+
JdbcUtils.redactPassword(None)
79+
}
80+
81+
7282
}
7383
}

0 commit comments

Comments
 (0)