Fixes from audit

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@1198 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2010-07-19 09:02:14 +00:00
parent c657051a08
commit ff9b8940ac
8 changed files with 22 additions and 24 deletions

View File

@ -27,14 +27,13 @@
package info.growl; package info.growl;
import javax.imageio.ImageIO;
import java.awt.image.RenderedImage; import java.awt.image.RenderedImage;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import javax.imageio.ImageIO;
/** /**
* Growl notification implementation. This uses JNI to send messages to Growl. * Growl notification implementation. This uses JNI to send messages to Growl.
* *
@ -147,7 +146,7 @@ class GrowlNative implements Growl {
sendNotification(appName, name, title, body, callbackContext, convertImage(icon)); sendNotification(appName, name, title, body, callbackContext, convertImage(icon));
} }
private class NotificationType { private static class NotificationType {
private final String name; private final String name;
private final boolean enabledByDefault; private final boolean enabledByDefault;

View File

@ -324,7 +324,7 @@ public class CaldavConnection extends AbstractConnection {
int size = contacts.size(); int size = contacts.size();
int count = 0; int count = 0;
for (ExchangeSession.Contact contact : contacts) { for (ExchangeSession.Contact contact : contacts) {
DavGatewayTray.debug(new BundleMessage("LOG_LISTING_CONTACT", ++count, size)); DavGatewayTray.debug(new BundleMessage("LOG_LISTING_ITEM", ++count, size));
DavGatewayTray.switchIcon(); DavGatewayTray.switchIcon();
appendItemResponse(response, request, contact); appendItemResponse(response, request, contact);
} }
@ -334,7 +334,7 @@ public class CaldavConnection extends AbstractConnection {
int size = events.size(); int size = events.size();
int count = 0; int count = 0;
for (ExchangeSession.Event event : events) { for (ExchangeSession.Event event : events) {
DavGatewayTray.debug(new BundleMessage("LOG_LISTING_EVENT", ++count, size)); DavGatewayTray.debug(new BundleMessage("LOG_LISTING_ITEM", ++count, size));
DavGatewayTray.switchIcon(); DavGatewayTray.switchIcon();
appendItemResponse(response, request, event); appendItemResponse(response, request, event);
} }
@ -590,10 +590,7 @@ public class CaldavConnection extends AbstractConnection {
if (folder.isContact()) { if (folder.isContact()) {
appendContactsResponses(response, request, session.getAllContacts(folderPath)); appendContactsResponses(response, request, session.getAllContacts(folderPath));
} else { } else {
DavGatewayTray.debug(new BundleMessage("LOG_SEARCHING_CALENDAR_EVENTS", folderPath)); appendEventsResponses(response, request, session.getAllEvents(folderPath));
List<ExchangeSession.Event> events = session.getAllEvents(folderPath);
DavGatewayTray.debug(new BundleMessage("LOG_FOUND_CALENDAR_EVENTS", events.size()));
appendEventsResponses(response, request, events);
// Send sub folders for multi-calendar support under iCal, except for public folders // Send sub folders for multi-calendar support under iCal, except for public folders
if (!folderPath.startsWith("/public")) { if (!folderPath.startsWith("/public")) {
List<ExchangeSession.Folder> folderList = session.getSubCalendarFolders(folderPath, false); List<ExchangeSession.Folder> folderList = session.getSubCalendarFolders(folderPath, false);

View File

@ -29,7 +29,7 @@ public class VCardReader extends ICSBufferedReader {
/** /**
* VCard property * VCard property
*/ */
public class Property { public static class Property {
protected String key; protected String key;
protected Map<String, Set<String>> params; protected Map<String, Set<String>> params;
protected List<String> values; protected List<String> values;
@ -49,7 +49,7 @@ public class VCardReader extends ICSBufferedReader {
* @return value * @return value
*/ */
public String getValue() { public String getValue() {
if (values == null || values.size() == 0) { if (values == null || values.isEmpty()) {
return null; return null;
} else { } else {
return values.get(0); return values.get(0);

View File

@ -575,7 +575,7 @@ public class DavExchangeSession extends ExchangeSession {
if ("bday".equals(attributeName) || "lastmodified".equals(attributeName) || "datereceived".equals(attributeName)) { if ("bday".equals(attributeName) || "lastmodified".equals(attributeName) || "datereceived".equals(attributeName)) {
value = convertDate(value); value = convertDate(value);
} else if ("haspicture".equals(attributeName) || "private".equals(attributeName)) { } else if ("haspicture".equals(attributeName) || "private".equals(attributeName)) {
value = "1".equals(value)?"true":"false"; value = "1".equals(value) ? "true" : "false";
} }
put(attributeName, value); put(attributeName, value);
} }
@ -1230,9 +1230,9 @@ public class DavExchangeSession extends ExchangeSession {
method.setRequestHeader("Translate", "f"); method.setRequestHeader("Translate", "f");
method.setRequestHeader("Accept-Encoding", "gzip"); method.setRequestHeader("Accept-Encoding", "gzip");
InputStream inputStream = null;
try { try {
DavGatewayHttpClientFacade.executeGetMethod(httpClient, method, true); DavGatewayHttpClientFacade.executeGetMethod(httpClient, method, true);
InputStream inputStream;
if (isGzipEncoded(method)) { if (isGzipEncoded(method)) {
inputStream = (new GZIPInputStream(method.getResponseBodyAsStream())); inputStream = (new GZIPInputStream(method.getResponseBodyAsStream()));
} else { } else {
@ -1251,6 +1251,13 @@ public class DavExchangeSession extends ExchangeSession {
} }
contactPhoto.content = new String(Base64.encodeBase64(baos.toByteArray())); contactPhoto.content = new String(Base64.encodeBase64(baos.toByteArray()));
} finally { } finally {
if (inputStream != null) {
try {
inputStream.close();
} catch (IOException e) {
LOGGER.debug(e);
}
}
method.releaseConnection(); method.releaseConnection();
} }
} }

View File

@ -266,11 +266,11 @@ public class Field {
} }
protected static String toHexString(int propertyTag) { protected static String toHexString(int propertyTag) {
String hexValue = Integer.toHexString(propertyTag); StringBuilder hexValue = new StringBuilder(Integer.toHexString(propertyTag));
while (hexValue.length() < 4) { while (hexValue.length() < 4) {
hexValue = '0' + hexValue; hexValue.insert(0, '0');
} }
return hexValue; return hexValue.toString();
} }
protected static void createField(String alias, int propertyTag, PropertyType propertyType) { protected static void createField(String alias, int propertyTag, PropertyType propertyType) {

View File

@ -119,7 +119,7 @@ public class FrameGatewayTray implements DavGatewayTrayInterface {
public void displayMessage(final String message, final Level level) { public void displayMessage(final String message, final Level level) {
SwingUtilities.invokeLater(new Runnable() { SwingUtilities.invokeLater(new Runnable() {
public void run() { public void run() {
if (mainFrame != null) { if (errorArea != null && messageArea != null) {
if (level.equals(Level.INFO)) { if (level.equals(Level.INFO)) {
errorLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon")); errorLabel.setIcon(UIManager.getIcon("OptionPane.informationIcon"));
errorArea.setText(message); errorArea.setText(message);

View File

@ -64,7 +64,6 @@ LOG_EXECUTE_FOLLOW_REDIRECTS=executeFollowRedirects({0})
LOG_EXECUTE_FOLLOW_REDIRECTS_COUNT=executeFollowRedirects: {0} redirectCount:{1} LOG_EXECUTE_FOLLOW_REDIRECTS_COUNT=executeFollowRedirects: {0} redirectCount:{1}
LOG_EXTERNAL_CONNECTION_REFUSED=Connection from external client refused LOG_EXTERNAL_CONNECTION_REFUSED=Connection from external client refused
LOG_FOUND_ACCEPTED_CERTIFICATE=Found permanently accepted certificate, hash {0} LOG_FOUND_ACCEPTED_CERTIFICATE=Found permanently accepted certificate, hash {0}
LOG_FOUND_CALENDAR_EVENTS=Found {0} calendar events
LOG_FOUND_CALENDAR_MESSAGES=Found {0} calendar messages LOG_FOUND_CALENDAR_MESSAGES=Found {0} calendar messages
LOG_IMAP_COMMAND={0} on {1} LOG_IMAP_COMMAND={0} on {1}
LOG_INVALID_DEPTH=Invalid depth value: {0} LOG_INVALID_DEPTH=Invalid depth value: {0}
@ -93,8 +92,7 @@ LOG_LDAP_UNSUPPORTED_FILTER=Unsupported filter: {0}
LOG_LDAP_UNSUPPORTED_FILTER_ATTRIBUTE=Unsupported filter attribute: {0}= {1} LOG_LDAP_UNSUPPORTED_FILTER_ATTRIBUTE=Unsupported filter attribute: {0}= {1}
LOG_LDAP_UNSUPPORTED_FILTER_VALUE=Unsupported filter value LOG_LDAP_UNSUPPORTED_FILTER_VALUE=Unsupported filter value
LOG_LDAP_UNSUPPORTED_OPERATION=Unsupported operation: {0} LOG_LDAP_UNSUPPORTED_OPERATION=Unsupported operation: {0}
LOG_LISTING_EVENT=Listing event {0}/{1} LOG_LISTING_ITEM=Listing item {0}/{1}
LOG_LISTING_CONTACT=Listing event {0}/{1}
LOG_MESSAGE={0} LOG_MESSAGE={0}
LOG_NEW_VERSION_AVAILABLE=A new version ({0}) of DavMail Gateway is available ! LOG_NEW_VERSION_AVAILABLE=A new version ({0}) of DavMail Gateway is available !
LOG_OPEN_LINK_NOT_SUPPORTED=Open link not supported (tried AWT Desktop and SWT Program) LOG_OPEN_LINK_NOT_SUPPORTED=Open link not supported (tried AWT Desktop and SWT Program)
@ -109,7 +107,6 @@ LOG_READ_CLIENT_PASSWORD=< ********
LOG_REPORT_EVENT=Report event {0}/{1} LOG_REPORT_EVENT=Report event {0}/{1}
LOG_GATEWAY_INTERRUPTED=Stopping DavMail gateway LOG_GATEWAY_INTERRUPTED=Stopping DavMail gateway
LOG_GATEWAY_STOP=DavMail gateway stopped LOG_GATEWAY_STOP=DavMail gateway stopped
LOG_SEARCHING_CALENDAR_EVENTS=Searching calendar events at {0} ...
LOG_SEARCHING_CALENDAR_MESSAGES=Searching calendar messages... LOG_SEARCHING_CALENDAR_MESSAGES=Searching calendar messages...
LOG_SEARCH_QUERY=Search: {0} LOG_SEARCH_QUERY=Search: {0}
LOG_SEND_CLIENT_MESSAGE=> {0} LOG_SEND_CLIENT_MESSAGE=> {0}

View File

@ -61,7 +61,6 @@ LOG_EXECUTE_FOLLOW_REDIRECTS=executeFollowRedirects({0})
LOG_EXECUTE_FOLLOW_REDIRECTS_COUNT=executeFollowRedirects: {0} redirectCount: {1} LOG_EXECUTE_FOLLOW_REDIRECTS_COUNT=executeFollowRedirects: {0} redirectCount: {1}
LOG_EXTERNAL_CONNECTION_REFUSED=Connexion du client distant refusée LOG_EXTERNAL_CONNECTION_REFUSED=Connexion du client distant refusée
LOG_FOUND_ACCEPTED_CERTIFICATE=Certificat définitivement accepté trouvé, hash {0} LOG_FOUND_ACCEPTED_CERTIFICATE=Certificat définitivement accepté trouvé, hash {0}
LOG_FOUND_CALENDAR_EVENTS={0} évènements trouvés dans le calendrier
LOG_FOUND_CALENDAR_MESSAGES={0} messages trouvés dans le calendrier LOG_FOUND_CALENDAR_MESSAGES={0} messages trouvés dans le calendrier
LOG_IMAP_COMMAND={0} sur {1} LOG_IMAP_COMMAND={0} sur {1}
LOG_INVALID_DEPTH=Profondeur invalide : {0} LOG_INVALID_DEPTH=Profondeur invalide : {0}
@ -88,7 +87,7 @@ LOG_LDAP_UNSUPPORTED_FILTER=Filtre non support
LOG_LDAP_UNSUPPORTED_FILTER_ATTRIBUTE=Attribut de filtre non supporté : {0}= {1} LOG_LDAP_UNSUPPORTED_FILTER_ATTRIBUTE=Attribut de filtre non supporté : {0}= {1}
LOG_LDAP_UNSUPPORTED_FILTER_VALUE=Valeur de filtre non supportée LOG_LDAP_UNSUPPORTED_FILTER_VALUE=Valeur de filtre non supportée
LOG_LDAP_UNSUPPORTED_OPERATION=Opération non supportée : {0} LOG_LDAP_UNSUPPORTED_OPERATION=Opération non supportée : {0}
LOG_LISTING_EVENT=Liste évènement {0}/{1} LOG_LISTING_ITEM=Liste élément {0}/{1}
LOG_MESSAGE={0} LOG_MESSAGE={0}
LOG_NEW_VERSION_AVAILABLE=Une nouvelle version ({0}) de la Passerelle DavMail est disponible ! LOG_NEW_VERSION_AVAILABLE=Une nouvelle version ({0}) de la Passerelle DavMail est disponible !
LOG_OPEN_LINK_NOT_SUPPORTED=Ouverture de lien impossible (avec AWT Desktop et SWT Program) LOG_OPEN_LINK_NOT_SUPPORTED=Ouverture de lien impossible (avec AWT Desktop et SWT Program)
@ -100,7 +99,6 @@ LOG_READ_CLIENT_LOGIN=< LOGIN ********
LOG_READ_CLIENT_PASS=< PASS ******** LOG_READ_CLIENT_PASS=< PASS ********
LOG_READ_CLIENT_PASSWORD=< ******** LOG_READ_CLIENT_PASSWORD=< ********
LOG_REPORT_EVENT=Envoi évènement {0}/{1} LOG_REPORT_EVENT=Envoi évènement {0}/{1}
LOG_SEARCHING_CALENDAR_EVENTS=Recherche des évènements du calendrier {0} ...
LOG_SEARCHING_CALENDAR_MESSAGES=Recherche des messages de calendrier... LOG_SEARCHING_CALENDAR_MESSAGES=Recherche des messages de calendrier...
LOG_SEARCH_QUERY=Recherche : {0} LOG_SEARCH_QUERY=Recherche : {0}
LOG_SEND_CLIENT_MESSAGE=> {0} LOG_SEND_CLIENT_MESSAGE=> {0}