-
Notifications
You must be signed in to change notification settings - Fork 26
Open
Description
Some domain names can contain something like '.abcdef" (and more...) (sample : ws.mobile.mycompany instead of ws.mobile.mycompany.com)
But in Android 4.x.x, the setApiDomain causes a freeze with such domain name.
public Builder setApiDomain(String domain){
if (domain==null) mApiDomain = "10.0.2.2";
if(Patterns.IP_ADDRESS.matcher(domain).matches()||
Patterns.DOMAIN_NAME.matcher(domain).matches()){
mApiDomain = domain;
} else {
throw new RuntimeException("Invalid host name: "+domain+". Hint: don't specify protocol (eg. http) or path");
}
return this;
}
The issue is Patterns.DOMAIN_NAME.matcher(domain).matches() : the Patterns.DOMAIN_NAME is more limited in Android 4.x.x
Here are the source code from Android:
- Android JellyBean (4.1 à 4.3) : https://android.googlesource.com/platform/frameworks/base/+/jb-release/core/java/android/util/Patterns.java (TOP_LEVEL_DOMAIN)
- Android Lollipop (5) : https://android.googlesource.com/platform/frameworks/base/+/lollipop-release/core/java/android/util/Patterns.java (GLTD)
I tried to use a new method to force the API Domain without check, it works fine:
public Builder setApiDomainWithoutCheck(String domain){
mApiDomain = domain;
return this;
}
Metadata
Metadata
Assignees
Labels
No labels