diff --git a/src/java/davmail/AbstractConnection.java b/src/java/davmail/AbstractConnection.java
index 4ddbc844..afa28997 100644
--- a/src/java/davmail/AbstractConnection.java
+++ b/src/java/davmail/AbstractConnection.java
@@ -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;
diff --git a/src/java/davmail/caldav/CaldavConnection.java b/src/java/davmail/caldav/CaldavConnection.java
index 9bb3eee6..ae61b1da 100644
--- a/src/java/davmail/caldav/CaldavConnection.java
+++ b/src/java/davmail/caldav/CaldavConnection.java
@@ -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("");
}
- public void appendInbox(StringBuilder buffer, String principal, CaldavRequest request) throws IOException {
+ public void appendInbox(StringBuilder buffer, String principal, CaldavRequest request) {
buffer.append("");
buffer.append("/users/").append(principal).append("/inbox");
buffer.append("");
@@ -367,7 +367,7 @@ public class CaldavConnection extends AbstractConnection {
buffer.append("");
}
- public void appendOutbox(StringBuilder buffer, String principal, CaldavRequest request) throws IOException {
+ public void appendOutbox(StringBuilder buffer, String principal, CaldavRequest request) {
buffer.append("");
buffer.append("/users/").append(principal).append("/outbox");
buffer.append("");
@@ -773,7 +773,7 @@ public class CaldavConnection extends AbstractConnection {
}
protected static class CaldavRequest {
- protected HashSet properties = new HashSet();
+ protected final HashSet properties = new HashSet();
protected HashSet hrefs;
protected boolean isMultiGet;
diff --git a/src/java/davmail/exchange/ExchangeSession.java b/src/java/davmail/exchange/ExchangeSession.java
index 74b68b55..5fcd709f 100644
--- a/src/java/davmail/exchange/ExchangeSession.java
+++ b/src/java/davmail/exchange/ExchangeSession.java
@@ -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 MESSAGE_REQUEST_PROPERTIES = new Vector();
-
- static {
- MESSAGE_REQUEST_PROPERTIES.add("DAV:uid");
- // size
- MESSAGE_REQUEST_PROPERTIES.add("http://schemas.microsoft.com/mapi/proptag/x0e080003");
- }
-
protected static final Vector EVENT_REQUEST_PROPERTIES = new Vector();
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 properties) {
for (Map.Entry entry : properties.entrySet()) {
if ("read".equals(entry.getKey())) {
@@ -1122,7 +1096,7 @@ public class ExchangeSession {
}
public class MessageList extends ArrayList {
- HashMap uidMessageMap = new HashMap();
+ final HashMap uidMessageMap = new HashMap();
@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;
}
diff --git a/src/java/davmail/exchange/ICSBufferedReader.java b/src/java/davmail/exchange/ICSBufferedReader.java
index 0f0859ea..e9ee6952 100644
--- a/src/java/davmail/exchange/ICSBufferedReader.java
+++ b/src/java/davmail/exchange/ICSBufferedReader.java
@@ -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);
diff --git a/src/java/davmail/exchange/ICSBufferedWriter.java b/src/java/davmail/exchange/ICSBufferedWriter.java
index bb880278..53ea0ae5 100644
--- a/src/java/davmail/exchange/ICSBufferedWriter.java
+++ b/src/java/davmail/exchange/ICSBufferedWriter.java
@@ -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) {
diff --git a/src/java/davmail/ldap/LdapConnection.java b/src/java/davmail/ldap/LdapConnection.java
index 4365356c..3fe66227 100644
--- a/src/java/davmail/ldap/LdapConnection.java
+++ b/src/java/davmail/ldap/LdapConnection.java
@@ -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;
}
diff --git a/src/java/davmail/ui/OSXAdapter.java b/src/java/davmail/ui/OSXAdapter.java
index 670a8b44..fbe76e81 100644
--- a/src/java/davmail/ui/OSXAdapter.java
+++ b/src/java/davmail/ui/OSXAdapter.java
@@ -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;