SPARK-1215: Clustering: Index out of bounds error

Bug fix for JIRA SPARK 1215: Clustering: Index out of bounds error

 https://issues.apache.org/jira/browse/SPARK-1215

Solution: Print warning, and use duplicate cluster centers so that exactly k centers are returned.
The code may be clearer if written in this way

~~~
centers(i) = 
  if (j == 0) {
    logWarning("...")
    points(0).toDense
  } else {
    points(j - 1).toDense
  }
~~~

or 

~~~
if (j == 0) {
  logWarning("...")
  centers(i) = points(0).toDense
} else {
  centers(i) = points(j - 1).toDense
}
~~~