/*
 * Copyright © 2016 IBM Corp. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
 * except in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the
 * License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
 * either express or implied. See the License for the specific language governing permissions
 * and limitations under the License.
 */

package com.cloudant.http.internal.ok;

/**
 * This class should only reflectively try to load the OkUrlFactory and then provide a boolean
 * answer to {@link #isOkUsable()}. Addition of other methods is not advised as it may cause loading
 * of okhttp classes that break the optional dependency relationship.
 */
public class OkHelper {

    private final static boolean okUsable;

    static {
        Class<?> okFactoryClass;
        try {
            okFactoryClass = Class.forName("okhttp3.OkUrlFactory");
        } catch (Throwable t) {
            okFactoryClass = null;
        }
        okUsable = (okFactoryClass != null);
    }

    public static boolean isOkUsable() {
        return okUsable;
    }

}

@@ -640,16 +640,50 @@
 al.ok;%0A%0A
+import java.util.logging.Logger;%0A%0A
 /**%0A * T
@@ -973,16 +973,107 @@
 lper %7B%0A%0A
+    private static final Logger log = Logger.getLogger(OkHelper.class.getCanonicalName());%0A
     priv
@@ -1107,17 +1107,21 @@
 Usable;%0A
+    
 %0A
-
     stat
@@ -1240,16 +1240,16 @@
 tory%22);%0A
-
         
@@ -1268,24 +1268,90 @@
 owable t) %7B%0A
+            log.fine(%22Failed to load okhttp: %22 + t.getMessage());%0A
             

make it easier to know why okhttp is not possible