mirror of
https://github.com/corda/corda.git
synced 2025-02-21 01:42:24 +00:00
CORDA-2744 - Prevent ClassCastException if error during initial registration (#5712)
* Prevent class cast exception if error during initial registration * Appeasing detekt
This commit is contained in:
parent
7d5c59e9cc
commit
4a8c73bf4a
@ -84,10 +84,14 @@ class InitialRegistration(val baseDirectory: Path, private val networkRootTrustS
|
||||
}
|
||||
|
||||
private fun initialRegistration(config: NodeConfiguration) {
|
||||
// Null checks for [compatibilityZoneURL], [rootTruststorePath] and [rootTruststorePassword] has been done in [CmdLineOptions.loadConfig]
|
||||
attempt { registerWithNetwork(config) }.doOnFailure(Consumer(this::handleRegistrationError)) as Try.Success
|
||||
// At this point the node registration was successful. We can delete the marker file.
|
||||
deleteNodeRegistrationMarker(baseDirectory)
|
||||
// Null checks for [compatibilityZoneURL], [rootTruststorePath] and
|
||||
// [rootTruststorePassword] have been done in [CmdLineOptions.loadConfig]
|
||||
val result = attempt { registerWithNetwork(config) }.doOnFailure(Consumer(this::handleRegistrationError))
|
||||
|
||||
if (result.isSuccess) {
|
||||
// At this point the node registration was successful. We can delete the marker file.
|
||||
deleteNodeRegistrationMarker(baseDirectory)
|
||||
}
|
||||
}
|
||||
|
||||
private fun deleteNodeRegistrationMarker(baseDir: Path) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user