1
0
mirror of https://github.com/moparisthebest/davmail synced 2025-02-28 09:21:49 -05:00

Various fixes from FindBugs audit

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@731 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-09-18 12:17:57 +00:00
parent 78691ae389
commit 8bfa014ab3
9 changed files with 29 additions and 14 deletions

View File

@ -86,12 +86,13 @@ public abstract class AbstractServer extends Thread {
if (keystoreFile == null || keystoreFile.length() == 0) {
serverSocketFactory = ServerSocketFactory.getDefault();
} else {
FileInputStream keyStoreInputStream = null;
try {
keyStoreInputStream = new FileInputStream(keystoreFile);
// keystore for keys and certificates
// keystore and private keys should be password protected...
KeyStore keystore = KeyStore.getInstance(Settings.getProperty("davmail.ssl.keystoreType"));
keystore.load(new FileInputStream(keystoreFile),
keystore.load(keyStoreInputStream,
Settings.getProperty("davmail.ssl.keystorePass").toCharArray());
// KeyManagerFactory to create key managers
@ -113,6 +114,14 @@ public abstract class AbstractServer extends Thread {
throw new DavMailException("LOG_EXCEPTION_CREATING_SSL_SERVER_SOCKET", getProtocolName(), port, ex.getMessage() == null ? ex.toString() : ex.getMessage());
} catch (GeneralSecurityException ex) {
throw new DavMailException("LOG_EXCEPTION_CREATING_SSL_SERVER_SOCKET", getProtocolName(), port, ex.getMessage() == null ? ex.toString() : ex.getMessage());
} finally {
if (keyStoreInputStream != null) {
try {
keyStoreInputStream.close();
} catch (IOException exc) {
DavGatewayTray.warn(new BundleMessage("LOG_EXCEPTION_CLOSING_KEYSTORE_INPUT_STREAM"), exc);
}
}
}
}
try {

View File

@ -1697,7 +1697,7 @@ public class ExchangeSession {
}
private static int dumpIndex = 1;
private static String defaultSound = "Basso";
private String defaultSound = "Basso";
protected void dumpICS(String icsBody, boolean fromServer, boolean after) {
// additional setting to activate ICS dump (not available in GUI)

View File

@ -128,7 +128,11 @@ public class DavGatewayX509TrustManager implements X509TrustManager {
while (!yes.equals(answer) && !no.equals(answer)) {
System.out.println(buffer.toString());
try {
answer = inReader.readLine().toLowerCase();
answer = inReader.readLine();
if (answer == null) {
answer = no;
}
answer = answer.toLowerCase();
} catch (IOException e) {
System.err.println(e);
}

View File

@ -39,7 +39,7 @@ public class PasswordPromptDialog extends JDialog {
* @return user password as char array
*/
public char[] getPassword() {
return password;
return password.clone();
}
/**

View File

@ -49,11 +49,11 @@ public class AwtGatewayTray implements DavGatewayTrayInterface {
static SettingsFrame settingsFrame;
ActionListener settingsListener;
protected static TrayIcon trayIcon;
static TrayIcon trayIcon;
private static Image image;
private static Image image2;
private static Image inactiveImage;
protected static LogBrokerMonitor logBrokerMonitor;
LogBrokerMonitor logBrokerMonitor;
private boolean isActive = true;
/**

View File

@ -41,10 +41,10 @@ public class FrameGatewayTray implements DavGatewayTrayInterface {
protected FrameGatewayTray() {
}
protected static JFrame mainFrame;
protected static AboutFrame aboutFrame;
protected static SettingsFrame settingsFrame;
protected static LogBrokerMonitor logBrokerMonitor;
static JFrame mainFrame;
static AboutFrame aboutFrame;
static SettingsFrame settingsFrame;
LogBrokerMonitor logBrokerMonitor;
private static JEditorPane errorArea;
private static JLabel errorLabel;
private static JEditorPane messageArea;

View File

@ -50,7 +50,7 @@ public class SwtGatewayTray implements DavGatewayTrayInterface {
private static Image inactiveImage;
private static Display display;
private static Shell shell;
private static LogBrokerMonitor logBrokerMonitor;
private LogBrokerMonitor logBrokerMonitor;
private boolean isActive = true;
private boolean isReady;

View File

@ -226,4 +226,5 @@ UI_UNTRUSTED_CERTIFICATE=Server provided an untrusted certificate,\n you can cho
UI_UNTRUSTED_CERTIFICATE_HTML=<html><b>Server provided an untrusted certificate,<br> you can choose to accept or deny access</b></html>
UI_VALID_FROM=Valid from
UI_VALID_UNTIL=Valid until
MEETING_REQUEST=Meeting request
MEETING_REQUEST=Meeting request
LOG_EXCEPTION_CLOSING_KEYSTORE_INPUT_STREAM=Exception closing keystore input stream

View File

@ -226,4 +226,5 @@ MEETING_REQUEST=Invitation
LOG_ACCESS_FORBIDDEN=Accès à {0} non autorisé: {1}
LOG_LDAP_REQ_BIND_INVALID_CREDENTIALS=LDAP_REQ_BIND Utilisateur ou mot de passe invalide
LOG_LDAP_REQ_BIND_SUCCESS=LOG_LDAP_REQ_BIND Authentification réussie
EXCEPTION_GET_FAILED=La requête GET a échoué avec le statut {0} à l''adresse {1}
EXCEPTION_GET_FAILED=La requête GET a échoué avec le statut {0} à l''adresse {1}
LOG_EXCEPTION_CLOSING_KEYSTORE_INPUT_STREAM=Erreur à la fermeture du flux d''entrée du fichier de clés