mirror of
https://github.com/etesync/android
synced 2025-01-13 17:21:08 +00:00
Work around unexpected IllegalArgumentException when user enters garbage host name
This commit is contained in:
parent
14875f63ea
commit
144643d6af
@ -80,5 +80,6 @@ dependencies {
|
|||||||
|
|
||||||
// for tests
|
// for tests
|
||||||
testCompile 'junit:junit:4.12'
|
testCompile 'junit:junit:4.12'
|
||||||
|
testCompile 'com.squareup.okhttp3:mockwebserver:3.2.0'
|
||||||
androidTestCompile 'com.squareup.okhttp3:mockwebserver:3.2.0'
|
androidTestCompile 'com.squareup.okhttp3:mockwebserver:3.2.0'
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,9 @@ import android.widget.RadioButton;
|
|||||||
import java.net.IDN;
|
import java.net.IDN;
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.net.URISyntaxException;
|
import java.net.URISyntaxException;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import at.bitfire.dav4android.Constants;
|
||||||
import at.bitfire.davdroid.R;
|
import at.bitfire.davdroid.R;
|
||||||
import at.bitfire.davdroid.ui.widget.EditPassword;
|
import at.bitfire.davdroid.ui.widget.EditPassword;
|
||||||
|
|
||||||
@ -122,8 +124,11 @@ public class LoginCredentialsFragment extends Fragment implements CompoundButton
|
|||||||
if (host.isEmpty()) {
|
if (host.isEmpty()) {
|
||||||
editBaseURL.setError(getString(R.string.login_url_host_name_required));
|
editBaseURL.setError(getString(R.string.login_url_host_name_required));
|
||||||
valid = false;
|
valid = false;
|
||||||
} else
|
} else try {
|
||||||
host = IDN.toASCII(host);
|
host = IDN.toASCII(host);
|
||||||
|
} catch(IllegalArgumentException e) {
|
||||||
|
Constants.log.log(Level.WARNING, "Host name not conforming to RFC 3490", e);
|
||||||
|
}
|
||||||
|
|
||||||
String path = baseUrl.getEncodedPath();
|
String path = baseUrl.getEncodedPath();
|
||||||
int port = baseUrl.getPort();
|
int port = baseUrl.getPort();
|
||||||
|
@ -29,7 +29,7 @@ public class HttpClientTest extends TestCase {
|
|||||||
httpClient = HttpClient.create();
|
httpClient = HttpClient.create();
|
||||||
|
|
||||||
server = new MockWebServer();
|
server = new MockWebServer();
|
||||||
server.start();
|
server.start(30000);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
@ -12,7 +12,7 @@ buildscript {
|
|||||||
jcenter()
|
jcenter()
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
classpath 'com.android.tools.build:gradle:2.0.0+'
|
classpath 'com.android.tools.build:gradle:2.1.0'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
1
doc/.gitignore
vendored
Normal file
1
doc/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
pr/
|
Loading…
Reference in New Issue
Block a user