+ public boolean isSslRecoverableException() {
+ return mCode == ResultCode.SSL_RECOVERABLE_PEER_UNVERIFIED;
+ }
+
+ public void setExtraData(Object data) {
+ mExtraData = data;
+ }
+
+ public Object getExtraData() {
+ return mExtraData;
+ }
+
+ private CertificateCombinedException getCertificateCombinedException(Exception e) {
+ CertificateCombinedException result = null;
+ if (e instanceof CertificateCombinedException) {
+ return (CertificateCombinedException)e;
+ }
+ Throwable cause = mException.getCause();
+ Throwable previousCause = null;
+ while (cause != null && cause != previousCause && !(cause instanceof CertificateCombinedException)) {
+ previousCause = cause;
+ cause = cause.getCause();
+ }
+ if (cause != null && cause instanceof CertificateCombinedException) {
+ result = (CertificateCombinedException)cause;
+ }
+ return result;
+ }
+
+
+ public String getLogMessage() {
+
+ if (mException != null) {
+ if (mException instanceof OperationCancelledException) {
+ return "Operation cancelled by the caller";
+
+ } else if (mException instanceof SocketException) {
+ return "Socket exception";
+
+ } else if (mException instanceof SocketTimeoutException) {
+ return "Socket timeout exception";
+
+ } else if (mException instanceof ConnectTimeoutException) {
+ return "Connect timeout exception";
+
+ } else if (mException instanceof MalformedURLException) {
+ return "Malformed URL exception";
+
+ } else if (mException instanceof UnknownHostException) {
+ return "Unknown host exception";
+
+ } else if (mException instanceof CertificateCombinedException) {
+ if (((CertificateCombinedException) mException).isRecoverable())
+ return "SSL recoverable exception";
+ else
+ return "SSL exception";
+
+ } else if (mException instanceof SSLException) {
+ return "SSL exception";
+
+ } else if (mException instanceof DavException) {
+ return "Unexpected WebDAV exception";
+
+ } else if (mException instanceof HttpException) {
+ return "HTTP violation";
+
+ } else if (mException instanceof IOException) {
+ return "Unrecovered transport exception";
+
+ } else {
+ return "Unexpected exception";
+ }
+ }
+
+ if (mCode == ResultCode.INSTANCE_NOT_CONFIGURED) {
+ return "The ownCloud server is not configured!";
+
+ } else if (mCode == ResultCode.NO_NETWORK_CONNECTION) {
+ return "No network connection";
+
+ } else if (mCode == ResultCode.BAD_OC_VERSION) {
+ return "No valid ownCloud version was found at the server";
+
+ } else if (mCode == ResultCode.STORAGE_ERROR_MOVING_FROM_TMP) {
+ return "Error while moving file from temporal to final directory";
+ }
+
+ return "Operation finished with HTTP status code " + mHttpCode + " (" + (isSuccess()?"success":"fail") + ")";
+
+ }
+