Source:
protected RemoteOperationResult run(OwnCloudClient client) { RemoteOperationResult result = null; int status = -1; PostMethod post = null; try { post = new PostMethod(client.getBaseUri() + ShareUtils.SHARING_API_PATH); post.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); post.addParameter(PARAM_PATH, mRemoteFilePath); post.addParameter(PARAM_SHARE_TYPE, Integer.toString(mShareType.getValue())); post.addParameter(PARAM_SHARE_WITH, mShareWith); if (mPublicUpload) { post.addParameter(PARAM_PUBLIC_UPLOAD, Boolean.toString(true)); } if (mPassword != null && mPassword.length() > 0) { post.addParameter(PARAM_PASSWORD, mPassword); } post.addParameter(PARAM_PERMISSIONS, Integer.toString(mPermissions)); post.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE); status = client.executeMethod(post); if(isSuccess(status)) { String response = post.getResponseBodyAsString(); ShareToRemoteOperationResultParser parser = new ShareToRemoteOperationResultParser( new ShareXMLParser() ); parser.setOneOrMoreSharesRequired(true); parser.setOwnCloudVersion(client.getOwnCloudVersion()); parser.setServerBaseUri(client.getBaseUri()); result = parser.parse(response); if (result.isSuccess()) { Log_OC.d(TAG, "Created " + result.getData().size() + " share(s)"); if (mGetShareDetails) { OCShare emptyShare = (OCShare) result.getData().get(0); GetRemoteShareOperation getInfo = new GetRemoteShareOperation(emptyShare.getIdRemoteShared()); result = getInfo.execute(client); } } } else { result = new RemoteOperationResult(false, status, post.getResponseHeaders()); } } catch (Exception e) { result = new RemoteOperationResult(e); Log_OC.e(TAG, "Exception while Creating New Share", e); } finally { if (post != null) { post.releaseConnection(); } } return result; }

Target:
protected RemoteOperationResult run(OwnCloudClient client) { RemoteOperationResult result = null; int status = -1; PostMethod post = null; try { post = new PostMethod(client.getBaseUri() + ShareUtils.SHARING_API_PATH); post.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded; charset=utf-8"); post.addParameter(PARAM_PATH, mRemoteFilePath); post.addParameter(PARAM_SHARE_TYPE, Integer.toString(mShareType.getValue())); post.addParameter(PARAM_SHARE_WITH, mShareWith); if (mPublicUpload) { post.addParameter(PARAM_PUBLIC_UPLOAD, Boolean.toString(true)); } if (mPassword != null && mPassword.length() > 0) { post.addParameter(PARAM_PASSWORD, mPassword); } post.addParameter(PARAM_PERMISSIONS, Integer.toString(mPermissions)); post.addRequestHeader(OCS_API_HEADER, OCS_API_HEADER_VALUE); status = client.executeMethod(post); if(isSuccess(status)) { String response = post.getResponseBodyAsString(); ShareToRemoteOperationResultParser parser = new ShareToRemoteOperationResultParser( new ShareXMLParser() ); parser.setOneOrMoreSharesRequired(true); parser.setOwnCloudVersion(client.getOwnCloudVersion()); parser.setServerBaseUri(client.getBaseUri()); result = parser.parse(response); if (result.isSuccess() && mGetShareDetails) { OCShare emptyShare = (OCShare) result.getData().get(0); GetRemoteShareOperation getInfo = new GetRemoteShareOperation( emptyShare.getIdRemoteShared() ); result = getInfo.execute(client); } } else { result = new RemoteOperationResult(false, status, post.getResponseHeaders()); } } catch (Exception e) { result = new RemoteOperationResult(e); Log_OC.e(TAG, "Exception while Creating New Share", e); } finally { if (post != null) { post.releaseConnection(); } } return result; }