Skip to content

Commit

Permalink
Move logic to correct function (oops)
Browse files Browse the repository at this point in the history
  • Loading branch information
holdenk committed Sep 2, 2015
1 parent 0235a6a commit bf324c4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mllib/src/main/scala/org/apache/spark/ml/param/params.scala
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,8 @@ trait Params extends Identifiable with Serializable {
*/
final def getOrDefault[T](param: Param[T]): T = {
shouldOwn(param)
get(param).orElse(getDefault(param)).get
get(param).orElse(getDefault(param)).getOrElse(
throw new NoSuchElementException(s"Failed to find a default value for ${param.name}"))
}

/** An alias for [[getOrDefault()]]. */
Expand Down Expand Up @@ -501,8 +502,7 @@ trait Params extends Identifiable with Serializable {
*/
final def getDefault[T](param: Param[T]): Option[T] = {
shouldOwn(param)
defaultParamMap.getOrElse(param,
throw new NoSuchElementException(s"Failed to find a default value for ${param.name}"))
defaultParamMap.get(param)
}

/**
Expand Down

0 comments on commit bf324c4

Please sign in to comment.