mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 09:21:49 -05:00
Fixes from audit
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1267 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
204c57fb5e
commit
30faeaea21
@ -392,10 +392,9 @@ public class CaldavConnection extends AbstractConnection {
|
||||
* @param request Caldav request
|
||||
* @param folder folder object
|
||||
* @param subFolder calendar folder path relative to request path
|
||||
* @return Exchange folder object
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public ExchangeSession.Folder appendFolder(CaldavResponse response, CaldavRequest request, ExchangeSession.Folder folder, String subFolder) throws IOException {
|
||||
public void appendFolder(CaldavResponse response, CaldavRequest request, ExchangeSession.Folder folder, String subFolder) throws IOException {
|
||||
response.startResponse(URIUtil.encodePath(request.getPath(subFolder)));
|
||||
response.startPropstat();
|
||||
|
||||
@ -451,7 +450,6 @@ public class CaldavConnection extends AbstractConnection {
|
||||
|
||||
response.endPropStatOK();
|
||||
response.endResponse();
|
||||
return folder;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -22,22 +22,37 @@ package davmail.exchange;
|
||||
* VCard Writer
|
||||
*/
|
||||
public class VCardWriter extends ICSBufferedWriter {
|
||||
/**
|
||||
* Begin VCard and version
|
||||
*/
|
||||
public void startCard() {
|
||||
writeLine("BEGIN:VCARD");
|
||||
writeLine("VERSION:3.0");
|
||||
}
|
||||
|
||||
/**
|
||||
* Append single value property
|
||||
*
|
||||
* @param propertyName property name
|
||||
* @param propertyValue property value
|
||||
*/
|
||||
public void appendProperty(String propertyName, String propertyValue) {
|
||||
if ((propertyValue != null) && (propertyValue.length() > 0)) {
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append(propertyName);
|
||||
buffer.append(':');
|
||||
appendMultilineEncodedValue(buffer, propertyValue);
|
||||
writeLine(buffer.toString());
|
||||
StringBuilder lineBuffer = new StringBuilder();
|
||||
lineBuffer.append(propertyName);
|
||||
lineBuffer.append(':');
|
||||
appendMultilineEncodedValue(lineBuffer, propertyValue);
|
||||
writeLine(lineBuffer.toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Append and encode \n to \\n in value.
|
||||
*
|
||||
* @param buffer line buffer
|
||||
* @param value value
|
||||
*/
|
||||
protected void appendMultilineEncodedValue(StringBuilder buffer, String value) {
|
||||
for (int i = 0; i < value.length(); i++) {
|
||||
char c = value.charAt(i);
|
||||
@ -49,6 +64,12 @@ public class VCardWriter extends ICSBufferedWriter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Append compound value
|
||||
*
|
||||
* @param propertyName property name
|
||||
* @param propertyValue property values
|
||||
*/
|
||||
public void appendProperty(String propertyName, String... propertyValue) {
|
||||
boolean hasValue = false;
|
||||
for (String value : propertyValue) {
|
||||
@ -59,18 +80,18 @@ public class VCardWriter extends ICSBufferedWriter {
|
||||
}
|
||||
if (hasValue) {
|
||||
boolean first = true;
|
||||
StringBuilder buffer = new StringBuilder();
|
||||
buffer.append(propertyName);
|
||||
buffer.append(':');
|
||||
StringBuilder lineBuffer = new StringBuilder();
|
||||
lineBuffer.append(propertyName);
|
||||
lineBuffer.append(':');
|
||||
for (String value : propertyValue) {
|
||||
if (first) {
|
||||
first = false;
|
||||
} else {
|
||||
buffer.append(';');
|
||||
lineBuffer.append(';');
|
||||
}
|
||||
appendEncodedValue(buffer, value);
|
||||
appendEncodedValue(lineBuffer, value);
|
||||
}
|
||||
writeLine(buffer.toString());
|
||||
writeLine(lineBuffer.toString());
|
||||
}
|
||||
}
|
||||
|
||||
@ -96,6 +117,9 @@ public class VCardWriter extends ICSBufferedWriter {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* End VCard
|
||||
*/
|
||||
public void endCard() {
|
||||
writeLine("END:VCARD");
|
||||
}
|
||||
|
@ -1630,10 +1630,6 @@ public class DavExchangeSession extends ExchangeSession {
|
||||
inputStream = method.getResponseBodyAsStream();
|
||||
}
|
||||
inputStream = new FilterInputStream(inputStream) {
|
||||
@Override
|
||||
public int read() throws IOException {
|
||||
return super.read();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void close() throws IOException {
|
||||
|
@ -478,9 +478,16 @@ public class Field {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Create property value object for field and value.
|
||||
*
|
||||
* @param alias field alias
|
||||
* @param value field value
|
||||
* @return property value object
|
||||
* @see ExchangePropPatchMethod
|
||||
*/
|
||||
public static PropertyValue createPropertyValue(String alias, String value) {
|
||||
Field field = Field.get(alias);
|
||||
String encodedValue = null;
|
||||
DavPropertyName davPropertyName = field.davPropertyName;
|
||||
if (value == null) {
|
||||
// return DavPropertyName to remove property
|
||||
|
@ -21,6 +21,7 @@ package davmail.exchange.dav;
|
||||
/**
|
||||
* MAPI property types.
|
||||
*/
|
||||
@SuppressWarnings({"UnusedDeclaration"})
|
||||
public enum PropertyType {
|
||||
ApplicationTime, ApplicationTimeArray, Binary, BinaryArray, Boolean, CLSID, CLSIDArray, Currency, CurrencyArray,
|
||||
Double, DoubleArray, Error, Float, FloatArray, Integer, IntegerArray, Long, LongArray, Null, Object,
|
||||
|
@ -22,10 +22,10 @@ package davmail.exchange.dav;
|
||||
* Property value.
|
||||
*/
|
||||
public class PropertyValue {
|
||||
protected String namespaceUri;
|
||||
protected String name;
|
||||
protected String xmlEncodedValue;
|
||||
protected PropertyType type;
|
||||
protected final String namespaceUri;
|
||||
protected final String name;
|
||||
protected final String xmlEncodedValue;
|
||||
protected final PropertyType type;
|
||||
|
||||
public PropertyValue(String namespaceUri, String name) {
|
||||
this(namespaceUri, name, null, null);
|
||||
|
@ -21,6 +21,7 @@ package davmail.exchange.ews;
|
||||
/**
|
||||
* Contains comparison mode.
|
||||
*/
|
||||
@SuppressWarnings({"UnusedDeclaration"})
|
||||
public class ContainmentComparison extends AttributeOption {
|
||||
private ContainmentComparison(String value) {
|
||||
super("ContainmentComparison", value);
|
||||
|
@ -21,6 +21,7 @@ package davmail.exchange.ews;
|
||||
/**
|
||||
* Contains search mode.
|
||||
*/
|
||||
@SuppressWarnings({"UnusedDeclaration"})
|
||||
public class ContainmentMode extends AttributeOption {
|
||||
private ContainmentMode(String value) {
|
||||
super("ContainmentMode", value);
|
||||
|
@ -522,6 +522,7 @@ public abstract class EWSMethod extends PostMethod {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusCode() {
|
||||
if ("ErrorAccessDenied".equals(errorDetail)) {
|
||||
return HttpStatus.SC_FORBIDDEN;
|
||||
|
@ -21,6 +21,7 @@ package davmail.exchange.ews;
|
||||
/**
|
||||
* Item update option.
|
||||
*/
|
||||
@SuppressWarnings({"UnusedDeclaration"})
|
||||
public class SendMeetingInvitations extends AttributeOption {
|
||||
private SendMeetingInvitations(String value) {
|
||||
super("SendMeetingInvitations", value);
|
||||
|
@ -24,6 +24,7 @@ import davmail.util.StringUtil;
|
||||
* Two operand expression.
|
||||
*/
|
||||
public class TwoOperandExpression implements SearchExpression {
|
||||
@SuppressWarnings({"UnusedDeclaration"})
|
||||
protected enum Operator {
|
||||
IsEqualTo, IsNotEqualTo, IsGreaterThan, IsGreaterThanOrEqualTo, IsLessThan, IsLessThanOrEqualTo
|
||||
}
|
||||
|
@ -581,11 +581,13 @@ public final class DavGatewayHttpClientFacade {
|
||||
}
|
||||
}
|
||||
|
||||
protected static MultiThreadedHttpConnectionManager createConnectionManager() {
|
||||
private static MultiThreadedHttpConnectionManager createConnectionManager() {
|
||||
MultiThreadedHttpConnectionManager connectionManager = new MultiThreadedHttpConnectionManager();
|
||||
connectionManager.getParams().setDefaultMaxConnectionsPerHost(100);
|
||||
connectionManager.getParams().setConnectionTimeout(10000);
|
||||
httpConnectionManagerThread.addConnectionManager(connectionManager);
|
||||
synchronized (LOCK) {
|
||||
httpConnectionManagerThread.addConnectionManager(connectionManager);
|
||||
}
|
||||
return connectionManager;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user