@Test public void hideEmptyApiKeys() { assertEquals("", HttpUtils.hideApiKeys("")); }
public static String hideApiKeys(@NonNull String apiKeys) { StringBuilder buffer = new StringBuilder(); Matcher matcher = API_KEY_PATTERN.matcher(apiKeys); int lastEnd = 0; while (matcher.find()) { buffer.append(apiKeys.substring(lastEnd, matcher.start())); buffer.append("-***"); buffer.append(matcher.group(1)); lastEnd = matcher.end(); } if (lastEnd < apiKeys.length()) { buffer.append(apiKeys.substring(lastEnd)); } return buffer.toString(); }
HttpUtils { public static String hideApiKeys(@NonNull String apiKeys) { StringBuilder buffer = new StringBuilder(); Matcher matcher = API_KEY_PATTERN.matcher(apiKeys); int lastEnd = 0; while (matcher.find()) { buffer.append(apiKeys.substring(lastEnd, matcher.start())); buffer.append("-***"); buffer.append(matcher.group(1)); lastEnd = matcher.end(); } if (lastEnd < apiKeys.length()) { buffer.append(apiKeys.substring(lastEnd)); } return buffer.toString(); } }
HttpUtils { public static String hideApiKeys(@NonNull String apiKeys) { StringBuilder buffer = new StringBuilder(); Matcher matcher = API_KEY_PATTERN.matcher(apiKeys); int lastEnd = 0; while (matcher.find()) { buffer.append(apiKeys.substring(lastEnd, matcher.start())); buffer.append("-***"); buffer.append(matcher.group(1)); lastEnd = matcher.end(); } if (lastEnd < apiKeys.length()) { buffer.append(apiKeys.substring(lastEnd)); } return buffer.toString(); } @VisibleForTesting  HttpUtils(); }
HttpUtils { public static String hideApiKeys(@NonNull String apiKeys) { StringBuilder buffer = new StringBuilder(); Matcher matcher = API_KEY_PATTERN.matcher(apiKeys); int lastEnd = 0; while (matcher.find()) { buffer.append(apiKeys.substring(lastEnd, matcher.start())); buffer.append("-***"); buffer.append(matcher.group(1)); lastEnd = matcher.end(); } if (lastEnd < apiKeys.length()) { buffer.append(apiKeys.substring(lastEnd)); } return buffer.toString(); } @VisibleForTesting  HttpUtils(); static boolean isRecoverableError(Throwable t); static String hideSecret(@NonNull String secret); static String hideApiKeys(@NonNull String apiKeys); static String hideTickets(@NonNull String tickets); static HttpClient createHttpClient(@NonNull Context context); static HttpClient createHttpClient(@NonNull Context context, boolean compressionEnabled); static HttpClient createHttpClientWithoutRetryer(@NonNull Context context, boolean compressionEnabled); @NonNull static HttpsURLConnection createHttpsConnection(@NonNull URL url); }
HttpUtils { public static String hideApiKeys(@NonNull String apiKeys) { StringBuilder buffer = new StringBuilder(); Matcher matcher = API_KEY_PATTERN.matcher(apiKeys); int lastEnd = 0; while (matcher.find()) { buffer.append(apiKeys.substring(lastEnd, matcher.start())); buffer.append("-***"); buffer.append(matcher.group(1)); lastEnd = matcher.end(); } if (lastEnd < apiKeys.length()) { buffer.append(apiKeys.substring(lastEnd)); } return buffer.toString(); } @VisibleForTesting  HttpUtils(); static boolean isRecoverableError(Throwable t); static String hideSecret(@NonNull String secret); static String hideApiKeys(@NonNull String apiKeys); static String hideTickets(@NonNull String tickets); static HttpClient createHttpClient(@NonNull Context context); static HttpClient createHttpClient(@NonNull Context context, boolean compressionEnabled); static HttpClient createHttpClientWithoutRetryer(@NonNull Context context, boolean compressionEnabled); @NonNull static HttpsURLConnection createHttpsConnection(@NonNull URL url); static final int THREAD_STATS_TAG; static final int READ_BUFFER_SIZE; static final int WRITE_BUFFER_SIZE; static final int CONNECT_TIMEOUT; static final int READ_TIMEOUT; }