Skip to content

Commit 349d8cc

Browse files
authored
Merge branch 'main' into strictmode_diskread_violation
2 parents 3984f42 + 0e81807 commit 349d8cc

File tree

6 files changed

+30
-20
lines changed

6 files changed

+30
-20
lines changed

firebase-functions/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Unreleased
22

3+
- [changed] Bumped dependency on OkHTTP to version 4.12.0 from version 3.12.13. If your app depends
4+
on OkHTTP version 3.x the change is both binary- and Java source-compatible, with a few small
5+
exceptions. See https://square.github.io/okhttp/changelogs/upgrading_to_okhttp_4/ for more
6+
details.
7+
38
# 22.0.1
49

510
- [changed] Bumped internal dependencies.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version=22.0.2
1+
version=22.1.0
22
latestReleasedVersion=22.0.1
33
android.enableUnitTestBinaryResources=true

firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctions.kt

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,10 @@ import java.util.concurrent.Executor
3838
import javax.inject.Named
3939
import okhttp3.Call
4040
import okhttp3.Callback
41-
import okhttp3.MediaType
41+
import okhttp3.MediaType.Companion.toMediaTypeOrNull
4242
import okhttp3.OkHttpClient
4343
import okhttp3.Request
44-
import okhttp3.RequestBody
44+
import okhttp3.RequestBody.Companion.toRequestBody
4545
import okhttp3.Response
4646
import org.json.JSONException
4747
import org.json.JSONObject
@@ -87,7 +87,7 @@ internal constructor(
8787
try {
8888
URL(regionOrCustomDomain)
8989
false
90-
} catch (malformedURLException: MalformedURLException) {
90+
} catch (_: MalformedURLException) {
9191
true
9292
}
9393
if (isRegion) {
@@ -227,8 +227,8 @@ internal constructor(
227227
val encoded = serializer.encode(data)
228228
body["data"] = encoded
229229
val bodyJSON = JSONObject(body)
230-
val contentType = MediaType.parse("application/json")
231-
val requestBody = RequestBody.create(contentType, bodyJSON.toString())
230+
val contentType = "application/json".toMediaTypeOrNull()
231+
val requestBody = bodyJSON.toString().toRequestBody(contentType)
232232
var request = Request.Builder().url(url).post(requestBody)
233233
if (context!!.authToken != null) {
234234
request = request.header("Authorization", "Bearer " + context.authToken)
@@ -268,8 +268,8 @@ internal constructor(
268268

269269
@Throws(IOException::class)
270270
override fun onResponse(ignored: Call, response: Response) {
271-
val code = fromHttpStatus(response.code())
272-
val bodyAsString = response.body()!!.string()
271+
val code = fromHttpStatus(response.code)
272+
val bodyAsString = response.body!!.string()
273273
val exception = fromResponse(code, bodyAsString, serializer)
274274
if (exception != null) {
275275
tcs.setException(exception)

firebase-functions/src/main/java/com/google/firebase/functions/PublisherStream.kt

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import java.util.concurrent.Executor
2828
import java.util.concurrent.atomic.AtomicLong
2929
import okhttp3.Call
3030
import okhttp3.Callback
31-
import okhttp3.MediaType
31+
import okhttp3.MediaType.Companion.toMediaTypeOrNull
3232
import okhttp3.OkHttpClient
3333
import okhttp3.Request
3434
import okhttp3.RequestBody
@@ -133,7 +133,7 @@ internal class PublisherStream(
133133
val configuredClient = options.apply(client)
134134
val requestBody =
135135
RequestBody.create(
136-
MediaType.parse("application/json"),
136+
"application/json".toMediaTypeOrNull(),
137137
JSONObject(mapOf("data" to serializer.encode(data))).toString()
138138
)
139139
val request =
@@ -167,7 +167,7 @@ internal class PublisherStream(
167167

168168
override fun onResponse(call: Call, response: Response) {
169169
validateResponse(response)
170-
val bodyStream = response.body()?.byteStream()
170+
val bodyStream = response.body?.byteStream()
171171
if (bodyStream != null) {
172172
processSSEStream(bodyStream)
173173
} else {
@@ -309,21 +309,21 @@ internal class PublisherStream(
309309

310310
val errorMessage: String
311311
if (
312-
response.code() == 404 &&
313-
MediaType.parse(response.header("Content-Type") ?: "")?.subtype() == "html"
312+
response.code == 404 &&
313+
(response.header("Content-Type") ?: "").toMediaTypeOrNull()?.subtype == "html"
314314
) {
315-
errorMessage = """URL not found. Raw response: ${response.body()?.string()}""".trimMargin()
315+
errorMessage = """URL not found. Raw response: ${response.body?.string()}""".trimMargin()
316316
notifyError(
317317
FirebaseFunctionsException(
318318
errorMessage,
319-
FirebaseFunctionsException.Code.fromHttpStatus(response.code()),
319+
FirebaseFunctionsException.Code.fromHttpStatus(response.code),
320320
null
321321
)
322322
)
323323
return
324324
}
325325

326-
val text = response.body()?.string() ?: ""
326+
val text = response.body?.string() ?: ""
327327
val error: Any?
328328
try {
329329
val json = JSONObject(text)

firebase-perf/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Unreleased
22

3+
- [changed] Bumped dependency on OkHTTP to version 4.12.0 from version 3.12.13. If your app depends
4+
on OkHTTP version 3.x the change is both binary- and Java source-compatible, with a few small
5+
exceptions. See https://square.github.io/okhttp/changelogs/upgrading_to_okhttp_4/ for more
6+
details.
7+
38
# 22.0.2
49

510
- [changed] Bumped internal dependencies.

gradle/libs.versions.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,14 @@ maven-resolver-provider = { module = "org.apache.maven:maven-resolver-provider",
163163
maven-resolver-transport-file = { module = "org.apache.maven.resolver:maven-resolver-transport-file", version.ref = "mavenResolverApi" }
164164
maven-resolver-transport-http = { module = "org.apache.maven.resolver:maven-resolver-transport-http", version.ref = "mavenResolverApi" }
165165
maven-resolver-util = { module = "org.apache.maven.resolver:maven-resolver-util", version.ref = "mavenResolverApi" }
166-
okhttp = { module = "com.squareup.okhttp3:okhttp", version = "3.12.13" }
166+
okhttp = { module = "com.squareup.okhttp3:okhttp", version = "4.12.0" }
167167
org-json = { module = "org.json:json", version = "20240303" }
168168
play-services-cloud-messaging = { module = "com.google.android.gms:play-services-cloud-messaging", version.ref = "playServicesCloudMessaging" }
169169
play-services-stats = { module = "com.google.android.gms:play-services-stats", version.ref = "playServicesStats" }
170170
play-services-vision = { module = "com.google.android.gms:play-services-vision", version.ref = "playServicesVision" }
171-
playservices-base = { module = "com.google.android.gms:play-services-base", version = "18.1.0" }
172-
playservices-basement = { module = "com.google.android.gms:play-services-basement", version = "18.8.0" }
173-
playservices-tasks = { module = "com.google.android.gms:play-services-tasks", version = "18.1.0" }
171+
playservices-base = { module = "com.google.android.gms:play-services-base", version = "18.9.0" }
172+
playservices-basement = { module = "com.google.android.gms:play-services-basement", version = "18.9.0" }
173+
playservices-tasks = { module = "com.google.android.gms:play-services-tasks", version = "18.4.0" }
174174
proto-google-common-protos = { module = "com.google.api.grpc:proto-google-common-protos", version.ref = "protoGoogleCommonProtos" }
175175
protobuf-java = { module = "com.google.protobuf:protobuf-java", version.ref = "javalite" }
176176
protobuf-java-lite = { module = "com.google.protobuf:protobuf-javalite", version.ref = "javalite" }

0 commit comments

Comments
 (0)