mirror of
https://github.com/corda/corda.git
synced 2025-06-13 12:48:18 +00:00
ENT-11351 - Compiler warnings pass 1 (#7652)
* Removed warnings - pass 1 * Resolve detekt errors * Properly compare X500 distinguished names
This commit is contained in:
@ -67,8 +67,8 @@ internal class AMQPChannelHandler(private val serverMode: Boolean,
|
||||
try {
|
||||
MDC.put("serverMode", serverMode.toString())
|
||||
MDC.put("remoteAddress", if (::remoteAddress.isInitialized) remoteAddress.toString() else null)
|
||||
MDC.put("localCert", localCert?.subjectDN?.toString())
|
||||
MDC.put("remoteCert", remoteCert?.subjectDN?.toString())
|
||||
MDC.put("localCert", localCert?.getSubjectX500Principal()?.toString())
|
||||
MDC.put("remoteCert", remoteCert?.getSubjectX500Principal()?.toString())
|
||||
MDC.put("allowedRemoteLegalNames", allowedRemoteLegalNames?.joinToString(separator = ";") { it.toString() })
|
||||
block()
|
||||
} finally {
|
||||
|
@ -5,6 +5,6 @@ import java.security.cert.X509Certificate
|
||||
|
||||
data class ConnectionChange(val remoteAddress: InetSocketAddress, val remoteCert: X509Certificate?, val connected: Boolean, val connectionResult: ConnectionResult) {
|
||||
override fun toString(): String {
|
||||
return "ConnectionChange remoteAddress: $remoteAddress connected state: $connected cert subject: ${remoteCert?.subjectDN} result: ${connectionResult}"
|
||||
return "ConnectionChange remoteAddress: $remoteAddress connected state: $connected cert subject: ${remoteCert?.getSubjectX500Principal()} result: ${connectionResult}"
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package net.corda.nodeapi.internal.protonwrapper.netty
|
||||
import com.typesafe.config.Config
|
||||
import net.corda.nodeapi.internal.config.ConfigParser
|
||||
import net.corda.nodeapi.internal.config.CustomConfigParser
|
||||
import java.util.Locale
|
||||
|
||||
/**
|
||||
* Data structure for controlling the way how Certificate Revocation Lists are handled.
|
||||
@ -58,7 +59,7 @@ class RevocationConfigParser : ConfigParser<RevocationConfig> {
|
||||
require(allKeys.size == 1 && allKeys.contains(oneAndTheOnly)) {"For RevocationConfig, it is expected to have '$oneAndTheOnly' property only. " +
|
||||
"Actual set of properties: $allKeys. Please check 'revocationConfig' section."}
|
||||
val mode = config.getString(oneAndTheOnly)
|
||||
return when (mode.toUpperCase()) {
|
||||
return when (mode.uppercase(Locale.getDefault())) {
|
||||
"SOFT_FAIL" -> RevocationConfigImpl(RevocationConfig.Mode.SOFT_FAIL)
|
||||
"HARD_FAIL" -> RevocationConfigImpl(RevocationConfig.Mode.HARD_FAIL)
|
||||
"EXTERNAL_SOURCE" -> RevocationConfigImpl(RevocationConfig.Mode.EXTERNAL_SOURCE, null) // null for now till `enrichExternalCrlSource` is called
|
||||
|
@ -40,6 +40,7 @@ import java.security.cert.CertificateException
|
||||
import java.security.cert.PKIXBuilderParameters
|
||||
import java.security.cert.X509CertSelector
|
||||
import java.security.cert.X509Certificate
|
||||
import java.util.Locale
|
||||
import java.util.concurrent.Executor
|
||||
import java.util.concurrent.ThreadPoolExecutor
|
||||
import javax.net.ssl.CertPathTrustManagerParameters
|
||||
@ -349,5 +350,5 @@ internal fun x500toHostName(x500Name: CordaX500Name): String {
|
||||
val secureHash = SecureHash.sha256(x500Name.toString())
|
||||
// RFC 1035 specifies a limit 255 bytes for hostnames with each label being 63 bytes or less. Due to this, the string
|
||||
// representation of the SHA256 hash is truncated to 32 characters.
|
||||
return String.format(HOSTNAME_FORMAT, secureHash.toString().take(32).toLowerCase())
|
||||
return String.format(HOSTNAME_FORMAT, secureHash.toString().take(32).lowercase(Locale.getDefault()))
|
||||
}
|
||||
|
@ -187,7 +187,7 @@ object InputStreamSerializer : Serializer<InputStream>() {
|
||||
chunks.add(chunk)
|
||||
}
|
||||
}
|
||||
val flattened = ByteArray(chunks.sumBy { it.size })
|
||||
val flattened = ByteArray(chunks.sumOf { it.size })
|
||||
var offset = 0
|
||||
for (chunk in chunks) {
|
||||
System.arraycopy(chunk, 0, flattened, offset, chunk.size)
|
||||
|
Reference in New Issue
Block a user