mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Format Java code in xplat/js/react-native-github
Summary: This diff formats the Java class files inside xplat/js/react-native-github. Since google-java-format was enabled in D16071401 we want to codemode the existing code so that users don't have to deal with formatter lint noise at diff-time. ```arc f --paths-cmd 'hg files -I "**/*.java"'``` drop-conflicts Reviewed By: cpojer Differential Revision: D16071725 fbshipit-source-id: fc6e3852e45742c109f0c5ac4065d64201c74204
This commit is contained in:
committed by
Facebook Github Bot
parent
61e95e5cbf
commit
6c0f73b322
@@ -1,42 +1,37 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* <p>This source code is licensed under the MIT license found in the LICENSE file in the root
|
||||
* directory of this source tree.
|
||||
*/
|
||||
|
||||
package com.facebook.react.common;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import android.net.Uri;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.facebook.common.logging.FLog;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
/**
|
||||
* Tracks errors connecting to or received from the debug server.
|
||||
* The debug server returns errors as json objects. This exception represents that error.
|
||||
* Tracks errors connecting to or received from the debug server. The debug server returns errors as
|
||||
* json objects. This exception represents that error.
|
||||
*/
|
||||
public class DebugServerException extends RuntimeException {
|
||||
private static final String GENERIC_ERROR_MESSAGE =
|
||||
"\n\nTry the following to fix the issue:\n" +
|
||||
"\u2022 Ensure that the packager server is running\n" +
|
||||
"\u2022 Ensure that your device/emulator is connected to your machine and has USB debugging enabled - run 'adb devices' to see a list of connected devices\n" +
|
||||
"\u2022 Ensure Airplane Mode is disabled\n" +
|
||||
"\u2022 If you're on a physical device connected to the same machine, run 'adb reverse tcp:<PORT> tcp:<PORT>' to forward requests from your device\n" +
|
||||
"\u2022 If your device is on the same Wi-Fi network, set 'Debug server host & port for device' in 'Dev settings' to your machine's IP address and the port of the local dev server - e.g. 10.0.1.1:<PORT>\n\n";
|
||||
"\n\nTry the following to fix the issue:\n"
|
||||
+ "\u2022 Ensure that the packager server is running\n"
|
||||
+ "\u2022 Ensure that your device/emulator is connected to your machine and has USB debugging enabled - run 'adb devices' to see a list of connected devices\n"
|
||||
+ "\u2022 Ensure Airplane Mode is disabled\n"
|
||||
+ "\u2022 If you're on a physical device connected to the same machine, run 'adb reverse tcp:<PORT> tcp:<PORT>' to forward requests from your device\n"
|
||||
+ "\u2022 If your device is on the same Wi-Fi network, set 'Debug server host & port for device' in 'Dev settings' to your machine's IP address and the port of the local dev server - e.g. 10.0.1.1:<PORT>\n\n";
|
||||
|
||||
public static DebugServerException makeGeneric(String url, String reason, Throwable t) {
|
||||
return makeGeneric(url, reason, "", t);
|
||||
}
|
||||
|
||||
public static DebugServerException makeGeneric(String url, String reason, String extra, Throwable t) {
|
||||
public static DebugServerException makeGeneric(
|
||||
String url, String reason, String extra, Throwable t) {
|
||||
Uri uri = Uri.parse(url);
|
||||
|
||||
String message = GENERIC_ERROR_MESSAGE.replace("<PORT>", String.valueOf(uri.getPort()));
|
||||
@@ -58,10 +53,12 @@ public class DebugServerException extends RuntimeException {
|
||||
|
||||
/**
|
||||
* Parse a DebugServerException from the server json string.
|
||||
*
|
||||
* @param str json string returned by the debug server
|
||||
* @return A DebugServerException or null if the string is not of proper form.
|
||||
*/
|
||||
@Nullable public static DebugServerException parse(String url, String str) {
|
||||
@Nullable
|
||||
public static DebugServerException parse(String url, String str) {
|
||||
if (TextUtils.isEmpty(str)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user