From bdfa0085b7c24e19aff4bea60555167c67aaddab Mon Sep 17 00:00:00 2001 From: Gijs Weterings Date: Tue, 18 Mar 2025 06:08:17 -0700 Subject: [PATCH] Apply Nullsafe FIXMEs for xplat/js/react-native-github/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java (#50065) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/50065 Note this diff is only adding FIXMEs that will be removed in the next diff. This diff exists to make the next diff easily reviewable Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D71126388 fbshipit-source-id: a9f08b4ce101202cebe13107cc9c6a660deaf58f --- .../com/facebook/react/devsupport/BundleDownloader.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java index 4fca36c35d3..3d593d0b739 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/devsupport/BundleDownloader.java @@ -141,8 +141,10 @@ public class BundleDownloader { // Make sure the result is a multipart response and parse the boundary. String contentType = response.header("content-type"); Pattern regex = Pattern.compile("multipart/mixed;.*boundary=\"([^\"]+)\""); + // NULLSAFE_FIXME[Parameter Not Nullable] Matcher match = regex.matcher(contentType); if (match.find()) { + // NULLSAFE_FIXME[Parameter Not Nullable] processMultipartResponse(url, r, match.group(1), outputFile, bundleInfo, callback); } else { // In case the server doesn't support multipart/mixed responses, fallback to normal @@ -152,8 +154,10 @@ public class BundleDownloader { url, r.code(), r.headers(), + // NULLSAFE_FIXME[Nullable Dereference] r.body().source(), outputFile, + // NULLSAFE_FIXME[Parameter Not Nullable] bundleInfo, callback); } @@ -173,6 +177,7 @@ public class BundleDownloader { throws IOException { MultipartStreamReader bodyReader = + // NULLSAFE_FIXME[Nullable Dereference] new MultipartStreamReader(response.body().source(), boundary); boolean completed = bodyReader.readAllParts( @@ -192,6 +197,7 @@ public class BundleDownloader { status = Integer.parseInt(headers.get("X-Http-Status")); } processBundleResult( + // NULLSAFE_FIXME[Parameter Not Nullable] url, status, Headers.of(headers), body, outputFile, bundleInfo, callback); } else { if (!headers.containsKey("Content-Type")