Created
June 18, 2020 21:30
-
-
Save schmidt-sebastian/e1ddba17d468ae72c4104fa84aae2d9a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/firebase-database/src/main/java/com/google/firebase/database/core/utilities/Utilities.java b/firebase-database/src/main/java/com/google/firebase/database/core/utilities/Utilities.java | |
index 50299dc3..bdf49cdd 100644 | |
--- a/firebase-database/src/main/java/com/google/firebase/database/core/utilities/Utilities.java | |
+++ b/firebase-database/src/main/java/com/google/firebase/database/core/utilities/Utilities.java | |
@@ -54,26 +54,32 @@ public class Utilities { | |
throw new IllegalArgumentException("Database URL does not specify a valid host"); | |
} | |
- RepoInfo repoInfo = new RepoInfo(); | |
- repoInfo.host = host.toLowerCase(); | |
- | |
- int port = uri.getPort(); | |
- if (port != -1) { | |
- repoInfo.secure = scheme.equals("https") || scheme.equals("wss"); | |
- repoInfo.host += ":" + port; | |
- } else { | |
- repoInfo.secure = true; | |
+ String namespace = uri.getQueryParameter("ns"); | |
+ if (namespace == null) { | |
+ String[] parts = host.split("\\.", -1); | |
+ namespace = parts[0].toLowerCase(); | |
} | |
- String namespaceParam = uri.getQueryParameter("ns"); | |
- if (namespaceParam != null) { | |
- repoInfo.namespace = namespaceParam; | |
+ RepoInfo repoInfo = new RepoInfo(); | |
+ if (serviceSettings) { | |
+ repoInfo.host = serviceSettings.host + ":" + serviceSettings.port; | |
+ repoInfo.secure = false; | |
} else { | |
- String[] parts = host.split("\\.", -1); | |
- repoInfo.namespace = parts[0].toLowerCase(); | |
- } | |
+ repoInfo.host = host.toLowerCase(); | |
+ int port = uri.getPort(); | |
+ if (port != -1) { | |
+ repoInfo.secure = scheme.equals("https") || scheme.equals("wss"); | |
+ repoInfo.host += ":" + port; | |
+ } else { | |
+ repoInfo.secure = true; | |
+ } | |
+ } | |
repoInfo.internalHost = repoInfo.host; | |
+ repoInfo.namespace = namespace; | |
+ | |
+ // Some log line | |
+ Logger.getLog("Connecting to %s with namespace %s") | |
String originalPathString = extractPathString(url); | |
// URLEncoding a space turns it into a '+', which is different | |
@@ -81,13 +87,6 @@ public class Utilities { | |
originalPathString = originalPathString.replace("+", " "); | |
Validation.validateRootPathString(originalPathString); | |
- // TODO: Should log this out | |
- if (serviceSettings != null) { | |
- repoInfo.secure = false; | |
- repoInfo.host = serviceSettings.host + ":" + serviceSettings.port; | |
- repoInfo.internalHost = repoInfo.host; | |
- } | |
- | |
ParsedUrl parsedUrl = new ParsedUrl(); | |
parsedUrl.path = new Path(originalPathString); | |
parsedUrl.repoInfo = repoInfo; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment