diff options
| author | Bananeweizen <bananeweizen@gmx.de> | 2014-11-09 07:19:45 +0100 |
|---|---|---|
| committer | Bananeweizen <bananeweizen@gmx.de> | 2014-11-09 07:19:45 +0100 |
| commit | 1da89bfd0f61a67cf86d6d0a3d6de3020ad3857e (patch) | |
| tree | 6dbc3769dbf021a3cf499b5674e8b800e0dfc49a | |
| parent | 081b15f485478d6cfdf20ba6ee3733e67669634c (diff) | |
| download | cgeo-1da89bfd0f61a67cf86d6d0a3d6de3020ad3857e.zip cgeo-1da89bfd0f61a67cf86d6d0a3d6de3020ad3857e.tar.gz cgeo-1da89bfd0f61a67cf86d6d0a3d6de3020ad3857e.tar.bz2 | |
fix Javadoc
| -rw-r--r-- | main/src/cgeo/geocaching/network/Network.java | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/main/src/cgeo/geocaching/network/Network.java b/main/src/cgeo/geocaching/network/Network.java index c86df78..b9b043c 100644 --- a/main/src/cgeo/geocaching/network/Network.java +++ b/main/src/cgeo/geocaching/network/Network.java @@ -112,12 +112,12 @@ public abstract class Network { */ @Nullable public static HttpResponse postJsonRequest(final String uri, final ObjectNode json) { - HttpPost request = new HttpPost(uri); + final HttpPost request = new HttpPost(uri); request.addHeader("Content-Type", "application/json; charset=utf-8"); if (json != null) { try { request.setEntity(new StringEntity(json.toString(), CharEncoding.UTF_8)); - } catch (UnsupportedEncodingException e) { + } catch (final UnsupportedEncodingException e) { Log.e("postJsonRequest:JSON Entity: UnsupportedEncodingException", e); return null; } @@ -232,7 +232,7 @@ public abstract class Network { final long before = System.currentTimeMillis(); try { final HttpResponse response = client.execute(request); - int status = response.getStatusLine().getStatusCode(); + final int status = response.getStatusLine().getStatusCode(); if (status == 200) { Log.d(status + formatTimeSpan(before) + reqLogStr); } else { @@ -387,11 +387,11 @@ public abstract class Network { } @Nullable - private static String getResponseDataNoError(final HttpResponse response, boolean replaceWhitespace) { + private static String getResponseDataNoError(final HttpResponse response, final boolean replaceWhitespace) { try { - String data = EntityUtils.toString(response.getEntity(), CharEncoding.UTF_8); + final String data = EntityUtils.toString(response.getEntity(), CharEncoding.UTF_8); return replaceWhitespace ? TextUtils.replaceWhitespace(data) : data; - } catch (Exception e) { + } catch (final Exception e) { Log.e("getResponseData", e); return null; } @@ -424,7 +424,7 @@ public abstract class Network { * @return the body if the response comes from a successful HTTP request, <code>null</code> otherwise */ @Nullable - public static String getResponseData(@Nullable final HttpResponse response, boolean replaceWhitespace) { + public static String getResponseData(@Nullable final HttpResponse response, final boolean replaceWhitespace) { if (!isSuccess(response)) { return null; } @@ -433,7 +433,7 @@ public abstract class Network { } @Nullable - public static String rfc3986URLEncode(String text) { + public static String rfc3986URLEncode(final String text) { final String encoded = encode(text); return encoded != null ? StringUtils.replace(encoded.replace("+", "%20"), "%7E", "~") : null; } @@ -442,7 +442,7 @@ public abstract class Network { public static String decode(final String text) { try { return URLDecoder.decode(text, CharEncoding.UTF_8); - } catch (UnsupportedEncodingException e) { + } catch (final UnsupportedEncodingException e) { Log.e("Network.decode", e); } return null; @@ -452,18 +452,19 @@ public abstract class Network { public static String encode(final String text) { try { return URLEncoder.encode(text, CharEncoding.UTF_8); - } catch (UnsupportedEncodingException e) { + } catch (final UnsupportedEncodingException e) { Log.e("Network.encode", e); } return null; } + private static ConnectivityManager connectivityManager = null; + /** * Checks if the device has network connection. * * @return <code>true</code> if the device is connected to the network. */ - private static ConnectivityManager connectivityManager = null; public static boolean isNetworkConnected() { if (connectivityManager == null) { // Concurrent assignment would not hurt |
