mirror of
https://github.com/square/okhttp.git
synced 2025-07-31 05:04:26 +03:00
Replace !isEmpty with isNotEmpty
This commit is contained in:
@ -103,7 +103,7 @@ class DnsOverHttps internal constructor(builder: Builder) : Dns {
|
|||||||
|
|
||||||
executeRequests(hostname, networkRequests, results, failures)
|
executeRequests(hostname, networkRequests, results, failures)
|
||||||
|
|
||||||
return if (!results.isEmpty()) {
|
return if (results.isNotEmpty()) {
|
||||||
results
|
results
|
||||||
} else {
|
} else {
|
||||||
throwBestFailure(hostname, failures)
|
throwBestFailure(hostname, failures)
|
||||||
|
@ -357,7 +357,7 @@ class HeldCertificate(private val keyPair: KeyPair, private val certificate: X50
|
|||||||
BasicConstraints(maxIntermediateCas))
|
BasicConstraints(maxIntermediateCas))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!altNames.isEmpty()) {
|
if (altNames.isNotEmpty()) {
|
||||||
val encodableAltNames = arrayOfNulls<ASN1Encodable>(altNames.size)
|
val encodableAltNames = arrayOfNulls<ASN1Encodable>(altNames.size)
|
||||||
for (i in 0 until altNames.size) {
|
for (i in 0 until altNames.size) {
|
||||||
val altName = altNames[i]
|
val altName = altNames[i]
|
||||||
|
@ -27,19 +27,15 @@ object RequestLine {
|
|||||||
* [HttpURLConnection.getHeaderFields], so it needs to be set even if the transport is
|
* [HttpURLConnection.getHeaderFields], so it needs to be set even if the transport is
|
||||||
* HTTP/2.
|
* HTTP/2.
|
||||||
*/
|
*/
|
||||||
fun get(request: Request, proxyType: Proxy.Type): String {
|
fun get(request: Request, proxyType: Proxy.Type) = buildString {
|
||||||
val result = StringBuilder()
|
append(request.method)
|
||||||
result.append(request.method)
|
append(' ')
|
||||||
result.append(' ')
|
|
||||||
|
|
||||||
if (includeAuthorityInRequestLine(request, proxyType)) {
|
if (includeAuthorityInRequestLine(request, proxyType)) {
|
||||||
result.append(request.url)
|
append(request.url)
|
||||||
} else {
|
} else {
|
||||||
result.append(requestPath(request.url))
|
append(requestPath(request.url))
|
||||||
}
|
}
|
||||||
|
append(" HTTP/1.1")
|
||||||
result.append(" HTTP/1.1")
|
|
||||||
return result.toString()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -128,10 +128,10 @@ object Http2 {
|
|||||||
if (flags == 0) return ""
|
if (flags == 0) return ""
|
||||||
when (type) {
|
when (type) {
|
||||||
// Special case types that have 0 or 1 flag.
|
// Special case types that have 0 or 1 flag.
|
||||||
TYPE_SETTINGS, TYPE_PING -> return if (flags == FLAG_ACK) "ACK" else BINARY[flags]!!
|
TYPE_SETTINGS, TYPE_PING -> return if (flags == FLAG_ACK) "ACK" else BINARY[flags]
|
||||||
TYPE_PRIORITY, TYPE_RST_STREAM, TYPE_GOAWAY, TYPE_WINDOW_UPDATE -> return BINARY[flags]!!
|
TYPE_PRIORITY, TYPE_RST_STREAM, TYPE_GOAWAY, TYPE_WINDOW_UPDATE -> return BINARY[flags]
|
||||||
}
|
}
|
||||||
val result = if (flags < FLAGS.size) FLAGS[flags]!! else BINARY[flags]!!
|
val result = if (flags < FLAGS.size) FLAGS[flags]!! else BINARY[flags]
|
||||||
// Special case types that have overlap flag values.
|
// Special case types that have overlap flag values.
|
||||||
return when {
|
return when {
|
||||||
type == TYPE_PUSH_PROMISE && flags and FLAG_END_PUSH_PROMISE != 0 -> {
|
type == TYPE_PUSH_PROMISE && flags and FLAG_END_PUSH_PROMISE != 0 -> {
|
||||||
|
@ -231,7 +231,7 @@ class RealWebSocket(
|
|||||||
executor!!.scheduleAtFixedRate(
|
executor!!.scheduleAtFixedRate(
|
||||||
PingRunnable(), pingIntervalMillis, pingIntervalMillis, MILLISECONDS)
|
PingRunnable(), pingIntervalMillis, pingIntervalMillis, MILLISECONDS)
|
||||||
}
|
}
|
||||||
if (!messageAndCloseQueue.isEmpty()) {
|
if (messageAndCloseQueue.isNotEmpty()) {
|
||||||
runWriter() // Send messages that were enqueued before we were connected.
|
runWriter() // Send messages that were enqueued before we were connected.
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user