mirror of https://github.com/sbt/sbt.git
[2.x] fix: Error "Exception in thread "sbt-socket-server" java.lang.NullPointerException" on exit (#8448)
Fixes #8538 The code was calling e.getMessage.contains() without checking if getMessage() returns null. Changed to use Option(e.getMessage).exists() to safely handle null values.
This commit is contained in:
parent
7368252678
commit
dce915e794
|
|
@ -114,8 +114,8 @@ private[sbt] object Server {
|
||||||
val socket = serverSocket.accept()
|
val socket = serverSocket.accept()
|
||||||
onIncomingSocket(socket, self)
|
onIncomingSocket(socket, self)
|
||||||
} catch {
|
} catch {
|
||||||
case e: IOException if e.getMessage.contains("connect") =>
|
case e: IOException if Option(e.getMessage).exists(_.contains("connect")) =>
|
||||||
case _: SocketTimeoutException => // its ok
|
case _: SocketTimeoutException => // its ok
|
||||||
case _: SocketException if !running.get => // the server is shutting down
|
case _: SocketException if !running.get => // the server is shutting down
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue