|
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,12 @@ 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 | + throw new Exception("Could not get device name from Inspector Host Metadata."); |
| 213 | + } |
209 | 214 | mInspectorPackagerConnection =
|
210 |
| - new CxxInspectorPackagerConnection( |
211 |
| - // NULLSAFE_FIXME[Parameter Not Nullable] |
212 |
| - getInspectorDeviceUrl(), metadata.get("deviceName"), mPackageName); |
| 215 | + new CxxInspectorPackagerConnection(getInspectorDeviceUrl(), deviceName, mPackageName); |
213 | 216 | mInspectorPackagerConnection.connect();
|
214 | 217 | return null;
|
215 | 218 | }
|
@@ -448,12 +451,11 @@ public String getSourceUrl(String mainModuleName) {
|
448 | 451 | final Request request = new Request.Builder().url(resourceURL).build();
|
449 | 452 |
|
450 | 453 | try (Response response = mClient.newCall(request).execute()) {
|
451 |
| - if (!response.isSuccessful()) { |
| 454 | + if (!response.isSuccessful() || response.body() == null) { |
452 | 455 | return null;
|
453 | 456 | }
|
454 | 457 |
|
455 | 458 | try (Sink output = Okio.sink(outputFile)) {
|
456 |
| - // NULLSAFE_FIXME[Nullable Dereference] |
457 | 459 | Okio.buffer(response.body().source()).readAll(output);
|
458 | 460 | }
|
459 | 461 |
|
|
0 commit comments