mirror of
https://github.com/corda/corda.git
synced 2025-06-20 08:03:53 +00:00
Split up the parsing of the command line arguments from the parsing of the config files. (#547)
Also, the "config-file" command line argument for the doorman jar is required - it no longer defaults to network-management.conf
This commit is contained in:
@ -19,6 +19,7 @@ import net.corda.core.internal.uncheckedCast
|
||||
import net.corda.core.utilities.NetworkHostAndPort
|
||||
import org.slf4j.LoggerFactory
|
||||
import java.lang.reflect.Field
|
||||
import java.lang.reflect.InvocationTargetException
|
||||
import java.lang.reflect.Modifier.isStatic
|
||||
import java.lang.reflect.ParameterizedType
|
||||
import java.net.Proxy
|
||||
@ -74,19 +75,20 @@ fun <T : Any> Config.parseAs(clazz: KClass<T>, strict: Boolean = true): T {
|
||||
val path = defaultToOldPath(property)
|
||||
getValueInternal<Any>(path, param.type, strict)
|
||||
}
|
||||
return constructor.callBy(args)
|
||||
try {
|
||||
return constructor.callBy(args)
|
||||
} catch (e: InvocationTargetException) {
|
||||
throw e.cause!!
|
||||
}
|
||||
}
|
||||
|
||||
class UnknownConfigurationKeysException private constructor(val unknownKeys: Set<String>) : IllegalArgumentException(message(unknownKeys)) {
|
||||
|
||||
init {
|
||||
require(unknownKeys.isNotEmpty()) { "Absence of unknown keys should not raise UnknownConfigurationKeysException." }
|
||||
}
|
||||
|
||||
companion object {
|
||||
|
||||
fun of(offendingKeys: Set<String>): UnknownConfigurationKeysException = UnknownConfigurationKeysException(offendingKeys)
|
||||
|
||||
private fun message(offendingKeys: Set<String>) = "Unknown configuration keys: ${offendingKeys.joinToString(", ", "[", "]")}."
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user