mirror of
https://github.com/moparisthebest/davmail
synced 2025-02-28 09:21:49 -05:00
Cleanup from audit
git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@526 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
parent
101a38d9d1
commit
be2d0a4098
@ -20,8 +20,8 @@ public class AbstractConnection extends Thread {
|
||||
protected BufferedReader in;
|
||||
protected OutputStream os;
|
||||
// user name and password initialized through connection
|
||||
protected String userName = null;
|
||||
protected String password = null;
|
||||
protected String userName;
|
||||
protected String password;
|
||||
// connection state
|
||||
protected State state = State.INITIAL;
|
||||
// Exchange session proxy
|
||||
|
@ -12,7 +12,7 @@ import java.net.Socket;
|
||||
*/
|
||||
public abstract class AbstractServer extends Thread {
|
||||
private final int port;
|
||||
private ServerSocket serverSocket;
|
||||
private final ServerSocket serverSocket;
|
||||
|
||||
/**
|
||||
* Server socket TCP port
|
||||
@ -30,7 +30,7 @@ public abstract class AbstractServer extends Thread {
|
||||
* @param name thread name
|
||||
* @param port tcp socket chosen port
|
||||
* @param defaultPort tcp socket default port
|
||||
* @throws java.io.IOException unable to create server socket
|
||||
* @throws IOException unable to create server socket
|
||||
*/
|
||||
public AbstractServer(String name, int port, int defaultPort) throws IOException {
|
||||
super(name);
|
||||
|
@ -33,7 +33,7 @@ public class CaldavConnection extends AbstractConnection {
|
||||
protected static final int MAX_KEEP_ALIVE_TIME = 300;
|
||||
protected final Logger wireLogger = Logger.getLogger(this.getClass());
|
||||
|
||||
protected boolean closed = false;
|
||||
protected boolean closed;
|
||||
|
||||
// Initialize the streams and start the thread
|
||||
public CaldavConnection(Socket clientSocket) {
|
||||
@ -683,8 +683,8 @@ public class CaldavConnection extends AbstractConnection {
|
||||
sendClient("HTTP/1.1 " + status + " " + HttpStatus.getStatusText(status));
|
||||
sendClient("Server: DavMail Gateway");
|
||||
sendClient("DAV: 1, 2, 3, access-control, calendar-access, ticket, calendar-schedule, calendarserver-private-events");
|
||||
SimpleDateFormat formatter = new java.text.SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.ENGLISH);
|
||||
sendClient("Date: " + formatter.format(new java.util.Date()));
|
||||
SimpleDateFormat formatter = new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss Z", Locale.ENGLISH);
|
||||
sendClient("Date: " + formatter.format(new Date()));
|
||||
if (headers != null) {
|
||||
for (Map.Entry<String, String> header : headers.entrySet()) {
|
||||
sendClient(header.getKey() + ": " + header.getValue());
|
||||
@ -714,7 +714,7 @@ public class CaldavConnection extends AbstractConnection {
|
||||
* Decode HTTP credentials
|
||||
*
|
||||
* @param authorization http authorization header value
|
||||
* @throws java.io.IOException if invalid credentials
|
||||
* @throws IOException if invalid credentials
|
||||
*/
|
||||
protected void decodeCredentials(String authorization) throws IOException {
|
||||
int index = authorization.indexOf(' ');
|
||||
|
@ -17,7 +17,7 @@ public class CaldavServer extends AbstractServer {
|
||||
* Start the thread.
|
||||
*
|
||||
* @param port pop listen port, 80 if not defined (0)
|
||||
* @throws java.io.IOException on error
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public CaldavServer(int port) throws IOException {
|
||||
super("CaldavServer", port, CaldavServer.DEFAULT_PORT);
|
||||
|
@ -118,7 +118,7 @@ public class ExchangeSession {
|
||||
|
||||
private final ExchangeSessionFactory.PoolKey poolKey;
|
||||
|
||||
private boolean disableGalLookup = false;
|
||||
private boolean disableGalLookup;
|
||||
private static final String YYYY_MM_DD_HH_MM_SS = "yyyy/MM/dd HH:mm:ss";
|
||||
private static final String YYYYMMDD_T_HHMMSS_Z = "yyyyMMdd'T'HHmmss'Z'";
|
||||
private static final String YYYY_MM_DD_T_HHMMSS_Z = "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
||||
@ -128,7 +128,7 @@ public class ExchangeSession {
|
||||
* The session is not actually established until a call to login()
|
||||
*
|
||||
* @param poolKey session pool key
|
||||
* @throws java.io.IOException on error
|
||||
* @throws IOException on error
|
||||
*/
|
||||
ExchangeSession(ExchangeSessionFactory.PoolKey poolKey) throws IOException {
|
||||
this.poolKey = poolKey;
|
||||
@ -244,7 +244,7 @@ public class ExchangeSession {
|
||||
*
|
||||
* @param url exchange base URL
|
||||
* @return true if basic authentication detected
|
||||
* @throws java.io.IOException unable to connect to exchange
|
||||
* @throws IOException unable to connect to exchange
|
||||
*/
|
||||
protected boolean isBasicAuthentication(String url) throws IOException {
|
||||
return DavGatewayHttpClientFacade.getHttpStatus(url) == HttpStatus.SC_UNAUTHORIZED;
|
||||
@ -272,7 +272,7 @@ public class ExchangeSession {
|
||||
* @param httpClient httpClient instance
|
||||
* @param initmethod form body http method
|
||||
* @return logon method
|
||||
* @throws java.io.IOException on error
|
||||
* @throws IOException on error
|
||||
*/
|
||||
protected PostMethod buildLogonMethod(HttpClient httpClient, HttpMethod initmethod) throws IOException {
|
||||
|
||||
@ -501,7 +501,7 @@ public class ExchangeSession {
|
||||
* @param messageName message name
|
||||
* @param properties message properties (flags)
|
||||
* @param messageBody mail body
|
||||
* @throws java.io.IOException when unable to create message
|
||||
* @throws IOException when unable to create message
|
||||
*/
|
||||
public void createMessage(String folderUrl, String messageName, HashMap<String, String> properties, String messageBody) throws IOException {
|
||||
String messageUrl = URIUtil.encodePathQuery(folderUrl + "/" + messageName + ".EML");
|
||||
@ -1281,9 +1281,9 @@ public class ExchangeSession {
|
||||
protected String fixICS(String icsBody, boolean fromServer) throws IOException {
|
||||
// first pass : detect
|
||||
class AllDayState {
|
||||
boolean isAllDay = false;
|
||||
boolean hasCdoAllDay = false;
|
||||
boolean isCdoAllDay = false;
|
||||
boolean isAllDay;
|
||||
boolean hasCdoAllDay;
|
||||
boolean isCdoAllDay;
|
||||
}
|
||||
// Convert event class from and to iCal
|
||||
// See https://trac.calendarserver.org/browser/CalendarServer/trunk/doc/Extensions/caldav-privateevents.txt
|
||||
@ -1684,7 +1684,7 @@ public class ExchangeSession {
|
||||
* Get current Exchange alias name from mailbox name
|
||||
*
|
||||
* @return user name
|
||||
* @throws java.io.IOException on error
|
||||
* @throws IOException on error
|
||||
*/
|
||||
protected String getAliasFromMailPath() throws IOException {
|
||||
if (mailPath == null) {
|
||||
@ -1861,7 +1861,7 @@ public class ExchangeSession {
|
||||
* @param searchAttribute exchange search attribute
|
||||
* @param searchValue search value
|
||||
* @return List of users
|
||||
* @throws java.io.IOException on error
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public Map<String, Map<String, String>> galFind(String searchAttribute, String searchValue) throws IOException {
|
||||
Map<String, Map<String, String>> results;
|
||||
|
@ -55,7 +55,7 @@ public final class ExchangeSessionFactory {
|
||||
* @param userName user login
|
||||
* @param password user password
|
||||
* @return authenticated session
|
||||
* @throws java.io.IOException on error
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public static ExchangeSession getInstance(String userName, String password) throws IOException {
|
||||
try {
|
||||
|
@ -23,13 +23,13 @@ import java.util.ArrayList;
|
||||
* Create HttpClient instance according to DavGateway Settings
|
||||
*/
|
||||
public final class DavGatewayHttpClientFacade {
|
||||
final static String IE_USER_AGENT = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)";
|
||||
final static int MAX_REDIRECTS = 10;
|
||||
static final String IE_USER_AGENT = "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)";
|
||||
static final int MAX_REDIRECTS = 10;
|
||||
static MultiThreadedHttpConnectionManager multiThreadedHttpConnectionManager;
|
||||
|
||||
final static long ONE_MINUTE = 60000;
|
||||
static final long ONE_MINUTE = 60000;
|
||||
|
||||
static Thread httpConnectionManagerThread = null;
|
||||
static Thread httpConnectionManagerThread ;
|
||||
|
||||
static {
|
||||
DavGatewayHttpClientFacade.start();
|
||||
|
@ -45,7 +45,7 @@ public class DavGatewaySSLProtocolSocketFactory implements SecureProtocolSocketF
|
||||
}
|
||||
}
|
||||
|
||||
private SSLContext sslcontext = null;
|
||||
private SSLContext sslcontext ;
|
||||
|
||||
private SSLContext createSSLContext() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException {
|
||||
SSLContext context = SSLContext.getInstance("SSL");
|
||||
|
@ -21,10 +21,9 @@ import java.io.InputStreamReader;
|
||||
* Custom Trust Manager, let user accept or deny.
|
||||
*/
|
||||
public class DavGatewayX509TrustManager implements X509TrustManager {
|
||||
private X509TrustManager standardTrustManager = null;
|
||||
private final X509TrustManager standardTrustManager;
|
||||
|
||||
public DavGatewayX509TrustManager() throws NoSuchAlgorithmException, KeyStoreException {
|
||||
super();
|
||||
TrustManagerFactory factory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
|
||||
factory.init((KeyStore) null);
|
||||
TrustManager[] trustmanagers = factory.getTrustManagers();
|
||||
@ -52,7 +51,7 @@ public class DavGatewayX509TrustManager implements X509TrustManager {
|
||||
this.standardTrustManager.checkClientTrusted(x509Certificates, authType);
|
||||
}
|
||||
|
||||
public java.security.cert.X509Certificate[] getAcceptedIssuers() {
|
||||
public X509Certificate[] getAcceptedIssuers() {
|
||||
return this.standardTrustManager.getAcceptedIssuers();
|
||||
}
|
||||
|
||||
|
@ -637,9 +637,9 @@ public class ImapConnection extends AbstractConnection {
|
||||
}
|
||||
|
||||
static final class SearchConditions {
|
||||
Boolean flagged = null;
|
||||
Boolean answered = null;
|
||||
long startUid = 0;
|
||||
Boolean flagged;
|
||||
Boolean answered;
|
||||
long startUid;
|
||||
final StringBuilder query = new StringBuilder();
|
||||
|
||||
public StringBuilder append(String value) {
|
||||
@ -861,7 +861,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
* Decode IMAP credentials
|
||||
*
|
||||
* @param tokens tokens
|
||||
* @throws java.io.IOException on error
|
||||
* @throws IOException on error
|
||||
*/
|
||||
protected void parseCredentials(StringTokenizer tokens) throws IOException {
|
||||
if (tokens.hasMoreTokens()) {
|
||||
@ -903,7 +903,7 @@ public class ImapConnection extends AbstractConnection {
|
||||
protected static final int BODY = 4;
|
||||
|
||||
protected int state = START;
|
||||
protected int size = 0;
|
||||
protected int size;
|
||||
protected final boolean writeHeaders;
|
||||
protected final boolean writeBody;
|
||||
protected final int startIndex;
|
||||
@ -952,8 +952,8 @@ public class ImapConnection extends AbstractConnection {
|
||||
|
||||
protected class UIDRangeIterator implements Iterator<ExchangeSession.Message> {
|
||||
final String[] ranges;
|
||||
int currentIndex = 0;
|
||||
int currentRangeIndex = 0;
|
||||
int currentIndex;
|
||||
int currentRangeIndex;
|
||||
long startUid;
|
||||
long endUid;
|
||||
|
||||
@ -1010,8 +1010,8 @@ public class ImapConnection extends AbstractConnection {
|
||||
|
||||
protected class RangeIterator implements Iterator<ExchangeSession.Message> {
|
||||
final String[] ranges;
|
||||
int currentIndex = 0;
|
||||
int currentRangeIndex = 0;
|
||||
int currentIndex;
|
||||
int currentRangeIndex;
|
||||
long startUid;
|
||||
long endUid;
|
||||
|
||||
|
@ -18,7 +18,7 @@ public class ImapServer extends AbstractServer {
|
||||
* Start the thread.
|
||||
*
|
||||
* @param port imap listen port, 143 if not defined (0)
|
||||
* @throws java.io.IOException on error
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public ImapServer(int port) throws IOException {
|
||||
super("ImapServer", port, ImapServer.DEFAULT_PORT);
|
||||
|
@ -16,6 +16,8 @@ import java.lang.reflect.Method;
|
||||
import java.net.Socket;
|
||||
import java.net.SocketException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.net.InetAddress;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@ -739,8 +741,8 @@ public class LdapConnection extends AbstractConnection {
|
||||
|
||||
protected String hostName() {
|
||||
try {
|
||||
return java.net.InetAddress.getLocalHost().getCanonicalHostName();
|
||||
} catch (java.net.UnknownHostException ex) {
|
||||
return InetAddress.getLocalHost().getCanonicalHostName();
|
||||
} catch (UnknownHostException ex) {
|
||||
DavGatewayTray.debug("Couldn't get hostname");
|
||||
}
|
||||
|
||||
@ -854,7 +856,7 @@ public class LdapConnection extends AbstractConnection {
|
||||
|
||||
static class LdapFilter {
|
||||
final StringBuilder filterString = new StringBuilder();
|
||||
int ldapFilterType = 0;
|
||||
int ldapFilterType;
|
||||
boolean isFullSearch = true;
|
||||
final Map<String, SimpleFilter> orCriteria = new HashMap<String, SimpleFilter>();
|
||||
final Map<String, SimpleFilter> andCriteria = new HashMap<String, SimpleFilter>();
|
||||
|
@ -17,7 +17,7 @@ public class LdapServer extends AbstractServer {
|
||||
* Start the thread.
|
||||
*
|
||||
* @param port pop listen port, 389 if not defined (0)
|
||||
* @throws java.io.IOException on error
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public LdapServer(int port) throws IOException {
|
||||
super("LdapServer", port, LdapServer.DEFAULT_PORT);
|
||||
|
@ -17,7 +17,7 @@ public class PopServer extends AbstractServer {
|
||||
* Create a ServerSocket to listen for connections.
|
||||
* Start the thread.
|
||||
* @param port pop listen port, 110 if not defined (0)
|
||||
* @throws java.io.IOException on error
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public PopServer(int port) throws IOException {
|
||||
super("PopServer", port, PopServer.DEFAULT_PORT);
|
||||
|
@ -177,7 +177,7 @@ public class SmtpConnection extends AbstractConnection {
|
||||
* Decode SMTP credentials
|
||||
*
|
||||
* @param encodedCredentials smtp encoded credentials
|
||||
* @throws java.io.IOException if invalid credentials
|
||||
* @throws IOException if invalid credentials
|
||||
*/
|
||||
protected void decodeCredentials(String encodedCredentials) throws IOException {
|
||||
String decodedCredentials = base64Decode(encodedCredentials);
|
||||
|
@ -13,7 +13,7 @@ public class SmtpServer extends AbstractServer {
|
||||
* Create a ServerSocket to listen for connections.
|
||||
* Start the thread.
|
||||
* @param port smtp port
|
||||
* @throws java.io.IOException on error
|
||||
* @throws IOException on error
|
||||
*/
|
||||
public SmtpServer(int port) throws IOException {
|
||||
super("SmtpServer", port, SmtpServer.DEFAULT_PORT);
|
||||
|
@ -28,10 +28,10 @@ public class AwtGatewayTray implements DavGatewayTrayInterface {
|
||||
static AboutFrame aboutFrame;
|
||||
static SettingsFrame settingsFrame;
|
||||
|
||||
private static TrayIcon trayIcon = null;
|
||||
private static Image image = null;
|
||||
private static Image image2 = null;
|
||||
private static Image inactiveImage = null;
|
||||
private static TrayIcon trayIcon;
|
||||
private static Image image;
|
||||
private static Image image2;
|
||||
private static Image inactiveImage;
|
||||
private boolean isActive = true;
|
||||
|
||||
public Image getFrameIcon() {
|
||||
|
@ -21,15 +21,15 @@ public class FrameGatewayTray implements DavGatewayTrayInterface {
|
||||
protected FrameGatewayTray() {
|
||||
}
|
||||
|
||||
protected static JFrame mainFrame = null;
|
||||
protected static JFrame mainFrame;
|
||||
protected static AboutFrame aboutFrame;
|
||||
protected static SettingsFrame settingsFrame;
|
||||
private static JEditorPane errorArea = null;
|
||||
private static JLabel errorLabel = null;
|
||||
private static JEditorPane messageArea = null;
|
||||
private static Image image = null;
|
||||
private static Image image2 = null;
|
||||
private static Image inactiveImage = null;
|
||||
private static JEditorPane errorArea;
|
||||
private static JLabel errorLabel;
|
||||
private static JEditorPane messageArea;
|
||||
private static Image image;
|
||||
private static Image image2;
|
||||
private static Image inactiveImage;
|
||||
private boolean isActive = true;
|
||||
|
||||
public Image getFrameIcon() {
|
||||
|
@ -23,15 +23,15 @@ public class SwtGatewayTray implements DavGatewayTrayInterface {
|
||||
protected SwtGatewayTray() {
|
||||
}
|
||||
|
||||
private static TrayItem trayItem = null;
|
||||
private static java.awt.Image awtImage = null;
|
||||
private static Image image = null;
|
||||
private static Image image2 = null;
|
||||
private static Image inactiveImage = null;
|
||||
private static TrayItem trayItem;
|
||||
private static java.awt.Image awtImage;
|
||||
private static Image image;
|
||||
private static Image image2;
|
||||
private static Image inactiveImage;
|
||||
private static Display display;
|
||||
private static Shell shell;
|
||||
private boolean isActive = true;
|
||||
private boolean isReady = false;
|
||||
private boolean isReady;
|
||||
|
||||
private final Thread mainThread = Thread.currentThread();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user