Skip to content
This repository was archived by the owner on Mar 19, 2024. It is now read-only.

Commit 105830e

Browse files
theScrabiabelgardep
authored andcommitted
apply requested changes
1 parent 09375ce commit 105830e

File tree

4 files changed

+6
-73
lines changed

4 files changed

+6
-73
lines changed

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/OwnCloudClientFactory.java

Lines changed: 0 additions & 58 deletions
This file was deleted.

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/HttpClient.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,15 +61,14 @@ public class HttpClient {
6161
private OkHttpClient mOkHttpClient = null;
6262

6363
protected HttpClient(Context context) {
64+
if(context == null) {
65+
Timber.e("Context may not be NULL!");
66+
throw new NullPointerException("Context may not be NULL!");
67+
}
6468
mContext = context;
6569
}
6670

6771
public OkHttpClient getOkHttpClient() {
68-
if (mContext == null) {
69-
Timber.e("Context not initialized call HttpClient.setContext(applicationContext) in the MainApp.onCrate()");
70-
throw new RuntimeException("Context not initialized call HttpClient.setContext(applicationContext) in the" +
71-
" MainApp.onCrate()");
72-
}
7372
if (mOkHttpClient == null) {
7473
try {
7574
final X509TrustManager trustManager = new AdvancedX509TrustManager(

owncloudComLibrary/src/main/java/com/owncloud/android/lib/common/http/methods/HttpBaseMethod.kt

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ abstract class HttpBaseMethod constructor(url: URL) {
6060
@Throws(Exception::class)
6161
open fun execute(httpClient: HttpClient): Int {
6262
val okHttpClient = httpClient.okHttpClient.newBuilder().apply {
63-
retryOnConnectionFailure?.let { retryOnConnectionFailure(it) }
64-
followRedirects?.let { followRedirects(it) }
63+
retryOnConnectionFailure.let { retryOnConnectionFailure(it) }
64+
followRedirects.let { followRedirects(it) }
6565
readTimeoutUnit?.let { unit ->
6666
readTimeoutVal?.let { readTimeout(it, unit) }
6767
}
@@ -152,12 +152,7 @@ abstract class HttpBaseMethod constructor(url: URL) {
152152
// Setter
153153
//////////////////////////////
154154
// Connection parameters
155-
/*
156-
open fun setRetryOnConnectionFailure(retryOnConnectionFailure: Boolean) {
157-
retryOnConnectionFailureVal = true
158-
}
159155

160-
*/
161156

162157
open fun setReadTimeout(readTimeout: Long, timeUnit: TimeUnit) {
163158
readTimeoutVal = readTimeout

sample_client/src/main/java/com/owncloud/android/lib/sampleclient/MainActivity.java

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ public void onCreate(Bundle savedInstanceState) {
7474
super.onCreate(savedInstanceState);
7575
setContentView(R.layout.main);
7676

77-
Timber.plant(new DebugTree());
7877
mHandler = new Handler();
7978

8079
final Uri serverUri = Uri.parse(getString(R.string.server_base_url));
@@ -86,8 +85,6 @@ public void onCreate(Bundle savedInstanceState) {
8685
true,
8786
SingleSessionManager.getDefaultSingleton());
8887

89-
mClient = OwnCloudClientFactory.createOwnCloudClient(serverUri, this, true);
90-
9188
mClient.setCredentials(
9289
OwnCloudCredentialsFactory.newBasicCredentials(
9390
getString(R.string.username),

0 commit comments

Comments
 (0)