diff --git a/Adjust/sdk-core/src/main/java/com/adjust/sdk/AdjustLinkResolution.java b/Adjust/sdk-core/src/main/java/com/adjust/sdk/AdjustLinkResolution.java index f6170d61c..668fa2080 100644 --- a/Adjust/sdk-core/src/main/java/com/adjust/sdk/AdjustLinkResolution.java +++ b/Adjust/sdk-core/src/main/java/com/adjust/sdk/AdjustLinkResolution.java @@ -50,7 +50,8 @@ public static void resolveLink(final String url, } if (! urlMatchesSuffix(originalURL.getHost(), resolveUrlSuffixArray)) { - adjustLinkResolutionCallback.resolvedLinkCallback(Uri.parse(originalURL.toString())); + adjustLinkResolutionCallback.resolvedLinkCallback( + AdjustLinkResolution.convertToUri(originalURL)); return; } @@ -78,19 +79,22 @@ private static void resolveLink( { // return (possible null) previous url when the current one does not exist if (responseUrl == null) { - adjustLinkResolutionCallback.resolvedLinkCallback(Uri.parse(previousUrl.toString())); + adjustLinkResolutionCallback.resolvedLinkCallback( + AdjustLinkResolution.convertToUri(previousUrl)); return; } // return found url with expected host if (isTerminalUrl(responseUrl.getHost())) { - adjustLinkResolutionCallback.resolvedLinkCallback(Uri.parse(responseUrl.toString())); + adjustLinkResolutionCallback.resolvedLinkCallback( + AdjustLinkResolution.convertToUri(responseUrl)); return; } // return previous (non-null) url when it reached the max number of recursive tries if (recursionNumber > maxRecursions) { - adjustLinkResolutionCallback.resolvedLinkCallback(Uri.parse(responseUrl.toString())); + adjustLinkResolutionCallback.resolvedLinkCallback( + AdjustLinkResolution.convertToUri(responseUrl)); return; } @@ -172,4 +176,12 @@ private static URL convertToHttps(final URL urlToConvert) { return convertedUrl; } + + private static Uri convertToUri(URL url) { + if (url == null) { + return null; + } + + return Uri.parse(url.toString()); + } }