Apply new base64 methods to CaldavConnection

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@2245 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2014-03-10 20:53:13 +00:00
parent cf10953212
commit 1f11758bb2
1 changed files with 6 additions and 5 deletions

View File

@ -28,6 +28,7 @@ import davmail.exchange.ExchangeSessionFactory;
import davmail.exchange.ICSBufferedReader; import davmail.exchange.ICSBufferedReader;
import davmail.exchange.XMLStreamUtil; import davmail.exchange.XMLStreamUtil;
import davmail.ui.tray.DavGatewayTray; import davmail.ui.tray.DavGatewayTray;
import davmail.util.IOUtil;
import davmail.util.StringUtil; import davmail.util.StringUtil;
import org.apache.commons.httpclient.HttpException; import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus; import org.apache.commons.httpclient.HttpStatus;
@ -471,7 +472,7 @@ public class CaldavConnection extends AbstractConnection {
} }
if (request.hasProperty("getctag")) { if (request.hasProperty("getctag")) {
response.appendProperty("CS:getctag", "CS=\"http://calendarserver.org/ns/\"", response.appendProperty("CS:getctag", "CS=\"http://calendarserver.org/ns/\"",
base64Encode(folder.ctag)); IOUtil.encodeBase64(folder.ctag));
} }
if (request.hasProperty("displayname")) { if (request.hasProperty("displayname")) {
if (subFolder == null || subFolder.length() == 0) { if (subFolder == null || subFolder.length() == 0) {
@ -520,8 +521,8 @@ public class CaldavConnection extends AbstractConnection {
if (!session.isSharedFolder(folderPath)) { if (!session.isSharedFolder(folderPath)) {
try { try {
ExchangeSession.Folder folder = session.getFolder(folderPath); ExchangeSession.Folder folder = session.getFolder(folderPath);
ctag = base64Encode(folder.ctag); ctag = IOUtil.encodeBase64(folder.ctag);
etag = base64Encode(folder.etag); etag = IOUtil.encodeBase64(folder.etag);
} catch (HttpException e) { } catch (HttpException e) {
// unauthorized access, probably an inbox on shared calendar // unauthorized access, probably an inbox on shared calendar
DavGatewayTray.debug(new BundleMessage("LOG_ACCESS_FORBIDDEN", folderPath, e.getMessage())); DavGatewayTray.debug(new BundleMessage("LOG_ACCESS_FORBIDDEN", folderPath, e.getMessage()));
@ -833,7 +834,7 @@ public class CaldavConnection extends AbstractConnection {
if (request.hasProperty("getctag")) { if (request.hasProperty("getctag")) {
ExchangeSession.Folder rootFolder = session.getFolder(""); ExchangeSession.Folder rootFolder = session.getFolder("");
response.appendProperty("CS:getctag", "CS=\"http://calendarserver.org/ns/\"", response.appendProperty("CS:getctag", "CS=\"http://calendarserver.org/ns/\"",
base64Encode(rootFolder.ctag)); IOUtil.encodeBase64(rootFolder.ctag));
} }
response.endPropStatOK(); response.endPropStatOK();
if (request.getDepth() == 1) { if (request.getDepth() == 1) {
@ -1285,7 +1286,7 @@ public class CaldavConnection extends AbstractConnection {
throw new DavMailException("EXCEPTION_UNSUPPORTED_AUTHORIZATION_MODE", mode); throw new DavMailException("EXCEPTION_UNSUPPORTED_AUTHORIZATION_MODE", mode);
} }
String encodedCredentials = authorization.substring(index + 1); String encodedCredentials = authorization.substring(index + 1);
String decodedCredentials = base64Decode(encodedCredentials); String decodedCredentials = IOUtil.decodeBase64AsString(encodedCredentials);
index = decodedCredentials.indexOf(':'); index = decodedCredentials.indexOf(':');
if (index > 0) { if (index > 0) {
userName = decodedCredentials.substring(0, index); userName = decodedCredentials.substring(0, index);