Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Try with if-else
  • Loading branch information
HyukjinKwon committed Apr 27, 2017
commit b5c9839476fe0ddfe2a194afd89a68542c749a6f
10 changes: 7 additions & 3 deletions core/src/main/scala/org/apache/spark/util/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -740,9 +740,13 @@ private[spark] object Utils extends Logging {
* always return a single directory.
*/
def getLocalDir(conf: SparkConf): String = {
getOrCreateLocalRootDirs(conf).headOption.getOrElse {
val dirPaths = getConfiguredLocalDirs(conf)
throw new IOException(s"Failed to get a temp directory under [${dirPaths.mkString(",")}].")
val localRootDirs = getOrCreateLocalRootDirs(conf)
if (localRootDirs.nonEmpty) {
localRootDirs(0)
} else {
val configuredLocalDirs = getConfiguredLocalDirs(conf)
throw new IOException(
s"Failed to get a temp directory under [${configuredLocalDirs.mkString(",")}].")
}
}

Expand Down