1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-12-13 19:22:22 -05:00

Various fixes from audit

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@394 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-02-24 11:53:02 +00:00
parent a75fda975e
commit e45328fe43
7 changed files with 23 additions and 54 deletions

View File

@ -16,11 +16,6 @@ public class AbstractConnection extends Thread {
protected enum State {INITIAL, LOGIN, USER, PASSWORD, AUTHENTICATED, STARTMAIL, RECIPIENT, MAILDATA}
/**
* read password state
*/
public static final int PASSWORD = 1;
protected final Socket client;
protected BufferedReader in;

View File

@ -28,7 +28,7 @@ import java.util.*;
* Handle a caldav connection.
*/
public class CaldavConnection extends AbstractConnection {
protected Logger wireLogger = Logger.getLogger(this.getClass());
protected final Logger wireLogger = Logger.getLogger(this.getClass());
protected boolean closed = false;
@ -343,7 +343,7 @@ public class CaldavConnection extends AbstractConnection {
buffer.append("</D:response>");
}
public void appendInbox(StringBuilder buffer, String principal, CaldavRequest request) throws IOException {
public void appendInbox(StringBuilder buffer, String principal, CaldavRequest request) {
buffer.append("<D:response>");
buffer.append("<D:href>/users/").append(principal).append("/inbox</D:href>");
buffer.append("<D:propstat>");
@ -367,7 +367,7 @@ public class CaldavConnection extends AbstractConnection {
buffer.append("</D:response>");
}
public void appendOutbox(StringBuilder buffer, String principal, CaldavRequest request) throws IOException {
public void appendOutbox(StringBuilder buffer, String principal, CaldavRequest request) {
buffer.append("<D:response>");
buffer.append("<D:href>/users/").append(principal).append("/outbox</D:href>");
buffer.append("<D:propstat>");
@ -773,7 +773,7 @@ public class CaldavConnection extends AbstractConnection {
}
protected static class CaldavRequest {
protected HashSet<String> properties = new HashSet<String>();
protected final HashSet<String> properties = new HashSet<String>();
protected HashSet<String> hrefs;
protected boolean isMultiGet;

View File

@ -13,10 +13,10 @@ import org.apache.log4j.Logger;
import org.apache.webdav.lib.Property;
import org.apache.webdav.lib.ResponseEntity;
import org.apache.webdav.lib.WebdavResource;
import org.apache.webdav.lib.methods.CopyMethod;
import org.apache.webdav.lib.methods.MoveMethod;
import org.apache.webdav.lib.methods.PropPatchMethod;
import org.apache.webdav.lib.methods.SearchMethod;
import org.apache.webdav.lib.methods.CopyMethod;
import org.htmlcleaner.CommentToken;
import org.htmlcleaner.HtmlCleaner;
import org.htmlcleaner.TagNode;
@ -36,17 +36,6 @@ public class ExchangeSession {
public static final SimpleTimeZone GMT_TIMEZONE = new SimpleTimeZone(0, "GMT");
/**
* exchange message properties needed to rebuild mime message
*/
protected static final Vector<String> MESSAGE_REQUEST_PROPERTIES = new Vector<String>();
static {
MESSAGE_REQUEST_PROPERTIES.add("DAV:uid");
// size
MESSAGE_REQUEST_PROPERTIES.add("http://schemas.microsoft.com/mapi/proptag/x0e080003");
}
protected static final Vector<String> EVENT_REQUEST_PROPERTIES = new Vector<String>();
static {
@ -561,21 +550,6 @@ public class ExchangeSession {
return message;
}
public Message getMessage(String messageUrl) throws IOException {
Enumeration messageEnum = wdr.propfindMethod(messageUrl, 0, MESSAGE_REQUEST_PROPERTIES);
if ((wdr.getStatusCode() != HttpURLConnection.HTTP_OK)
|| !messageEnum.hasMoreElements()) {
throw new IOException("Unable to get message: " + wdr.getStatusCode()
+ " " + wdr.getStatusMessage());
}
ResponseEntity entity = (ResponseEntity) messageEnum.nextElement();
return buildMessage(entity);
}
protected void addProperties(PropPatchMethod patchMethod, Map<String, String> properties) {
for (Map.Entry<String, String> entry : properties.entrySet()) {
if ("read".equals(entry.getKey())) {
@ -1122,7 +1096,7 @@ public class ExchangeSession {
}
public class MessageList extends ArrayList<Message> {
HashMap<Long, Message> uidMessageMap = new HashMap<Long, Message>();
final HashMap<Long, Message> uidMessageMap = new HashMap<Long, Message>();
@Override
public boolean add(Message message) {
@ -1382,7 +1356,7 @@ public class ExchangeSession {
return result.toString();
}
protected void splitExDate(ICSBufferedWriter result, String line) throws IOException {
protected void splitExDate(ICSBufferedWriter result, String line) {
int cur = line.lastIndexOf(':') + 1;
String start = line.substring(0, cur);
@ -1445,7 +1419,7 @@ public class ExchangeSession {
return internalCreateOrUpdateEvent(messageUrl, "urn:content-classes:appointment", icsBody, etag, noneMatch);
}
protected String getICSMethod(String icsBody) throws IOException {
protected String getICSMethod(String icsBody) {
int methodIndex = icsBody.indexOf("METHOD:");
if (methodIndex < 0) {
return "REQUEST";
@ -1644,9 +1618,8 @@ public class ExchangeSession {
* Get current Exchange alias name from login name
*
* @return user name
* @throws java.io.IOException on error
*/
protected String getAliasFromLogin() throws IOException {
protected String getAliasFromLogin() {
// Exchange 2007 : userName is login without domain
String userName = poolKey.userName;
int index = userName.indexOf('\\');
@ -1710,9 +1683,8 @@ public class ExchangeSession {
* Get current user email
*
* @return user email
* @throws java.io.IOException on error
*/
public String getEmail() throws IOException {
public String getEmail() {
return email;
}

View File

@ -10,7 +10,7 @@ import java.io.IOException;
*/
public class ICSBufferedReader extends BufferedReader {
protected String nextLine;
protected StringBuilder currentLine = new StringBuilder(75);
protected final StringBuilder currentLine = new StringBuilder(75);
public ICSBufferedReader(Reader in, int sz) throws IOException {
super(in, sz);

View File

@ -5,7 +5,7 @@ package davmail.exchange;
* split lines longer than 75 characters
*/
public class ICSBufferedWriter {
StringBuilder buffer = new StringBuilder();
final StringBuilder buffer = new StringBuilder();
public void writeLine(String line) {
if (line.length() > 75) {

View File

@ -146,7 +146,7 @@ public class LdapConnection extends AbstractConnection {
/**
* For some unknow reaseon parseIntWithTag is private !
*/
static Method parseIntWithTag;
static final Method parseIntWithTag;
static {
try {
@ -154,6 +154,7 @@ public class LdapConnection extends AbstractConnection {
parseIntWithTag.setAccessible(true);
} catch (NoSuchMethodException e) {
DavGatewayTray.error("Unable to get BerDecoder.parseIntWithTag method");
throw new RuntimeException(e);
}
}
@ -435,7 +436,7 @@ public class LdapConnection extends AbstractConnection {
if (reqBer.peekByte() == LDAP_FILTER_PRESENT) {
String attributeName = reqBer.parseStringWithTag(LDAP_FILTER_PRESENT, isLdapV3(), null).toLowerCase();
if ("objectclass".equals(attributeName)) {
criteria.put(attributeName, new SimpleFilter("*"));
criteria.put(attributeName, new SimpleFilter());
} else {
DavGatewayTray.warn("Unsupported filter");
}
@ -641,11 +642,12 @@ public class LdapConnection extends AbstractConnection {
}
class SimpleFilter {
String value;
int operator;
static final String STAR = "*";
final String value;
final int operator;
SimpleFilter(String value) {
this.value = value;
SimpleFilter() {
this.value = SimpleFilter.STAR;
this.operator = LDAP_FILTER_SUBSTRINGS;
}

View File

@ -10,9 +10,9 @@ import java.lang.reflect.Proxy;
*/
public class OSXAdapter implements InvocationHandler {
protected Object targetObject;
protected Method targetMethod;
protected String proxySignature;
protected final Object targetObject;
protected final Method targetMethod;
protected final String proxySignature;
static Object macOSXApplication;