mirror of
https://github.com/etesync/android
synced 2024-11-29 11:28:19 +00:00
Check base URL validity with new URI() instead of new URL() (fixes #184)
This commit is contained in:
parent
e9a4a4f1ef
commit
e38feed08b
@ -10,8 +10,10 @@
|
|||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
package at.bitfire.davdroid.syncadapter;
|
package at.bitfire.davdroid.syncadapter;
|
||||||
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.URI;
|
||||||
import java.net.URL;
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
import android.app.DialogFragment;
|
import android.app.DialogFragment;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
@ -128,10 +130,10 @@ public class EnterCredentialsFragment extends Fragment implements TextWatcher {
|
|||||||
|
|
||||||
// check host name
|
// check host name
|
||||||
try {
|
try {
|
||||||
URL url = new URL(URIUtils.sanitize(protocol + editBaseURL.getText().toString()));
|
URI uri = new URI(URIUtils.sanitize(protocol + editBaseURL.getText().toString()));
|
||||||
if (url.getHost() == null || url.getHost().isEmpty())
|
if (StringUtils.isBlank(uri.getHost()))
|
||||||
ok = false;
|
ok = false;
|
||||||
} catch (MalformedURLException e) {
|
} catch (URISyntaxException e) {
|
||||||
ok = false;
|
ok = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user