Skip to content

Commit 16f109f

Browse files
committed
Added require to Utils#startServiceOnPort
1 parent c39d8b6 commit 16f109f

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,10 +1879,9 @@ private[spark] object Utils extends Logging {
18791879
conf: SparkConf,
18801880
serviceName: String = ""): (T, Int) = {
18811881

1882-
if (startPort != 0 && (startPort < 1024 || startPort >= 65536)) {
1883-
throw new IllegalArgumentException("startPort should be between " +
1882+
require(startPort == 0 || 1024 <= startPort && startPort < 65536,
1883+
"startPort should be between " +
18841884
"1024(including) and 65536(excluding) or 0(for a random free port).")
1885-
}
18861885

18871886
val serviceString = if (serviceName.isEmpty) "" else s" '$serviceName'"
18881887
val maxRetries = portMaxRetries(conf)

external/flume/src/test/scala/org/apache/spark/streaming/flume/FlumeStreamSuite.scala

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,13 @@ package org.apache.spark.streaming.flume
2020
import java.net.{InetSocketAddress, ServerSocket}
2121
import java.nio.ByteBuffer
2222

23-
import org.apache.commons.lang3.RandomUtils
24-
2523
import scala.collection.JavaConversions._
2624
import scala.collection.mutable.{ArrayBuffer, SynchronizedBuffer}
2725
import scala.concurrent.duration._
2826
import scala.language.postfixOps
2927

3028
import com.google.common.base.Charsets
29+
import org.apache.commons.lang3.RandomUtils
3130
import org.apache.avro.ipc.NettyTransceiver
3231
import org.apache.avro.ipc.specific.SpecificRequestor
3332
import org.apache.flume.source.avro

0 commit comments

Comments
 (0)