Fixes from audit

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1479 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-09-27 09:37:59 +00:00
parent f9bb5884f9
commit bd9fad4282
12 changed files with 93 additions and 13 deletions

View File

@ -67,6 +67,9 @@ public class ICSBufferedWriter {
}
}
/**
* Append CRLF.
*/
public void newLine() {
buffer.append((char) 13).append((char) 10);
}

View File

@ -28,14 +28,21 @@ import java.text.SimpleDateFormat;
* Mime OutputStreamWriter to build in memory Mime message.
*/
public class MimeOutputStreamWriter extends OutputStreamWriter {
/**
* Build MIME outputStreamWriter
*
* @param out outputstream
* @throws UnsupportedEncodingException on error
*/
public MimeOutputStreamWriter(OutputStream out) throws UnsupportedEncodingException {
super(out,"ASCII");
super(out, "ASCII");
}
/**
* Write MIME header
*
* @param header header name
* @param value header value
* @param value header value
* @throws IOException on error
*/
public void writeHeader(String header, String value) throws IOException {
@ -50,8 +57,9 @@ public class MimeOutputStreamWriter extends OutputStreamWriter {
/**
* Write MIME header
*
* @param header header name
* @param value header value
* @param value header value
* @throws IOException on error
*/
public void writeHeader(String header, Date value) throws IOException {
@ -72,7 +80,7 @@ public class MimeOutputStreamWriter extends OutputStreamWriter {
/**
* Write CRLF.
*
*
* @throws IOException on error
*/
public void writeLn() throws IOException {

View File

@ -1380,7 +1380,7 @@ public class DavExchangeSession extends ExchangeSession {
// check mandatory dtstart value
String dtstart = getPropertyIfExists(davPropertySet, "dtstart");
if (dtstart != null) {
vEvent.setPropertyValue("DTSTART", convertDateFromExchange(getPropertyIfExists(davPropertySet, "dtstart")));
vEvent.setPropertyValue("DTSTART", convertDateFromExchange(dtstart));
} else {
LOGGER.warn("missing dtstart on item, using fake value. Set davmail.deleteBroken=true to delete broken events");
vEvent.setPropertyValue("DTSTART", "20000101T000000Z");

View File

@ -21,7 +21,7 @@ package davmail.exchange.dav;
/**
* MAPI property types.
*/
@SuppressWarnings({"UnusedDeclaration"})
@SuppressWarnings({"UnusedDeclaration", "JavaDoc"})
public enum PropertyType {
ApplicationTime, ApplicationTimeArray, Binary, BinaryArray, Boolean, CLSID, CLSIDArray, Currency, CurrencyArray,
Double, DoubleArray, Error, Float, FloatArray, Integer, IntegerArray, Long, LongArray, Null, Object,

View File

@ -27,14 +27,35 @@ public class PropertyValue {
protected final String xmlEncodedValue;
protected final PropertyType type;
/**
* Create Dav property value.
*
* @param namespaceUri property namespace
* @param name property name
*/
public PropertyValue(String namespaceUri, String name) {
this(namespaceUri, name, null, null);
this(namespaceUri, name, null, null);
}
/**
* Create Dav property value.
*
* @param namespaceUri property namespace
* @param name property name
* @param xmlEncodedValue xml encoded value
*/
public PropertyValue(String namespaceUri, String name, String xmlEncodedValue) {
this(namespaceUri, name, xmlEncodedValue, null);
this(namespaceUri, name, xmlEncodedValue, null);
}
/**
* Create Dav property value.
*
* @param namespaceUri property namespace
* @param name property name
* @param xmlEncodedValue xml encoded value
* @param type property type
*/
public PropertyValue(String namespaceUri, String name, String xmlEncodedValue, PropertyType type) {
this.namespaceUri = namespaceUri;
this.name = name;
@ -42,18 +63,38 @@ public class PropertyValue {
this.type = type;
}
/**
* Get property namespace.
*
* @return property namespace
*/
public String getNamespaceUri() {
return namespaceUri;
}
/**
* Get xml encoded value.
*
* @return Xml encoded value
*/
public String getXmlEncodedValue() {
return xmlEncodedValue;
}
/**
* Get property type.
*
* @return property type
*/
public PropertyType getType() {
return type;
}
/**
* Get property name.
*
* @return property name
*/
public String getName() {
return name;
}

View File

@ -777,7 +777,6 @@ public class EwsExchangeSession extends ExchangeSession {
} else {
throw new HttpNotFoundException("Folder " + folderPath + " not found");
}
System.out.println(folderPath+": "+folder.folderId.value);
return folder;
}

View File

@ -21,6 +21,7 @@ package davmail.exchange.ews;
/**
* ResolveNames search scope.
*/
@SuppressWarnings({"JavaDoc", "UnusedDeclaration"})
public class SearchScope extends AttributeOption {
private SearchScope(String value) {
super("SearchScope", value);

View File

@ -21,6 +21,7 @@ package davmail.exchange.ews;
/**
* Item update option.
*/
@SuppressWarnings({"JavaDoc", "UnusedDeclaration"})
public class SendMeetingCancellations extends AttributeOption {
private SendMeetingCancellations(String value) {
super("SendMeetingCancellations", value);

View File

@ -21,7 +21,7 @@ package davmail.exchange.ews;
/**
* Item update option.
*/
@SuppressWarnings({"UnusedDeclaration"})
@SuppressWarnings({"UnusedDeclaration", "JavaDoc"})
public class SendMeetingInvitations extends AttributeOption {
private SendMeetingInvitations(String value) {
super("SendMeetingInvitations", value);

View File

@ -21,6 +21,7 @@ package davmail.exchange.ews;
/**
* Item update option.
*/
@SuppressWarnings({"JavaDoc", "UnusedDeclaration"})
public class SendMeetingInvitationsOrCancellations extends AttributeOption {
private SendMeetingInvitationsOrCancellations(String value) {
super("SendMeetingInvitationsOrCancellations", value);

View File

@ -149,9 +149,11 @@ public class ImapConnection extends AbstractConnection {
session = ExchangeSessionFactory.getInstance(session, userName, password);
if ("lsub".equalsIgnoreCase(command) || "list".equalsIgnoreCase(command)) {
if (tokens.hasMoreTokens()) {
String folderContext = BASE64MailboxDecoder.decode(tokens.nextToken());
if (baseMailboxPath != null) {
folderContext = baseMailboxPath + folderContext;
String folderContext;
if (baseMailboxPath == null) {
folderContext = BASE64MailboxDecoder.decode(tokens.nextToken());
} else {
folderContext = baseMailboxPath + BASE64MailboxDecoder.decode(tokens.nextToken());
}
if (tokens.hasMoreTokens()) {
String folderQuery = folderContext + BASE64MailboxDecoder.decode(tokens.nextToken());

View File

@ -291,6 +291,12 @@ public final class StringUtil {
return result;
}
/**
* Encode EWS base64 itemId to url compatible value.
*
* @param value base64 value
* @return url compatible value
*/
public static String base64ToUrl(String value) {
String result = value;
if (result != null) {
@ -304,6 +310,12 @@ public final class StringUtil {
return result;
}
/**
* Encode EWS url compatible itemId back to base64 value.
*
* @param value url compatible value
* @return base64 value
*/
public static String urlToBase64(String value) {
String result = value;
if (result.indexOf('-') >= 0) {
@ -315,6 +327,12 @@ public final class StringUtil {
return result;
}
/**
* Encode quotes in Dav search parameter.
*
* @param value search parameter
* @return escaped value
*/
public static String davSearchEncode(String value) {
String result = value;
if (result.indexOf('\'') >= 0) {
@ -323,6 +341,12 @@ public final class StringUtil {
return result;
}
/**
* Get allday date value from zulu timestamp.
*
* @param value zulu datetime
* @return yyyyMMdd allday date value
*/
public static String convertZuluDateTimeToAllDay(String value) {
String result = value;
if (value != null && value.length() != 8) {