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
13 changes: 10 additions & 3 deletions repl/src/main/scala/org/apache/spark/repl/SparkILoop.scala
Original file line number Diff line number Diff line change
Expand Up @@ -182,10 +182,17 @@ class SparkILoop(in0: Option[BufferedReader], protected val out: JPrintWriter,

/** Create a new interpreter. */
def createInterpreter() {
if (addedClasspath != "")
settings.classpath append addedClasspath
if (settings != null) {
if (addedClasspath != "")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I realize you didn't write this but mind cleaning up this code?

if (addedClasspath != "") settings.classpath.append(addedClasspath)

settings.classpath append addedClasspath

intp = new SparkILoopInterpreter
// work around for Scala bug
val totalClassPath = SparkILoop.getAddedJars.foldLeft(
settings.classpath.value)((l, r) => ClassPath.join(l, r))
this.settings.classpath.value = totalClassPath

intp = new SparkILoopInterpreter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be outside of the if? Not sure //cc @ScrapCodes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

en...my idea is that settings will be passed as the parameter of the SparkIMain...so we'd better not create anything when it is null....maybe we should have an "else throw SparkException("...")"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's invalid to have settings null here. I'd just add at the top of the function require(settings != null). Then you'll get an exception if that ever happens and you can remove the block.

}
}

/** print a friendly help message */
Expand Down