Server certificates improvements: fixed problems in devices with OpenSSL implementati...
[pub/Android/ownCloud.git] / src / com / owncloud / android / authenticator / ConnectionCheckOperation.java
index 17b0dc2..6149236 100644 (file)
@@ -39,7 +39,7 @@ public class ConnectionCheckOperation extends RemoteOperation {
     /** Maximum time to wait for a response from the server when the connection is being tested, in MILLISECONDs.  */
     public static final int TRY_CONNECTION_TIMEOUT = 5000;
     
     /** Maximum time to wait for a response from the server when the connection is being tested, in MILLISECONDs.  */
     public static final int TRY_CONNECTION_TIMEOUT = 5000;
     
-    private static final String TAG = ConnectionCheckerRunnable.class.getCanonicalName();
+    private static final String TAG = ConnectionCheckOperation.class.getCanonicalName();
     
     private String mUrl;
     private RemoteOperationResult mLatestResult;
     
     private String mUrl;
     private RemoteOperationResult mLatestResult;
@@ -83,16 +83,24 @@ public class ConnectionCheckOperation extends RemoteOperation {
 
         } catch (JSONException e) {
             mLatestResult = new RemoteOperationResult(RemoteOperationResult.ResultCode.INSTANCE_NOT_CONFIGURED);
 
         } catch (JSONException e) {
             mLatestResult = new RemoteOperationResult(RemoteOperationResult.ResultCode.INSTANCE_NOT_CONFIGURED);
-            //Log.e(TAG, "JSON exception while trying connection (instance not configured) ", e);
             
         } catch (Exception e) {
             mLatestResult = new RemoteOperationResult(e);
             
         } catch (Exception e) {
             mLatestResult = new RemoteOperationResult(e);
-            //Log.e(TAG, "Unexpected exception while trying connection", e);
             
         } finally {
             if (get != null)
                 get.releaseConnection();
         }
             
         } finally {
             if (get != null)
                 get.releaseConnection();
         }
+        
+        if (mLatestResult.isSuccess()) {
+            Log.i(TAG, "Connection check at " + urlSt + ": " + mLatestResult.getLogMessage());
+            
+        } else if (mLatestResult.getException() != null) {
+            Log.e(TAG, "Connection check at " + urlSt + ": " + mLatestResult.getLogMessage(), mLatestResult.getException());
+            
+        } else {
+            Log.e(TAG, "Connection check at " + urlSt + ": " + mLatestResult.getLogMessage());
+        }
 
         return retval;
     }
 
         return retval;
     }
@@ -132,5 +140,5 @@ public class ConnectionCheckOperation extends RemoteOperation {
             return mLatestResult;
         }
        }
             return mLatestResult;
         }
        }
-
+       
 }
 }