Skip to content

Commit 8dfd335

Browse files
cleanup from mike's comments
1 parent d414366 commit 8dfd335

File tree

1 file changed

+8
-8
lines changed
  • shared/src/main/java/com/optimizely/ab/android/shared

1 file changed

+8
-8
lines changed

shared/src/main/java/com/optimizely/ab/android/shared/Client.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/****************************************************************************
2-
* Copyright 2016, Optimizely, Inc. and contributors *
2+
* Copyright 2016-2017, Optimizely, Inc. and contributors *
33
* *
44
* Licensed under the Apache License, Version 2.0 (the "License"); *
55
* you may not use this file except in compliance with the License. *
@@ -30,8 +30,7 @@
3030
import java.util.concurrent.TimeUnit;
3131

3232
/**
33-
* Functionality common to all clients
34-
* @hide
33+
* Functionality common to all clients using http connections
3534
*/
3635
public class Client {
3736

@@ -46,7 +45,6 @@ public class Client {
4645
*
4746
* @param optlyStorage an instance of {@link OptlyStorage}
4847
* @param logger an instance of {@link Logger}
49-
* @hide
5048
*/
5149
public Client(@NonNull OptlyStorage optlyStorage, @NonNull Logger logger) {
5250
this.optlyStorage = optlyStorage;
@@ -58,7 +56,6 @@ public Client(@NonNull OptlyStorage optlyStorage, @NonNull Logger logger) {
5856
*
5957
* @param url a {@link URL} instance
6058
* @return an open {@link HttpURLConnection}
61-
* @hide
6259
*/
6360
@Nullable
6461
public HttpURLConnection openConnection(URL url) {
@@ -74,7 +71,6 @@ public HttpURLConnection openConnection(URL url) {
7471
* Adds a if-modified-since header to the open {@link URLConnection} if this value is
7572
* stored in {@link OptlyStorage}.
7673
* @param urlConnection an open {@link URLConnection}
77-
* @hide
7874
*/
7975
public void setIfModifiedSince(@NonNull URLConnection urlConnection) {
8076
long lastModified = optlyStorage.getLong(LAST_MODIFIED_HEADER_KEY, 0);
@@ -87,7 +83,6 @@ public void setIfModifiedSince(@NonNull URLConnection urlConnection) {
8783
* Retrieves the last-modified head from a {@link URLConnection} and saves it
8884
* in {@link OptlyStorage}.
8985
* @param urlConnection a {@link URLConnection} instance
90-
* @hide
9186
*/
9287
public void saveLastModified(@NonNull URLConnection urlConnection) {
9388
long lastModified = urlConnection.getLastModified();
@@ -112,7 +107,12 @@ public String readStream(@NonNull URLConnection urlConnection) {
112107
finally {
113108
if (scanner != null) {
114109
// We assume that closing the scanner will close the associated input stream.
115-
scanner.close();
110+
try {
111+
scanner.close();
112+
}
113+
catch (Exception e) {
114+
logger.error("Problem with closing the scanner on a input stream" , e);
115+
}
116116
}
117117
}
118118
}

0 commit comments

Comments
 (0)