Skip to content

Commit 76e0327

Browse files
committed
connect to remote repl only when hostname and port is set (fixes #110)
1 parent 5068751 commit 76e0327

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/javarepl/Main.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,10 @@ private static String welcomeInstructions() {
111111
private static JavaREPLClient clientFor(Option<String> hostname, Option<Integer> port) throws Exception {
112112
console.printInfo(welcomeMessage());
113113

114-
if (hostname.isEmpty() && port.isEmpty()) {
115-
return startNewLocalInstance("localhost", randomServerPort());
114+
if (hostname.isDefined() && port.isDefined()) {
115+
return connectToRemoteInstance(hostname.get(), port.getOrElse(randomServerPort()));
116116
} else {
117-
return connectToRemoteInstance(hostname.getOrElse("localhost"), port.getOrElse(randomServerPort()));
117+
return startNewLocalInstance("localhost", port.getOrElse(randomServerPort()));
118118
}
119119
}
120120

0 commit comments

Comments
 (0)