Showing connection error DO NOT MERGE
FIXME
This commit is contained in:
parent
dfb3374d59
commit
5d635e4408
2 changed files with 12 additions and 1 deletions
app/src/main
|
@ -12,12 +12,15 @@ import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
import java.net.ConnectException;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import info.nerull7.mysqlbrowser.R;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by nerull7 on 07.07.14.
|
* Created by nerull7 on 07.07.14.
|
||||||
* Database connector using Async calls
|
* Database connector using Async calls
|
||||||
|
@ -400,7 +403,14 @@ public class AsyncDatabaseConnector {
|
||||||
urlConnection.setReadTimeout(READ_TIMEOUT);
|
urlConnection.setReadTimeout(READ_TIMEOUT);
|
||||||
urlConnection.setConnectTimeout(CONNECTION_TIMEOUT);
|
urlConnection.setConnectTimeout(CONNECTION_TIMEOUT);
|
||||||
urlConnection.setRequestMethod(CONNECTION_REQUEST_METHOD);
|
urlConnection.setRequestMethod(CONNECTION_REQUEST_METHOD);
|
||||||
urlConnection.connect();
|
try {
|
||||||
|
urlConnection.connect();
|
||||||
|
} catch (ConnectException e) {
|
||||||
|
// errorMsg = e.getMessage();
|
||||||
|
if (e.getCause().equals(CONNECTION_REQUEST_METHOD)) {
|
||||||
|
errorMsg == R.string.error_connection_timeout; // FIXME
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if(urlConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
if(urlConnection.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -49,5 +49,6 @@
|
||||||
<string name="save_credentials">Save credentials</string>
|
<string name="save_credentials">Save credentials</string>
|
||||||
<string name="connector_url">Connector URL</string>
|
<string name="connector_url">Connector URL</string>
|
||||||
<string name="no_connection">No Internet Connection</string>
|
<string name="no_connection">No Internet Connection</string>
|
||||||
|
<string name="error_connection_timeout">Connection timeout</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue