1
0
mirror of https://github.com/moparisthebest/davmail synced 2024-08-13 16:53:51 -04:00

Fixes from checkStyle audit

git-svn-id: http://svn.code.sf.net/p/davmail/code/trunk@734 3d1905a2-6b24-0410-a738-b14d5a86fcbd
This commit is contained in:
mguessan 2009-09-21 21:34:13 +00:00
parent e405d4a31f
commit 07569c5583
12 changed files with 156 additions and 126 deletions

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.1//EN"
"http://www.puppycrawl.com/dtds/configuration_1_1.dtd">
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<!--
@ -31,31 +31,51 @@
-->
<module name="Checker">
<!--
If you set the basedir property below, then all reported file
names will be relative to the specified directory. See
http://checkstyle.sourceforge.net/5.x/config.html#Checker
<!-- Checks that a package.html file exists for each package. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#PackageHtml
<module name="PackageHtml"/>-->
<property name="basedir" value="${basedir}"/>
-->
<!-- Checks that a package-info.java file exists for each package. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
<!--module name="JavadocPackage"/-->
<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
<!-- <module name="NewlineAtEndOfFile"/> -->
<!--module name="NewlineAtEndOfFile"/-->
<!-- Checks that property files contain the same keys. -->
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
<module name="Translation"/>
<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<!--module name="FileLength"/-->
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<!--module name="FileTabCharacter"/-->
<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<!--module name="RegexpSingleline">
<property name="format" value="\s+$"/>
<property name="minimum" value="0"/>
<property name="maximum" value="0"/>
<property name="message" value="Line has trailing spaces."/>
</module-->
<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"/>
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<!--module name="JavadocMethod"/>
<module name="JavadocType"/>
<module name="JavadocVariable"/>
<module name="JavadocStyle"/>
-->
<module name="JavadocStyle"/-->
<!-- Checks for Naming Conventions. -->
@ -71,9 +91,9 @@
<module name="TypeName"/>
<!-- Checks for Headers -->
<!-- See http://checkstyle.sf.net/config_header.html -->
<!--module name="Header"-->
<!-- 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 -->
@ -83,8 +103,7 @@
<!-- <property -->
<!-- name="headerFile" -->
<!-- value="${basedir}/java.header"/> -->
<!--property name="headerFile" value="${checkstyle.header.file}"/>
</module-->
<!-- </module> -->
<!-- Following interprets the header file as regular expressions. -->
<!-- <module name="RegexpHeader"/> -->
@ -93,31 +112,30 @@
<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<!--module name="AvoidStarImport"/-->
<module name="IllegalImport"/>
<!-- defaults to sun.* packages -->
<!--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="LineLength"/-->
<!--module name="MethodLength"/-->
<module name="ParameterNumber"/>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<!-- <module name="EmptyForIteratorPad"/>
<!--module name="EmptyForIteratorPad"/>
<module name="GenericWhitespace"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="TabCharacter"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>-->
<module name="WhitespaceAround"/-->
<!-- Modifier Checks -->
@ -129,12 +147,11 @@
<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<!--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"/-->
@ -142,9 +159,9 @@
<!-- MY FAVOURITE -->
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<!-- <module name="HiddenField"/> -->
<!--module name="HiddenField"/-->
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<!--module name="InnerAssignment"/-->
<!--module name="MagicNumber"/-->
<module name="MissingSwitchDefault"/>
<module name="RedundantThrows"/>
@ -153,24 +170,20 @@
<!-- Checks for class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<!-- <module name="DesignForExtension"/> -->
<!--module name="DesignForExtension"/-->
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier">
<!--module name="VisibilityModifier">
<property name="packageAllowed" value="true"/>
<property name="protectedAllowed" value="true"/>
</module>
</module-->
<!-- 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="FinalParameters"/-->
<module name="TodoComment"/>
<module name="UpperEll"/>

View File

