1
0
mirror of https://github.com/owncloud/android-library.git synced 2026-08-18 20:03:00 +00:00

Parse and show the error of invalid characters coming from the server side. Show new message in CreationFolder

This commit is contained in:
masensio
2015-06-02 13:07:43 +02:00
parent 9fc332eef9
commit 2b09aa2a89
3 changed files with 209 additions and 13 deletions
@@ -28,6 +28,7 @@ import org.apache.jackrabbit.webdav.client.methods.MkColMethod;
import com.owncloud.android.lib.common.OwnCloudClient;
import com.owncloud.android.lib.common.network.WebdavUtils;
import com.owncloud.android.lib.common.operations.InvalidCharacterExceptionParser;
import com.owncloud.android.lib.common.operations.RemoteOperation;
import com.owncloud.android.lib.common.operations.RemoteOperationResult;
import com.owncloud.android.lib.common.operations.RemoteOperationResult.ResultCode;
@@ -98,9 +99,16 @@ public class CreateRemoteFolderOperation extends RemoteOperation {
try {
mkcol = new MkColMethod(client.getWebdavUri() + WebdavUtils.encodePath(mRemotePath));
int status = client.executeMethod(mkcol, READ_TIMEOUT, CONNECTION_TIMEOUT);
result = new RemoteOperationResult(mkcol.succeeded(), status, mkcol.getResponseHeaders());
Log_OC.d(TAG, "Create directory " + mRemotePath + ": " + result.getLogMessage());
client.exhaustResponse(mkcol.getResponseBodyAsStream());
if ( status == 400 ) {
result = new RemoteOperationResult(mkcol.succeeded(),
mkcol.getResponseBodyAsString(), status);
Log_OC.d(TAG, mkcol.getResponseBodyAsString());
} else {
result = new RemoteOperationResult(mkcol.succeeded(), status, mkcol.getResponseHeaders());
Log_OC.d(TAG, "Create directory " + mRemotePath + ": " + result.getLogMessage());
}
client.exhaustResponse(mkcol.getResponseBodyAsStream());
} catch (Exception e) {
result = new RemoteOperationResult(e);