Skip to content

Commit bf324c4

Browse files
committed
Move logic to correct function (oops)
1 parent 0235a6a commit bf324c4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

mllib/src/main/scala/org/apache/spark/ml/param/params.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,8 @@ trait Params extends Identifiable with Serializable {
461461
*/
462462
final def getOrDefault[T](param: Param[T]): T = {
463463
shouldOwn(param)
464-
get(param).orElse(getDefault(param)).get
464+
get(param).orElse(getDefault(param)).getOrElse(
465+
throw new NoSuchElementException(s"Failed to find a default value for ${param.name}"))
465466
}
466467

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

508508
/**

0 commit comments

Comments
 (0)