Configure Maven reports and fix some checkstyle detected errors

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@58 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2007-05-09 22:32:01 +00:00
parent 0445e4bcde
commit f6594bcd55
8 changed files with 351 additions and 84 deletions

View File

@ -1,5 +1,5 @@
<project name="DavMail" default="dist" basedir="."> <project name="DavMail" default="dist" basedir=".">
<property name="version" value="1.0.2"/> <property name="version" value="1.0.3"/>
<path id="classpath"> <path id="classpath">
<pathelement location="classes"/> <pathelement location="classes"/>

78
pom.xml
View File

@ -1,10 +1,11 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>davmail</groupId> <groupId>davmail</groupId>
<artifactId>davmail</artifactId> <artifactId>davmail</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>1.0.1</version> <version>1.0.3</version>
<name>davmail</name> <name>davmail</name>
<url>http://www.sourceforge.net/projects/davmail</url> <url>http://www.sourceforge.net/projects/davmail</url>
<description> <description>
@ -14,7 +15,7 @@
</description> </description>
<developers> <developers>
<developer> <developer>
<name>Micka&euml;l Guessant</name> <name>Mickaël Guessant</name>
<email>mguessan@free.fr</email> <email>mguessan@free.fr</email>
<url>http://mguessan.free.fr</url> <url>http://mguessan.free.fr</url>
<roles> <roles>
@ -23,6 +24,13 @@
</roles> </roles>
</developer> </developer>
</developers> </developers>
<licenses>
<license>
<name>GNU General Public License</name>
<url>http://www.gnu.org/licenses/gpl.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<mailingLists> <mailingLists>
<mailingList> <mailingList>
<name>DavMail User List</name> <name>DavMail User List</name>
@ -114,4 +122,70 @@
<url>scpexe://shell.sourceforge.net/home/groups/d/da/davmail/htdocs</url> <url>scpexe://shell.sourceforge.net/home/groups/d/da/davmail/htdocs</url>
</site> </site>
</distributionManagement> </distributionManagement>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<reportSets>
<reportSet>
<reports>
<report>project-team</report>
<report>mailing-list</report>
<report>issue-tracking</report>
<report>dependencies</report>
<report>license</report>
<report>scm</report>
<!--report>cim</report-->
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
<!--plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changelog-plugin</artifactId>
</plugin-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>1.0-beta-1</version>
<configuration>
<!-- High|Normal|Low|Exp|Ignore -->
<threshold>Normal</threshold>
<!-- Min|Default|Max -->
<effort>Default</effort>
<excludeFilterFile>
findbugs-exclude.xml
</excludeFilterFile>
<includeFilterFile>
findbugs-include.xml
</includeFilterFile>
<visitors>
FindDeadLocalStores,UnreadFields
</visitors>
<omitVisitors>
FindDeadLocalStores,UnreadFields
</omitVisitors>
<pluginList>
/libs/fb-contrib/fb-contrib-2.8.0.jar
</pluginList>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<configuration>
<configLocation>src/checkstyle/checkstyle-configuration.xml</configLocation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
</plugin>
</plugins>
</reporting>
</project> </project>

View File

