|
15 | 15 | import androidx.annotation.Nullable;
|
16 | 16 | import com.facebook.common.logging.FLog;
|
17 | 17 | import com.facebook.infer.annotation.Assertions;
|
| 18 | +import com.facebook.infer.annotation.Nullsafe; |
18 | 19 | import com.facebook.react.bridge.ReactContext;
|
19 | 20 | import com.facebook.react.common.ReactConstants;
|
20 | 21 | import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener;
|
|
59 | 60 | * <li>Genymotion emulator with default settings: 10.0.3.2
|
60 | 61 | * </ul>
|
61 | 62 | */
|
| 63 | +@Nullsafe(Nullsafe.Mode.LOCAL) |
62 | 64 | public class DevServerHelper {
|
63 | 65 | private static final int HTTP_CONNECT_TIMEOUT_MS = 5000;
|
64 | 66 |
|
@@ -205,11 +207,13 @@ public void openInspectorConnection() {
|
205 | 207 | protected Void doInBackground(Void... params) {
|
206 | 208 | Map<String, String> metadata =
|
207 | 209 | AndroidInfoHelpers.getInspectorHostMetadata(mApplicationContext);
|
208 |
| - |
| 210 | + String deviceName = metadata.get("deviceName"); |
| 211 | + if (deviceName == null) { |
| 212 | + FLog.w(ReactConstants.TAG, "Could not get device name from Inspector Host Metadata."); |
| 213 | + return null; |
| 214 | + } |
209 | 215 | mInspectorPackagerConnection =
|
210 |
| - new CxxInspectorPackagerConnection( |
211 |
| - // NULLSAFE_FIXME[Parameter Not Nullable] |
212 |
| - getInspectorDeviceUrl(), metadata.get("deviceName"), mPackageName); |
| 216 | + new CxxInspectorPackagerConnection(getInspectorDeviceUrl(), deviceName, mPackageName); |
213 | 217 | mInspectorPackagerConnection.connect();
|
214 | 218 | return null;
|
215 | 219 | }
|
@@ -448,12 +452,11 @@ public String getSourceUrl(String mainModuleName) {
|
448 | 452 | final Request request = new Request.Builder().url(resourceURL).build();
|
449 | 453 |
|
450 | 454 | try (Response response = mClient.newCall(request).execute()) {
|
451 |
| - if (!response.isSuccessful()) { |
| 455 | + if (!response.isSuccessful() || response.body() == null) { |
452 | 456 | return null;
|
453 | 457 | }
|
454 | 458 |
|
455 | 459 | try (Sink output = Okio.sink(outputFile)) {
|
456 |
| - // NULLSAFE_FIXME[Nullable Dereference] |
457 | 460 | Okio.buffer(response.body().source()).readAll(output);
|
458 | 461 | }
|
459 | 462 |
|
|
0 commit comments