Skip to content

Commit 0e879c8

Browse files
committed
Fix:Modify to prevent some possible runtime exception
Signed-off-by: liuxian <[email protected]>
1 parent 823baca commit 0e879c8

File tree

12 files changed

+21
-20
lines changed

12 files changed

+21
-20
lines changed

core/src/main/scala/org/apache/spark/api/python/PythonRDD.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,7 +879,7 @@ private[spark] class PythonAccumulatorV2(
879879
private val serverPort: Int)
880880
extends CollectionAccumulator[Array[Byte]] {
881881

882-
Utils.checkHost(serverHost, "Expected hostname")
882+
Utils.checkHost(serverHost)
883883

884884
val bufferSize = SparkEnv.get.conf.getInt("spark.buffer.size", 65536)
885885

core/src/main/scala/org/apache/spark/deploy/DeployMessage.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ private[deploy] object DeployMessages {
4343
memory: Int,
4444
workerWebUiUrl: String)
4545
extends DeployMessage {
46-
Utils.checkHost(host, "Required hostname")
46+
Utils.checkHost(host)
4747
assert (port > 0)
4848
}
4949

@@ -131,7 +131,7 @@ private[deploy] object DeployMessages {
131131

132132
// TODO(matei): replace hostPort with host
133133
case class ExecutorAdded(id: Int, workerId: String, hostPort: String, cores: Int, memory: Int) {
134-
Utils.checkHostPort(hostPort, "Required hostport")
134+
Utils.checkHostPort(hostPort)
135135
}
136136

137137
case class ExecutorUpdated(id: Int, state: ExecutorState, message: Option[String],
@@ -183,7 +183,7 @@ private[deploy] object DeployMessages {
183183
completedDrivers: Array[DriverInfo],
184184
status: MasterState) {
185185

186-
Utils.checkHost(host, "Required hostname")
186+
Utils.checkHost(host)
187187
assert (port > 0)
188188

189189
def uri: String = "spark://" + host + ":" + port
@@ -201,7 +201,7 @@ private[deploy] object DeployMessages {
201201
drivers: List[DriverRunner], finishedDrivers: List[DriverRunner], masterUrl: String,
202202
cores: Int, memory: Int, coresUsed: Int, memoryUsed: Int, masterWebUiUrl: String) {
203203

204-
Utils.checkHost(host, "Required hostname")
204+
Utils.checkHost(host)
205205
assert (port > 0)
206206
}
207207

core/src/main/scala/org/apache/spark/deploy/master/Master.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ private[deploy] class Master(
8080
private val waitingDrivers = new ArrayBuffer[DriverInfo]
8181
private var nextDriverNumber = 0
8282

83-
Utils.checkHost(address.host, "Expected hostname")
83+
Utils.checkHost(address.host)
8484

8585
private val masterMetricsSystem = MetricsSystem.createMetricsSystem("master", conf, securityMgr)
8686
private val applicationMetricsSystem = MetricsSystem.createMetricsSystem("applications", conf,

core/src/main/scala/org/apache/spark/deploy/master/MasterArguments.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,12 +60,12 @@ private[master] class MasterArguments(args: Array[String], conf: SparkConf) exte
6060
@tailrec
6161
private def parse(args: List[String]): Unit = args match {
6262
case ("--ip" | "-i") :: value :: tail =>
63-
Utils.checkHost(value, "ip no longer supported, please use hostname " + value)
63+
Utils.checkHost(value)
6464
host = value
6565
parse(tail)
6666

6767
case ("--host" | "-h") :: value :: tail =>
68-
Utils.checkHost(value, "Please use hostname " + value)
68+
Utils.checkHost(value)
6969
host = value
7070
parse(tail)
7171

core/src/main/scala/org/apache/spark/deploy/master/WorkerInfo.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ private[spark] class WorkerInfo(
3232
val webUiAddress: String)
3333
extends Serializable {
3434

35-
Utils.checkHost(host, "Expected hostname")
35+
Utils.checkHost(host)
3636
assert (port > 0)
3737

3838
@transient var executors: mutable.HashMap[String, ExecutorDesc] = _ // executorId => info

core/src/main/scala/org/apache/spark/deploy/worker/Worker.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private[deploy] class Worker(
5555
private val host = rpcEnv.address.host
5656
private val port = rpcEnv.address.port
5757

58-
Utils.checkHost(host, "Expected hostname")
58+
Utils.checkHost(host)
5959
assert (port > 0)
6060

6161
// A scheduled executor used to send messages at the specified time.

core/src/main/scala/org/apache/spark/deploy/worker/WorkerArguments.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ private[worker] class WorkerArguments(args: Array[String], conf: SparkConf) {
6868
@tailrec
6969
private def parse(args: List[String]): Unit = args match {
7070
case ("--ip" | "-i") :: value :: tail =>
71-
Utils.checkHost(value, "ip no longer supported, please use hostname " + value)
71+
Utils.checkHost(value)
7272
host = value
7373
parse(tail)
7474

7575
case ("--host" | "-h") :: value :: tail =>
76-
Utils.checkHost(value, "Please use hostname " + value)
76+
Utils.checkHost(value)
7777
host = value
7878
parse(tail)
7979

core/src/main/scala/org/apache/spark/executor/Executor.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ private[spark] class Executor(
7171
private val conf = env.conf
7272

7373
// No ip or host:port - just hostname
74-
Utils.checkHost(executorHostname, "Expected executed slave to be a hostname")
74+
Utils.checkHost(executorHostname)
7575
// must not have port specified.
7676
assert (0 == Utils.parseHostPort(executorHostname)._2)
7777

core/src/main/scala/org/apache/spark/storage/BlockManagerId.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class BlockManagerId private (
4646
def executorId: String = executorId_
4747

4848
if (null != host_) {
49-
Utils.checkHost(host_, "Expected hostname")
49+
Utils.checkHost(host_)
5050
assert (port_ > 0)
5151
}
5252

core/src/main/scala/org/apache/spark/util/RpcUtils.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ private[spark] object RpcUtils {
2828
def makeDriverRef(name: String, conf: SparkConf, rpcEnv: RpcEnv): RpcEndpointRef = {
2929
val driverHost: String = conf.get("spark.driver.host", "localhost")
3030
val driverPort: Int = conf.getInt("spark.driver.port", 7077)
31-
Utils.checkHost(driverHost, "Expected hostname")
31+
Utils.checkHost(driverHost)
3232
rpcEnv.setupEndpointRef(RpcAddress(driverHost, driverPort), name)
3333
}
3434

0 commit comments

Comments
 (0)