dongjoon-hyun commented on a change in pull request #27721:
[SPARK-30970][K8S][Core] Fix NPE while resolving k8s master url
URL: https://github.com/apache/spark/pull/27721#discussion_r385028885
##########
File path: core/src/main/scala/org/apache/spark/util/Utils.scala
##########
@@ -2772,17 +2772,13 @@ private[spark] object Utils extends Logging {
}
val masterScheme = new URI(masterWithoutK8sPrefix).getScheme
- val resolvedURL = masterScheme.toLowerCase(Locale.ROOT) match {
- case "https" =>
+
+ val resolvedURL = Option(masterScheme).map(_.toLowerCase(Locale.ROOT))
match {
+ case Some("https") =>
masterWithoutK8sPrefix
- case "http" =>
+ case Some("http") =>
logWarning("Kubernetes master URL uses HTTP instead of HTTPS.")
masterWithoutK8sPrefix
- case null =>
- val resolvedURL = s"https://$masterWithoutK8sPrefix"
- logInfo("No scheme specified for kubernetes master URL, so defaulting
to https. Resolved " +
- s"URL is $resolvedURL.")
- resolvedURL
case _ =>
Review comment:
In the new logic, `None` case should map to
https://github.com/apache/spark/pull/27721/files#diff-d239aee594001f8391676e1047a0381eL2782-L2785
.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]