@ -40,7 +40,7 @@ import java.util.ArrayList;
/**
* DavGateway main class
*/
public class DavGateway {
public final class DavGateway {
private static final String HTTP_DAVMAIL_SOURCEFORGE_NET_VERSION_TXT = "http://davmail.sourceforge.net/version.txt";
private static boolean stopped;
@ -48,7 +48,7 @@ public class DavGateway {
private DavGateway() {
}
private static final ArrayList<AbstractServer> serverList = new ArrayList<AbstractServer>();
private static final ArrayList<AbstractServer> SERVER_LIST = new ArrayList<AbstractServer>();
/**
* Start the gateway, listen on spécified smtp and pop3 ports
@ -101,32 +101,32 @@ public class DavGateway {
// prepare HTTP connection pool
DavGatewayHttpClientFacade.start();
serverList.clear();
SERVER_LIST.clear();
int smtpPort = Settings.getIntProperty("davmail.smtpPort");
if (smtpPort != 0) {
serverList.add(new SmtpServer(smtpPort));
SERVER_LIST.add(new SmtpServer(smtpPort));
}
int popPort = Settings.getIntProperty("davmail.popPort");
if (popPort != 0) {
serverList.add(new PopServer(popPort));
SERVER_LIST.add(new PopServer(popPort));
}
int imapPort = Settings.getIntProperty("davmail.imapPort");
if (imapPort != 0) {
serverList.add(new ImapServer(imapPort));
SERVER_LIST.add(new ImapServer(imapPort));
}
int caldavPort = Settings.getIntProperty("davmail.caldavPort");
if (caldavPort != 0) {
serverList.add(new CaldavServer(caldavPort));
SERVER_LIST.add(new CaldavServer(caldavPort));
}
int ldapPort = Settings.getIntProperty("davmail.ldapPort");
if (ldapPort != 0) {
serverList.add(new LdapServer(ldapPort));
SERVER_LIST.add(new LdapServer(ldapPort));
}
BundleMessage.BundleMessageList messages = new BundleMessage.BundleMessageList();
BundleMessage.BundleMessageList errorMessages = new BundleMessage.BundleMessageList();
for (AbstractServer server : serverList) {
for (AbstractServer server : SERVER_LIST) {
try {
server.bind();
server.start();
@ -157,7 +157,7 @@ public class DavGateway {
* Stop all listeners, shutdown connection pool and clear session cache.
*/
public static void stop() {
for (AbstractServer server : serverList) {
for (AbstractServer server : SERVER_LIST) {
server.close();
try {
server.join();

View File

@ -28,9 +28,9 @@ import org.apache.log4j.*;
/**
* Settings facade.
* DavMail settings are stored in the .davmail.properties file in current
* user home directory or in the file specified on the command line.
* user home directory or in the file specified on the command line.
*/
public class Settings {
public final class Settings {
private Settings() {
}
@ -40,7 +40,8 @@ public class Settings {
/**
* Set config file path (from command line parameter).
* @param path davmail properties file path
*
* @param path davmail properties file path
*/
public static synchronized void setConfigFilePath(String path) {
configFilePath = path;
@ -48,6 +49,7 @@ public class Settings {
/**
* Detect first launch (properties file does not exist).
*
* @return true if this is the first start with the current file path
*/
public static synchronized boolean isFirstStart() {
@ -56,6 +58,7 @@ public class Settings {
/**
* Load properties from provided stream (used in webapp mode).
*
* @param inputStream properties stream
* @throws IOException on error
*/
@ -130,10 +133,11 @@ public class Settings {
/**
* Return DavMail log file path
*
* @return full log file path
*/
public static String getLogFilePath() {
String logFilePath = Settings.getProperty("davmail.logFilePath");
String logFilePath = Settings.getProperty("davmail.logFilePath");
// use default log file path on Mac OS X
if ((logFilePath == null || logFilePath.length() == 0)
&& System.getProperty("os.name").toLowerCase().startsWith("mac os x")) {
@ -144,6 +148,7 @@ public class Settings {
/**
* Return DavMail log file directory
*
* @return full log file directory
*/
public static String getLogFileDirectory() {
@ -153,7 +158,7 @@ public class Settings {
}
int lastSlashIndex = logFilePath.lastIndexOf('/');
if (lastSlashIndex == -1) {
lastSlashIndex = logFilePath.lastIndexOf('\\');
lastSlashIndex = logFilePath.lastIndexOf('\\');
}
if (lastSlashIndex >= 0) {
return logFilePath.substring(0, lastSlashIndex);
@ -165,7 +170,7 @@ public class Settings {
/**
* Update Log4J config from settings.
*/
protected static void updateLoggingConfig() {
private static void updateLoggingConfig() {
String logFilePath = getLogFilePath();
Logger rootLogger = Logger.getRootLogger();
@ -229,6 +234,7 @@ public class Settings {
/**
* Get a property value as String.
*
* @param property property name
* @return property value
*/
@ -238,8 +244,9 @@ public class Settings {
/**
* Set a property value.
*
* @param property property name
* @param value property value
* @param value property value
*/
public static synchronized void setProperty(String property, String value) {
if (value != null) {
@ -251,6 +258,7 @@ public class Settings {
/**
* Get a property value as int.
*
* @param property property name
* @return property value
*/
@ -260,7 +268,8 @@ public class Settings {
/**
* Get a property value as int, return default value if null.
* @param property property name
*
* @param property property name
* @param defaultValue default property value
* @return property value
*/
@ -279,6 +288,7 @@ public class Settings {
/**
* Get a property value as boolean.
*
* @param property property name
* @return property value
*/
@ -289,10 +299,11 @@ public class Settings {
/**
* Build logging properties prefix.
*
* @param category logging category
* @return prefix
*/
protected static String getLoggingPrefix(String category) {
private static String getLoggingPrefix(String category) {
String prefix;
if ("rootLogger".equals(category)) {
prefix = "log4j.";
@ -304,6 +315,7 @@ public class Settings {
/**
* Return Log4J logging level for the category.
*
* @param category logging category
* @return logging level
*/
@ -322,8 +334,9 @@ public class Settings {
/**
* Set Log4J logging level for the category
*
* @param category logging category
* @param level logging level
* @param level logging level
*/
public static synchronized void setLoggingLevel(String category, Level level) {
String prefix = getLoggingPrefix(category);
@ -337,8 +350,9 @@ public class Settings {
/**
* Change and save a single property.
*
* @param property property name
* @param value property value
* @param value property value
*/
public static synchronized void saveProperty(String property, String value) {
Settings.load();

View File

@ -521,7 +521,7 @@ public class CaldavConnection extends AbstractConnection {
List<ExchangeSession.Event> events = session.getAllEvents(folderPath);
DavGatewayTray.debug(new BundleMessage("LOG_FOUND_CALENDAR_EVENTS", events.size()));
appendEventsResponses(response, request, events);
// TODO: does not work with iCal3
// TODO does not work with iCal3
/*
List<ExchangeSession.Folder> folderList = session.getSubCalendarFolders(folderPath, false);
for (ExchangeSession.Folder folder : folderList) {
@ -581,10 +581,9 @@ public class CaldavConnection extends AbstractConnection {
DavGatewayTray.switchIcon();
try {
String eventName = getEventFileNameFromPath(href);
if (eventName == null || eventName.length() == 0
|| "inbox".equals(eventName) || "calendar".equals(eventName)) {
// Sunbird: just ignore
} else {
// ignore cases for Sunbird
if (eventName != null && eventName.length() > 0
&& !"inbox".equals(eventName) && !"calendar".equals(eventName)) {
appendEventResponse(response, request, session.getEvent(folderPath, eventName));
}
} catch (HttpException e) {

View File

@ -375,31 +375,31 @@ public class ExchangeSession {
for (Object content : contents) {
if (content instanceof CommentToken) {
String scriptValue = ((CommentToken) content).getCommentedContent();
int a_sUrlIndex = scriptValue.indexOf("var a_sUrl = \"");
int a_sLgnIndex = scriptValue.indexOf("var a_sLgn = \"");
if (a_sUrlIndex >= 0 && a_sLgnIndex >= 0) {
a_sUrlIndex += "var a_sUrl = \"".length();
a_sLgnIndex += "var a_sLgn = \"".length();
int a_sUrlEndIndex = scriptValue.indexOf('\"', a_sUrlIndex);
int a_sLgnEndIndex = scriptValue.indexOf('\"', a_sLgnIndex);
if (a_sUrlEndIndex >= 0 && a_sLgnEndIndex >= 0) {
String pathQuery = scriptValue.substring(a_sLgnIndex, a_sLgnEndIndex) +
scriptValue.substring(a_sUrlIndex, a_sUrlEndIndex);
int sUrlIndex = scriptValue.indexOf("var a_sUrl = \"");
int sLgnIndex = scriptValue.indexOf("var a_sLgn = \"");
if (sUrlIndex >= 0 && sLgnIndex >= 0) {
sUrlIndex += "var a_sUrl = \"".length();
sLgnIndex += "var a_sLgn = \"".length();
int sUrlEndIndex = scriptValue.indexOf('\"', sUrlIndex);
int sLgnEndIndex = scriptValue.indexOf('\"', sLgnIndex);
if (sUrlEndIndex >= 0 && sLgnEndIndex >= 0) {
String pathQuery = scriptValue.substring(sLgnIndex, sLgnEndIndex) +
scriptValue.substring(sUrlIndex, sUrlEndIndex);
String src = getScriptBasedFormURL(initmethod, pathQuery);
LOGGER.debug("Detected script based logon, redirect to form at " + src);
HttpMethod newInitMethod = DavGatewayHttpClientFacade.executeFollowRedirects(httpClient, src);
logonMethod = buildLogonMethod(httpClient, newInitMethod);
}
} else {
a_sLgnIndex = scriptValue.indexOf("var a_sLgnQS = \"");
if (a_sUrlIndex >= 0 && a_sLgnIndex >= 0) {
a_sUrlIndex += "var a_sUrl = \"".length();
a_sLgnIndex += "var a_sLgnQS = \"".length();
int a_sUrlEndIndex = scriptValue.indexOf('\"', a_sUrlIndex);
int a_sLgnEndIndex = scriptValue.indexOf('\"', a_sLgnIndex);
if (a_sUrlEndIndex >= 0 && a_sLgnEndIndex >= 0) {
String pathQuery = scriptValue.substring(a_sLgnIndex, a_sLgnEndIndex) +
scriptValue.substring(a_sUrlIndex, a_sUrlEndIndex);
sLgnIndex = scriptValue.indexOf("var a_sLgnQS = \"");
if (sUrlIndex >= 0 && sLgnIndex >= 0) {
sUrlIndex += "var a_sUrl = \"".length();
sLgnIndex += "var a_sLgnQS = \"".length();
int sUrlEndIndex = scriptValue.indexOf('\"', sUrlIndex);
int sLgnEndIndex = scriptValue.indexOf('\"', sLgnIndex);
if (sUrlEndIndex >= 0 && sLgnEndIndex >= 0) {
String pathQuery = scriptValue.substring(sLgnIndex, sLgnEndIndex) +
scriptValue.substring(sUrlIndex, sUrlEndIndex);
String src = getScriptBasedFormURL(initmethod, pathQuery);
LOGGER.debug("Detected script based logon, redirect to form at " + src);
HttpMethod newInitMethod = DavGatewayHttpClientFacade.executeFollowRedirects(httpClient, src);
@ -460,9 +460,10 @@ public class ExchangeSession {
}
}
static final String BASE_HREF = "<base href=\"";
protected void buildMailPath(HttpMethod method) throws DavMailAuthenticationException {
// find base url
final String BASE_HREF = "<base href=\"";
String line;
// get user mail URL from html body (multi frame)
@ -2569,6 +2570,8 @@ public class ExchangeSession {
}
}
static final String MAILBOX_BASE = "cn=recipients/cn=";
protected String getAliasFromOptions(String path) {
String result = null;
// get user mail URL from html body
@ -2579,7 +2582,6 @@ public class ExchangeSession {
optionsPageReader = new BufferedReader(new InputStreamReader(optionsMethod.getResponseBodyAsStream()));
String line;
// find mailbox full name
final String MAILBOX_BASE = "cn=recipients/cn=";
//noinspection StatementWithEmptyBody
while ((line = optionsPageReader.readLine()) != null && line.toLowerCase().indexOf(MAILBOX_BASE) == -1) {
}

View File

@ -39,14 +39,14 @@ import java.util.Map;
*/
public final class ExchangeSessionFactory {
private static final Object LOCK = new Object();
private static final Map<PoolKey, ExchangeSession> poolMap = new HashMap<PoolKey, ExchangeSession>();
private static final Map<PoolKey, ExchangeSession> POOL_MAP = new HashMap<PoolKey, ExchangeSession>();
private static boolean configChecked;
private static boolean errorSent;
static class PoolKey {
public final String url;
public final String userName;
public final String password;
final String url;
final String userName;
final String password;
PoolKey(String url, String userName, String password) {
this.url = url;
@ -87,7 +87,7 @@ public final class ExchangeSessionFactory {
PoolKey poolKey = new PoolKey(baseUrl, userName, password);
synchronized (LOCK) {
session = poolMap.get(poolKey);
session = POOL_MAP.get(poolKey);
}
if (session != null) {
ExchangeSession.LOGGER.debug("Got session " + session + " from cache");
@ -98,7 +98,7 @@ public final class ExchangeSessionFactory {
session = null;
// expired session, remove from cache
synchronized (LOCK) {
poolMap.remove(poolKey);
POOL_MAP.remove(poolKey);
}
}
@ -108,7 +108,7 @@ public final class ExchangeSessionFactory {
}
// successfull login, put session in cache
synchronized (LOCK) {
poolMap.put(poolKey, session);
POOL_MAP.put(poolKey, session);
}
// session opened, future failure will mean network down
configChecked = true;
@ -204,6 +204,6 @@ public final class ExchangeSessionFactory {
public static void reset() {
configChecked = false;
errorSent = false;
poolMap.clear();
POOL_MAP.clear();
}
}

View File

@ -27,6 +27,7 @@ public class ICSBufferedWriter {
/**
* Write line to buffer, split lines at 75 characters.
*
* @param line ics event line
*/
public void writeLine(String line) {
@ -47,11 +48,12 @@ public class ICSBufferedWriter {
/**
* Get buffer as String
*
* @return ICS content as String
*/
@Override
public String toString() {
return buffer.toString();
return buffer.toString();
}
}

View File

@ -281,21 +281,21 @@ public class ImapConnection extends AbstractConnection {
sendClient(commandId + " OK SEARCH completed");
} else if ("store".equalsIgnoreCase(subcommand)) {
UIDRangeIterator UIDRangeIterator = new UIDRangeIterator(tokens.nextToken());
UIDRangeIterator uidRangeIterator = new UIDRangeIterator(tokens.nextToken());
String action = tokens.nextToken();
String flags = tokens.nextToken();
while (UIDRangeIterator.hasNext()) {
ExchangeSession.Message message = UIDRangeIterator.next();
while (uidRangeIterator.hasNext()) {
ExchangeSession.Message message = uidRangeIterator.next();
updateFlags(message, action, flags);
sendClient("* " + (UIDRangeIterator.currentIndex) + " FETCH (UID " + message.getImapUid() + " FLAGS (" + (message.getImapFlags()) + "))");
sendClient("* " + (uidRangeIterator.currentIndex) + " FETCH (UID " + message.getImapUid() + " FLAGS (" + (message.getImapFlags()) + "))");
}
sendClient(commandId + " OK STORE completed");
} else if ("copy".equalsIgnoreCase(subcommand)) {
try {
UIDRangeIterator UIDRangeIterator = new UIDRangeIterator(tokens.nextToken());
UIDRangeIterator uidRangeIterator = new UIDRangeIterator(tokens.nextToken());
String targetName = BASE64MailboxDecoder.decode(tokens.nextToken());
while (UIDRangeIterator.hasNext()) {
ExchangeSession.Message message = UIDRangeIterator.next();
while (uidRangeIterator.hasNext()) {
ExchangeSession.Message message = uidRangeIterator.next();
session.copyMessage(message, targetName);
}
sendClient(commandId + " OK copy completed");
@ -588,7 +588,7 @@ public class ImapConnection extends AbstractConnection {
protected void appendBodyStructure(StringBuilder buffer, ExchangeSession.Message message) throws IOException {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
message.write(baos);
buffer.append(" BODYSTRUCTURE ");
try {
MimeMessage mimeMessage = new MimeMessage(null, new ByteArrayInputStream(baos.toByteArray()));
@ -947,18 +947,18 @@ public class ImapConnection extends AbstractConnection {
/**
* Filter to output only headers, also count full size
*/
private static class PartOutputStream extends FilterOutputStream {
protected static final int START = 0;
protected static final int CR = 1;
protected static final int CRLF = 2;
protected static final int CRLFCR = 3;
protected static final int BODY = 4;
private static final class PartOutputStream extends FilterOutputStream {
private static final int START = 0;
private static final int CR = 1;
private static final int CRLF = 2;
private static final int CRLFCR = 3;
private static final int BODY = 4;
protected int state = START;
protected int size;
protected final boolean writeHeaders;
protected final boolean writeBody;
protected final int startIndex;
private int state = START;
private int size;
private final boolean writeHeaders;
private final boolean writeBody;
private final int startIndex;
private PartOutputStream(OutputStream os, boolean writeHeaders, boolean writeBody,
int startIndex) {

View File

@ -308,12 +308,12 @@ public class LdapConnection extends AbstractConnection {
/**
* For some unknow reaseon parseIntWithTag is private !
*/
static final Method parseIntWithTag;
static final Method PARSE_INT_WITH_TAG_METHOD;
static {
try {
parseIntWithTag = BerDecoder.class.getDeclaredMethod("parseIntWithTag", int.class);
parseIntWithTag.setAccessible(true);
PARSE_INT_WITH_TAG_METHOD = BerDecoder.class.getDeclaredMethod("parseIntWithTag", int.class);
PARSE_INT_WITH_TAG_METHOD.setAccessible(true);
} catch (NoSuchMethodException e) {
DavGatewayTray.error(new BundleMessage("LOG_UNABLE_TO_GET_PARSEINTWITHTAG"));
throw new RuntimeException(e);
@ -626,7 +626,7 @@ public class LdapConnection extends AbstractConnection {
} else if (requestOperation == LDAP_REQ_ABANDON) {
int canceledMessageId = 0;
try {
canceledMessageId = (Integer) parseIntWithTag.invoke(reqBer, LDAP_REQ_ABANDON);
canceledMessageId = (Integer) PARSE_INT_WITH_TAG_METHOD.invoke(reqBer, LDAP_REQ_ABANDON);
} catch (IllegalAccessException e) {
DavGatewayTray.error(e);
} catch (InvocationTargetException e) {

View File

@ -290,15 +290,15 @@ public class PopConnection extends AbstractConnection {
/**
* Filter to limit output lines to max body lines after header
*/
private static class TopOutputStream extends FilterOutputStream {
protected static final int START = 0;
protected static final int CR = 1;
protected static final int CRLF = 2;
protected static final int CRLFCR = 3;
protected static final int BODY = 4;
private static final class TopOutputStream extends FilterOutputStream {
private static final int START = 0;
private static final int CR = 1;
private static final int CRLF = 2;
private static final int CRLFCR = 3;
private static final int BODY = 4;
protected int maxLines;
protected int state = START;
private int maxLines;
private int state = START;
private TopOutputStream(OutputStream os, int maxLines) {
super(os);

View File

@ -24,7 +24,7 @@ import java.net.URI;
/**
* Failover: Runtime.exec open URL
*/
public class OSXDesktopBrowser {
public final class OSXDesktopBrowser {
private OSXDesktopBrowser() {
}

View File

@ -33,7 +33,7 @@ import java.net.URL;
/**
* Tray icon handler
*/
public class DavGatewayTray {
public final class DavGatewayTray {
protected static final Logger LOGGER = Logger.getLogger("davmail");
private DavGatewayTray() {