@ -0,0 +1,192 @@
<?xml version="1.0"?>
<!--
/*
* Copyright 2001-2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-->
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.1//EN"
"http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
<!--
Checkstyle configuration that checks the sun coding conventions from:
- the Java Language Specification at
http://java.sun.com/docs/books/jls/second_edition/html/index.html
- the Sun Code Conventions at http://java.sun.com/docs/codeconv/
- the Javadoc guidelines at
http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
- the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
- some best practices
Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.sf.net (or in your downloaded distribution).
Most Checks are configurable, be sure to consult the documentation.
To completely disable a check, just comment it out or delete it from the file.
Finally, it is worth reading the documentation.
-->
<module name="Checker">
<!-- Checks that a package.html file exists for each package. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml
<module name="PackageHtml"/>-->
<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
<!-- <module name="NewlineAtEndOfFile"/> -->
<!-- Checks that property files contain the same keys. -->
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
<module name="Translation"/>
<module name="TreeWalker">
<!--property name="cacheFile" value="${checkstyle.cache.file}"/-->
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html
<module name="JavadocMethod"/>
<module name="JavadocType"/>
<module name="JavadocVariable"/>
<module name="JavadocStyle"/>
-->
<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<!-- Checks for Headers -->
<!-- See http://checkstyle.sf.net/config_header.html -->
<!--module name="Header"-->
<!-- The follow property value demonstrates the ability -->
<!-- to have access to ANT properties. In this case it uses -->
<!-- the ${basedir} property to allow Checkstyle to be run -->
<!-- from any directory within a project. See property -->
<!-- expansion, -->
<!-- http://checkstyle.sf.net/config.html#properties -->
<!-- <property -->
<!-- name="headerFile" -->
<!-- value="${basedir}/java.header"/> -->
<!--property name="headerFile" value="${checkstyle.header.file}"/>
</module-->
<!-- Following interprets the header file as regular expressions. -->
<!-- <module name="RegexpHeader"/> -->
<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<!--module name="AvoidStarImport"/-->
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<module name="FileLength"/>
<!--<module name="LineLength"/>-->
<module name="MethodLength"/>
<module name="ParameterNumber"/>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<!-- <module name="EmptyForIteratorPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="TabCharacter"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>-->
<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<module name="AvoidInlineConditionals"/>
<module name="DoubleCheckedLocking"/> <!-- MY FAVOURITE -->
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<!-- <module name="HiddenField"/> -->
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber"/>
<module name="MissingSwitchDefault"/>
<module name="RedundantThrows"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<!-- Checks for class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<!-- <module name="DesignForExtension"/> -->
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier"/>
<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="ArrayTypeStyle"/>
<!-- <module name="FinalParameters"/> -->
<!-- <module name="GenericIllegalRegexp">
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module> -->
<module name="TodoComment"/>
<module name="UpperEll"/>
</module>
</module>

View File

@ -1,15 +1,15 @@
package davmail; package davmail;
import java.io.IOException;
import java.net.ServerSocket; import java.net.ServerSocket;
import java.net.Socket; import java.net.Socket;
import java.io.IOException;
/** /**
* Generic abstract server common to SMTP and POP3 implementations * Generic abstract server common to SMTP and POP3 implementations
*/ */
public abstract class AbstractServer extends Thread { public abstract class AbstractServer extends Thread {
protected int port; private int port;
protected ServerSocket serverSocket; private ServerSocket serverSocket;
/** /**
* Create a ServerSocket to listen for connections. * Create a ServerSocket to listen for connections.

View File

@ -22,6 +22,7 @@ import org.w3c.tidy.Tidy;
import javax.mail.MessagingException; import javax.mail.MessagingException;
import javax.mail.internet.MimeUtility; import javax.mail.internet.MimeUtility;
import java.io.*; import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL; import java.net.URL;
import java.text.ParseException; import java.text.ParseException;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
@ -31,60 +32,60 @@ import java.util.*;
* Exchange session through Outlook Web Access (DAV) * Exchange session through Outlook Web Access (DAV)
*/ */
public class ExchangeSession { public class ExchangeSession {
protected static final Logger logger = Logger.getLogger("davmail.exchange.ExchangeSession"); protected static final Logger LOGGER = Logger.getLogger("davmail.exchange.ExchangeSession");
/** /**
* exchange message properties needed to rebuild mime message * exchange message properties needed to rebuild mime message
*/ */
protected static final Vector<String> messageRequestProperties = new Vector<String>(); protected static final Vector<String> MESSAGE_REQUEST_PROPERTIES = new Vector<String>();
static { static {
messageRequestProperties.add("DAV:uid"); MESSAGE_REQUEST_PROPERTIES.add("DAV:uid");
messageRequestProperties.add("urn:schemas:httpmail:subject"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:httpmail:subject");
messageRequestProperties.add("urn:schemas:mailheader:mime-version"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:mailheader:mime-version");
messageRequestProperties.add("urn:schemas:mailheader:content-class"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:mailheader:content-class");
messageRequestProperties.add("urn:schemas:httpmail:hasattachment"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:httpmail:hasattachment");
// needed only when full headers not found // needed only when full headers not found
messageRequestProperties.add("urn:schemas:mailheader:received"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:mailheader:received");
messageRequestProperties.add("urn:schemas:mailheader:date"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:mailheader:date");
messageRequestProperties.add("urn:schemas:mailheader:message-id"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:mailheader:message-id");
messageRequestProperties.add("urn:schemas:mailheader:thread-topic"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:mailheader:thread-topic");
messageRequestProperties.add("urn:schemas:mailheader:thread-index"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:mailheader:thread-index");
messageRequestProperties.add("urn:schemas:mailheader:from"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:mailheader:from");
messageRequestProperties.add("urn:schemas:mailheader:to"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:mailheader:to");
messageRequestProperties.add("urn:schemas:httpmail:priority"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:httpmail:priority");
// full headers // full headers
messageRequestProperties.add("http://schemas.microsoft.com/mapi/proptag/x0007D001E"); MESSAGE_REQUEST_PROPERTIES.add("http://schemas.microsoft.com/mapi/proptag/x0007D001E");
// mail body // mail body
messageRequestProperties.add("http://schemas.microsoft.com/mapi/proptag/x01000001E"); MESSAGE_REQUEST_PROPERTIES.add("http://schemas.microsoft.com/mapi/proptag/x01000001E");
// html body // html body
messageRequestProperties.add("urn:schemas:httpmail:htmldescription"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:httpmail:htmldescription");
// same as htmldescription, remove // same as htmldescription, remove
// messageRequestProperties.add("http://schemas.microsoft.com/mapi/proptag/x01013001E"); // MESSAGE_REQUEST_PROPERTIES.add("http://schemas.microsoft.com/mapi/proptag/x01013001E");
// size // size
messageRequestProperties.add("http://schemas.microsoft.com/mapi/proptag/x0e080003"); MESSAGE_REQUEST_PROPERTIES.add("http://schemas.microsoft.com/mapi/proptag/x0e080003");
// only for calendar events // only for calendar events
messageRequestProperties.add("urn:schemas:calendar:location"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:calendar:location");
messageRequestProperties.add("urn:schemas:calendar:dtstart"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:calendar:dtstart");
messageRequestProperties.add("urn:schemas:calendar:dtend"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:calendar:dtend");
messageRequestProperties.add("urn:schemas:calendar:instancetype"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:calendar:instancetype");
messageRequestProperties.add("urn:schemas:calendar:busystatus"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:calendar:busystatus");
messageRequestProperties.add("urn:schemas:calendar:meetingstatus"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:calendar:meetingstatus");
messageRequestProperties.add("urn:schemas:calendar:alldayevent"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:calendar:alldayevent");
messageRequestProperties.add("urn:schemas:calendar:responserequested"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:calendar:responserequested");
messageRequestProperties.add("urn:schemas:mailheader:cc"); MESSAGE_REQUEST_PROPERTIES.add("urn:schemas:mailheader:cc");
} }
public static HashMap<String, String> priorities = new HashMap<String, String>(); public static final HashMap<String, String> PRIORITIES = new HashMap<String, String>();
static { static {
priorities.put("-2", "5 (Lowest)"); PRIORITIES.put("-2", "5 (Lowest)");
priorities.put("-1", "4 (Low)"); PRIORITIES.put("-1", "4 (Low)");
priorities.put("1", "2 (High)"); PRIORITIES.put("1", "2 (High)");
priorities.put("2", "1 (Highest)"); PRIORITIES.put("2", "1 (Highest)");
} }
public static final String CONTENT_TYPE_HEADER = "content-type: "; public static final String CONTENT_TYPE_HEADER = "content-type: ";
@ -95,26 +96,26 @@ public class ExchangeSession {
/** /**
* Date parser from Exchange format * Date parser from Exchange format
*/ */
public final SimpleDateFormat dateParser; private final SimpleDateFormat dateParser;
/** /**
* Date formatter to MIME format * Date formatter to MIME format
*/ */
public final SimpleDateFormat dateFormatter; private final SimpleDateFormat dateFormatter;
/** /**
* Various standard mail boxes Urls * Various standard mail boxes Urls
*/ */
protected String inboxUrl; private String inboxUrl;
protected String deleteditemsUrl; private String deleteditemsUrl;
protected String sendmsgUrl; private String sendmsgUrl;
protected String draftsUrl; private String draftsUrl;
/** /**
* Base user mailboxes path (used to select folder) * Base user mailboxes path (used to select folder)
*/ */
protected String mailPath; private String mailPath;
protected String currentFolderUrl; private String currentFolderUrl;
WebdavResource wdr = null; private WebdavResource wdr = null;
/** /**
* Create an exchange session for the given URL. * Create an exchange session for the given URL.
@ -183,7 +184,7 @@ public class ExchangeSession {
testMethod.setFollowRedirects(false); testMethod.setFollowRedirects(false);
int status = httpClient.executeMethod(testMethod); int status = httpClient.executeMethod(testMethod);
testMethod.releaseConnection(); testMethod.releaseConnection();
logger.debug("Test configuration status: " + status); LOGGER.debug("Test configuration status: " + status);
if (status != HttpStatus.SC_OK && status != HttpStatus.SC_UNAUTHORIZED if (status != HttpStatus.SC_OK && status != HttpStatus.SC_UNAUTHORIZED
&& status != HttpStatus.SC_MOVED_TEMPORARILY) { && status != HttpStatus.SC_MOVED_TEMPORARILY) {
throw new IOException("Unable to connect to OWA at " + url + ", status code " + throw new IOException("Unable to connect to OWA at " + url + ", status code " +
@ -191,7 +192,7 @@ public class ExchangeSession {
} }
} catch (Exception exc) { } catch (Exception exc) {
logger.error("DavMail configuration exception: \n" + exc.getMessage(), exc); LOGGER.error("DavMail configuration exception: \n" + exc.getMessage(), exc);
throw new IOException("DavMail configuration exception: \n" + exc.getMessage(), exc); throw new IOException("DavMail configuration exception: \n" + exc.getMessage(), exc);
} }
@ -236,7 +237,7 @@ public class ExchangeSession {
wdr.executeHttpRequestMethod(httpClient, wdr.executeHttpRequestMethod(httpClient,
initmethod); initmethod);
if (initmethod.getPath().indexOf("exchweb/bin") > 0) { if (initmethod.getPath().indexOf("exchweb/bin") > 0) {
logger.debug("** Form based authentication detected"); LOGGER.debug("** Form based authentication detected");
PostMethod logonMethod = new PostMethod( PostMethod logonMethod = new PostMethod(
"/exchweb/bin/auth/owaauth.dll?" + "/exchweb/bin/auth/owaauth.dll?" +
@ -257,7 +258,7 @@ public class ExchangeSession {
Header locationHeader = logonMethod.getResponseHeader( Header locationHeader = logonMethod.getResponseHeader(
"Location"); "Location");
if (logonMethod.getStatusCode() != 302 || if (logonMethod.getStatusCode() != HttpURLConnection.HTTP_MOVED_TEMP ||
locationHeader == null || locationHeader == null ||
!url.equals(locationHeader.getValue())) { !url.equals(locationHeader.getValue())) {
throw new HttpException("Authentication failed"); throw new HttpException("Authentication failed");
@ -333,9 +334,9 @@ public class ExchangeSession {
// set current folder to Inbox // set current folder to Inbox
currentFolderUrl = inboxUrl; currentFolderUrl = inboxUrl;
logger.debug("Inbox URL : " + inboxUrl); LOGGER.debug("Inbox URL : " + inboxUrl);
logger.debug("Trash URL : " + deleteditemsUrl); LOGGER.debug("Trash URL : " + deleteditemsUrl);
logger.debug("Send URL : " + sendmsgUrl); LOGGER.debug("Send URL : " + sendmsgUrl);
deleteditemsUrl = URIUtil.getPath(deleteditemsUrl); deleteditemsUrl = URIUtil.getPath(deleteditemsUrl);
wdr.setPath(URIUtil.getPath(inboxUrl)); wdr.setPath(URIUtil.getPath(inboxUrl));
@ -363,10 +364,10 @@ public class ExchangeSession {
message.append(webdavStatusMessage); message.append(webdavStatusMessage);
} }
} catch (Exception e) { } catch (Exception e) {
logger.error("Exception getting status from " + wdr); LOGGER.error("Exception getting status from " + wdr);
} }
logger.error(message.toString()); LOGGER.error(message.toString());
throw new IOException(message.toString()); throw new IOException(message.toString());
} }
@ -411,14 +412,14 @@ public class ExchangeSession {
int code = wdr.retrieveSessionInstance().executeMethod(putmethod); int code = wdr.retrieveSessionInstance().executeMethod(putmethod);
if (code == 200) { if (code == HttpURLConnection.HTTP_OK) {
logger.warn("Overwritten message " + messageUrl); LOGGER.warn("Overwritten message " + messageUrl);
} else if (code != 201) { } else if (code != HttpURLConnection.HTTP_CREATED) {
throw new IOException("Unable to create message " + code + " " + putmethod.getStatusLine()); throw new IOException("Unable to create message " + code + " " + putmethod.getStatusLine());
} }
} }
protected Message buildMessage(ResponseEntity responseEntity) throws URIException { protected Message buildMessage(ResponseEntity responseEntity) throws IOException {
Message message = new Message(); Message message = new Message();
message.messageUrl = URIUtil.decode(responseEntity.getHref()); message.messageUrl = URIUtil.decode(responseEntity.getHref());
Enumeration propertiesEnum = responseEntity.getProperties(); Enumeration propertiesEnum = responseEntity.getProperties();
@ -458,7 +459,7 @@ public class ExchangeSession {
} else if ("subject".equals(prop.getLocalName())) { } else if ("subject".equals(prop.getLocalName())) {
message.subject = prop.getPropertyAsString(); message.subject = prop.getPropertyAsString();
} else if ("priority".equals(prop.getLocalName())) { } else if ("priority".equals(prop.getLocalName())) {
String priorityLabel = priorities.get(prop.getPropertyAsString()); String priorityLabel = PRIORITIES.get(prop.getPropertyAsString());
if (priorityLabel != null) { if (priorityLabel != null) {
message.priority = priorityLabel; message.priority = priorityLabel;
} }
@ -477,11 +478,12 @@ public class ExchangeSession {
wdr.setDebug(4); wdr.setDebug(4);
wdr.propfindMethod(messageUrl, 0); wdr.propfindMethod(messageUrl, 0);
Enumeration messageEnum = wdr.propfindMethod(messageUrl, 0, messageRequestProperties); Enumeration messageEnum = wdr.propfindMethod(messageUrl, 0, MESSAGE_REQUEST_PROPERTIES);
wdr.setDebug(0); wdr.setDebug(0);
// 201 created in some cases ?!? // 201 created in some cases ?!?
if ((wdr.getStatusCode() != 200 && wdr.getStatusCode() != 201) || !messageEnum.hasMoreElements()) { if ((wdr.getStatusCode() != HttpURLConnection.HTTP_OK && wdr.getStatusCode() != HttpURLConnection.HTTP_CREATED)
|| !messageEnum.hasMoreElements()) {
throw new IOException("Unable to get message: " + wdr.getStatusCode() throw new IOException("Unable to get message: " + wdr.getStatusCode()
+ " " + wdr.getStatusMessage()); + " " + wdr.getStatusMessage());
} }
@ -496,7 +498,7 @@ public class ExchangeSession {
wdr.setDebug(4); wdr.setDebug(4);
wdr.propfindMethod(currentFolderUrl, 1); wdr.propfindMethod(currentFolderUrl, 1);
Enumeration folderEnum = wdr.propfindMethod(currentFolderUrl, 1, messageRequestProperties); Enumeration folderEnum = wdr.propfindMethod(currentFolderUrl, 1, MESSAGE_REQUEST_PROPERTIES);
wdr.setDebug(0); wdr.setDebug(0);
while (folderEnum.hasMoreElements()) { while (folderEnum.hasMoreElements()) {
ResponseEntity entity = (ResponseEntity) folderEnum.nextElement(); ResponseEntity entity = (ResponseEntity) folderEnum.nextElement();
@ -526,7 +528,7 @@ public class ExchangeSession {
Calendar cal = Calendar.getInstance(); Calendar cal = Calendar.getInstance();
cal.add(Calendar.DAY_OF_MONTH, -keepDelay); cal.add(Calendar.DAY_OF_MONTH, -keepDelay);
logger.debug("Keep message not before " + cal.getTime()); LOGGER.debug("Keep message not before " + cal.getTime());
long keepTimestamp = cal.getTimeInMillis(); long keepTimestamp = cal.getTimeInMillis();
Vector<String> deleteRequestProperties = new Vector<String>(); Vector<String> deleteRequestProperties = new Vector<String>();
@ -555,11 +557,11 @@ public class ExchangeSession {
try { try {
parsedDate = dateParser.parse(lastModifiedString); parsedDate = dateParser.parse(lastModifiedString);
if (parsedDate.getTime() < keepTimestamp) { if (parsedDate.getTime() < keepTimestamp) {
logger.debug("Delete " + messageUrl + " last modified " + parsedDate); LOGGER.debug("Delete " + messageUrl + " last modified " + parsedDate);
wdr.deleteMethod(messageUrl); wdr.deleteMethod(messageUrl);
} }
} catch (ParseException e) { } catch (ParseException e) {
logger.warn("Invalid message modified date " + lastModifiedString + " on " + messageUrl); LOGGER.warn("Invalid message modified date " + lastModifiedString + " on " + messageUrl);
} }
} }
@ -913,7 +915,7 @@ public class ExchangeSession {
if (attachment == null) { if (attachment == null) {
// only warn, could happen depending on IIS config // only warn, could happen depending on IIS config
//throw new IOException("Attachment " + partHeader.name + " not found in " + messageUrl); //throw new IOException("Attachment " + partHeader.name + " not found in " + messageUrl);
logger.warn("Attachment " + partHeader.name + " not found in " + messageUrl); LOGGER.warn("Attachment " + partHeader.name + " not found in " + messageUrl);
} else { } else {
writeAttachment(os, partHeader, attachment); writeAttachment(os, partHeader, attachment);
} }
@ -1057,7 +1059,7 @@ public class ExchangeSession {
public void delete() throws IOException { public void delete() throws IOException {
// TODO : refactor // TODO : refactor
String destination = deleteditemsUrl + messageUrl.substring(messageUrl.lastIndexOf("/")); String destination = deleteditemsUrl + messageUrl.substring(messageUrl.lastIndexOf("/"));
logger.debug("Deleting : " + messageUrl + " to " + destination); LOGGER.debug("Deleting : " + messageUrl + " to " + destination);
/* /*
// first try without webdav library // first try without webdav library
GetMethod moveMethod = new GetMethod(URIUtil.encodePathQuery(messageUrl)) { GetMethod moveMethod = new GetMethod(URIUtil.encodePathQuery(messageUrl)) {
@ -1092,7 +1094,7 @@ public class ExchangeSession {
} }
} }
logger.debug("Deleted to :" + destination + " " + wdr.getStatusCode() + " " + wdr.getStatusMessage()); LOGGER.debug("Deleted to :" + destination + " " + wdr.getStatusCode() + " " + wdr.getStatusMessage());
} }
@ -1140,7 +1142,7 @@ public class ExchangeSession {
String result; String result;
try { try {
String decodedPath = URIUtil.decode(attachmentUrl); String decodedPath = URIUtil.decode(attachmentUrl);
logger.debug("Head " + decodedPath); LOGGER.debug("Head " + decodedPath);
ConnectionCloseHeadMethod method = new ConnectionCloseHeadMethod(URIUtil.encodePathQuery(decodedPath)); ConnectionCloseHeadMethod method = new ConnectionCloseHeadMethod(URIUtil.encodePathQuery(decodedPath));
wdr.retrieveSessionInstance().executeMethod(method); wdr.retrieveSessionInstance().executeMethod(method);
@ -1190,7 +1192,7 @@ public class ExchangeSession {
} }
xmlDocument.load(builder.build(w3cDocument)); xmlDocument.load(builder.build(w3cDocument));
} catch (Exception ex1) { } catch (Exception ex1) {
logger.error("Exception parsing document", ex1); LOGGER.error("Exception parsing document", ex1);
} }
return xmlDocument; return xmlDocument;
} }
@ -1263,11 +1265,11 @@ public class ExchangeSession {
attachment.href = attachmentHref; attachment.href = attachmentHref;
attachmentsMap.put(attachmentName, attachment); attachmentsMap.put(attachmentName, attachment);
logger.debug("Attachment " + attachmentIndex + " : " + attachmentName); LOGGER.debug("Attachment " + attachmentIndex + " : " + attachmentName);
// add a second count based map entry // add a second count based map entry
attachmentsMap.put(String.valueOf(attachmentIndex++), attachment); attachmentsMap.put(String.valueOf(attachmentIndex++), attachment);
} else { } else {
logger.warn("Message URL : " + messageUrl + " is not a substring of attachment URL : " + attachmentHref); LOGGER.warn("Message URL : " + messageUrl + " is not a substring of attachment URL : " + attachmentHref);
} }
} }
} }
@ -1339,13 +1341,13 @@ public class ExchangeSession {
htmlBody = htmlBody.replaceFirst(attachment.contentid, "cid:" + attachment.contentid); htmlBody = htmlBody.replaceFirst(attachment.contentid, "cid:" + attachment.contentid);
} }
} else { } else {
logger.warn("More images in OWA body !"); LOGGER.warn("More images in OWA body !");
} }
// add only inline images // add only inline images
if (attachment.contentid != null) { if (attachment.contentid != null) {
attachmentsMap.put(attachmentName, attachment); attachmentsMap.put(attachmentName, attachment);
} }
logger.debug("Inline image attachment ID:" + attachment.contentid LOGGER.debug("Inline image attachment ID:" + attachment.contentid
+ " name: " + attachment.name + " href: " + attachment.href); + " name: " + attachment.name + " href: " + attachment.href);
} }
} }

View File

@ -9,7 +9,7 @@ import java.net.Socket;
* Pop3 server * Pop3 server
*/ */
public class PopServer extends AbstractServer { public class PopServer extends AbstractServer {
public final static int DEFAULT_PORT = 110; public static final int DEFAULT_PORT = 110;
/** /**
* Create a ServerSocket to listen for connections. * Create a ServerSocket to listen for connections.

View File

@ -1,12 +1,11 @@
package davmail.smtp; package davmail.smtp;
import davmail.AbstractServer;
import java.net.Socket; import java.net.Socket;
import davmail.AbstractServer;
import davmail.Settings;
public class SmtpServer extends AbstractServer { public class SmtpServer extends AbstractServer {
public final static int DEFAULT_PORT = 25; public static final int DEFAULT_PORT = 25;
/** /**
* Create a ServerSocket to listen for connections. * Create a ServerSocket to listen for connections.

View File

@ -19,6 +19,6 @@
<item name="SourceForge site" href="http://sourceforge.net/projects/davmail"/> <item name="SourceForge site" href="http://sourceforge.net/projects/davmail"/>
</menu> </menu>
${reports} <menu ref="reports"/>
</body> </body>
</project> </project>