http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java index 452f135..9297b3d 100644 --- a/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java +++ b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/CyrusHostSystem.java @@ -91,21 +91,21 @@ public class CyrusHostSystem extends ExternalHostSystem implements Provider<Cont @Override public void createMailbox(MailboxPath mailboxPath) { ProtocolSession protocolSession = logAndGetAdminProtocolSession(new ProtocolSession()); - protocolSession.CL(String.format("A1 CREATE %s", createMailboxStringFromMailboxPath(mailboxPath))); - protocolSession.SL("A1 OK .*", CREATE_MAILBOX_LOCATION); + protocolSession.cl(String.format("A1 CREATE %s", createMailboxStringFromMailboxPath(mailboxPath))); + protocolSession.sl("A1 OK .*", CREATE_MAILBOX_LOCATION); executeProtocolSession(logoutAndGetProtocolSession(protocolSession)); } public ProtocolSession logoutAndGetProtocolSession(ProtocolSession protocolSession) { - protocolSession.CL("A2 LOGOUT"); - protocolSession.SL("\\* BYE .*", CREATE_MAILBOX_LOCATION); + protocolSession.cl("A2 LOGOUT"); + protocolSession.sl("\\* BYE .*", CREATE_MAILBOX_LOCATION); return protocolSession; } public ProtocolSession logAndGetAdminProtocolSession(ProtocolSession protocolSession) { - protocolSession.SL(".*", CREATE_MAILBOX_LOCATION); - protocolSession.CL(". LOGIN cyrus cyrus"); - protocolSession.SL("\\. OK .*", CREATE_MAILBOX_LOCATION); + protocolSession.sl(".*", CREATE_MAILBOX_LOCATION); + protocolSession.cl(". LOGIN cyrus cyrus"); + protocolSession.sl("\\. OK .*", CREATE_MAILBOX_LOCATION); return protocolSession; }
http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/GrantRightsOnCyrusHost.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/GrantRightsOnCyrusHost.java b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/GrantRightsOnCyrusHost.java index da23f6d..59a9460 100644 --- a/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/GrantRightsOnCyrusHost.java +++ b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/GrantRightsOnCyrusHost.java @@ -38,11 +38,11 @@ public class GrantRightsOnCyrusHost implements GrantRightsOnHost { public void grantRights(MailboxPath mailboxPath, String userName, MailboxACL.Rfc4314Rights rights) throws Exception { ProtocolSession protocolSession = system.logAndGetAdminProtocolSession(new ProtocolSession()); - protocolSession.CL(String.format("A1 SETACL %s %s %s", + protocolSession.cl(String.format("A1 SETACL %s %s %s", system.createMailboxStringFromMailboxPath(mailboxPath), userName, rights.serialize())); - protocolSession.SL("A1 OK .*", GRANT_RIGHTS_LOCATION); + protocolSession.sl("A1 OK .*", GRANT_RIGHTS_LOCATION); system.executeProtocolSession(system.logoutAndGetProtocolSession(protocolSession)); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/MailboxMessageAppenderOnCyrusHost.java ---------------------------------------------------------------------- diff --git a/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/MailboxMessageAppenderOnCyrusHost.java b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/MailboxMessageAppenderOnCyrusHost.java index 191c561..41d42d7 100644 --- a/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/MailboxMessageAppenderOnCyrusHost.java +++ b/mpt/impl/imap-mailbox/cyrus/src/test/java/org/apache/james/mpt/imapmailbox/cyrus/host/MailboxMessageAppenderOnCyrusHost.java @@ -38,8 +38,8 @@ public class MailboxMessageAppenderOnCyrusHost implements MailboxMessageAppender public void fillMailbox(MailboxPath mailboxPath) { String mailboxName = hostSystem.createMailboxStringFromMailboxPath(mailboxPath); ProtocolSession protocolSession = hostSystem.logAndGetAdminProtocolSession(new ProtocolSession()); - protocolSession.CL(String.format("a001 SETACL %s %s %s", mailboxName, "cyrus", "lrswipkxtecda")); - protocolSession.SL("a001 OK .*", LOCATION); + protocolSession.cl(String.format("a001 SETACL %s %s %s", mailboxName, "cyrus", "lrswipkxtecda")); + protocolSession.sl("a001 OK .*", LOCATION); appendMessage(protocolSession, "a002", mailboxName, ""); appendMessage(protocolSession, "a003", mailboxName, "\\Seen"); appendMessage(protocolSession, "a004", mailboxName, "\\Flagged"); @@ -48,19 +48,19 @@ public class MailboxMessageAppenderOnCyrusHost implements MailboxMessageAppender } private void appendMessage(ProtocolSession protocolSession, String commandId, String mailbox, String flagString) { - protocolSession.CL(String.format("%s APPEND %s (%s) {310}", commandId, mailbox, flagString)); - protocolSession.SL("\\+ go ahead", LOCATION); - protocolSession.CL("Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)"); - protocolSession.CL("From: Fred Foobar <[email protected]>"); - protocolSession.CL("Subject: afternoon meeting 2"); - protocolSession.CL("To: [email protected]"); - protocolSession.CL("Message-Id: <[email protected]>"); - protocolSession.CL("MIME-Version: 1.0"); - protocolSession.CL("Content-Type: TEXT/PLAIN; CHARSET=US-ASCII"); - protocolSession.CL(""); - protocolSession.CL("Hello Joe, could we change that to 4:00pm tomorrow?"); - protocolSession.CL(""); - protocolSession.SL(String.format("%s OK.*", commandId), LOCATION); + protocolSession.cl(String.format("%s APPEND %s (%s) {310}", commandId, mailbox, flagString)); + protocolSession.sl("\\+ go ahead", LOCATION); + protocolSession.cl("Date: Mon, 7 Feb 1994 21:52:25 -0800 (PST)"); + protocolSession.cl("From: Fred Foobar <[email protected]>"); + protocolSession.cl("Subject: afternoon meeting 2"); + protocolSession.cl("To: [email protected]"); + protocolSession.cl("Message-Id: <[email protected]>"); + protocolSession.cl("MIME-Version: 1.0"); + protocolSession.cl("Content-Type: TEXT/PLAIN; CHARSET=US-ASCII"); + protocolSession.cl(""); + protocolSession.cl("Hello Joe, could we change that to 4:00pm tomorrow?"); + protocolSession.cl(""); + protocolSession.sl(String.format("%s OK.*", commandId), LOCATION); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandDispatcher.java ---------------------------------------------------------------------- diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandDispatcher.java b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandDispatcher.java index 225b11d..13d5a90 100644 --- a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandDispatcher.java +++ b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandDispatcher.java @@ -45,14 +45,14 @@ import org.slf4j.LoggerFactory; * A CommandDispatcher is responsible to call the right {@link CommandHandler} for a given Command * */ -public class CommandDispatcher<Session extends ProtocolSession> implements ExtensibleHandler, LineHandler<Session> { +public class CommandDispatcher<SessionT extends ProtocolSession> implements ExtensibleHandler, LineHandler<SessionT> { private static final Logger LOGGER = LoggerFactory.getLogger(CommandDispatcher.class); /** * The list of available command handlers */ - private final HashMap<String, List<CommandHandler<Session>>> commandHandlerMap = new HashMap<>(); + private final HashMap<String, List<CommandHandler<SessionT>>> commandHandlerMap = new HashMap<>(); - private final List<ProtocolHandlerResultHandler<Response, Session>> rHandlers = new ArrayList<>(); + private final List<ProtocolHandlerResultHandler<Response, SessionT>> rHandlers = new ArrayList<>(); private final Collection<String> mandatoryCommands; @@ -80,8 +80,8 @@ public class CommandDispatcher<Session extends ProtocolSession> implements Exten * @param commandName the command name which will be key * @param cmdHandler The CommandHandler object */ - protected void addToMap(String commandName, CommandHandler<Session> cmdHandler) { - List<CommandHandler<Session>> handlers = commandHandlerMap.get(commandName); + protected void addToMap(String commandName, CommandHandler<SessionT> cmdHandler) { + List<CommandHandler<SessionT>> handlers = commandHandlerMap.get(commandName); if (handlers == null) { handlers = new ArrayList<>(); commandHandlerMap.put(commandName, handlers); @@ -97,12 +97,12 @@ public class CommandDispatcher<Session extends ProtocolSession> implements Exten * @param session not null * @return List of CommandHandlers */ - protected List<CommandHandler<Session>> getCommandHandlers(String command, ProtocolSession session) { + protected List<CommandHandler<SessionT>> getCommandHandlers(String command, ProtocolSession session) { if (command == null) { return null; } LOGGER.debug("Lookup command handler for command: {}", command); - List<CommandHandler<Session>> handlers = commandHandlerMap.get(command); + List<CommandHandler<SessionT>> handlers = commandHandlerMap.get(command); if (handlers == null) { handlers = commandHandlerMap.get(getUnknownCommandHandlerIdentifier()); } @@ -147,7 +147,7 @@ public class CommandDispatcher<Session extends ProtocolSession> implements Exten * (non-Javadoc) * @see org.apache.james.protocols.api.handler.LineHandler#onLine(org.apache.james.protocols.api.ProtocolSession, java.nio.ByteBuffer) */ - public Response onLine(Session session, ByteBuffer line) { + public Response onLine(SessionT session, ByteBuffer line) { try { @@ -172,12 +172,12 @@ public class CommandDispatcher<Session extends ProtocolSession> implements Exten * @param request * @return response */ - protected Response dispatchCommandHandlers(Session session, Request request) { + protected Response dispatchCommandHandlers(SessionT session, Request request) { LOGGER.debug("{} received: {}", getClass().getName(), request.getCommand()); - List<CommandHandler<Session>> commandHandlers = getCommandHandlers(request.getCommand(), session); + List<CommandHandler<SessionT>> commandHandlers = getCommandHandlers(request.getCommand(), session); // fetch the command handlers registered to the command - for (CommandHandler<Session> commandHandler : commandHandlers) { + for (CommandHandler<SessionT> commandHandler : commandHandlers) { final long start = System.currentTimeMillis(); Response response = commandHandler.onCommand(session, request); if (response != null) { @@ -195,7 +195,7 @@ public class CommandDispatcher<Session extends ProtocolSession> implements Exten return null; } - private Response executeResultHandlers(final Session session, Response responseFuture, final long executionTime, final CommandHandler<Session> cHandler, final Iterator<ProtocolHandlerResultHandler<Response, Session>> resultHandlers) { + private Response executeResultHandlers(final SessionT session, Response responseFuture, final long executionTime, final CommandHandler<SessionT> cHandler, final Iterator<ProtocolHandlerResultHandler<Response, SessionT>> resultHandlers) { // Check if the there is a ResultHandler left to execute if not just return the response if (resultHandlers.hasNext()) { // Special handling of FutureResponse @@ -229,7 +229,7 @@ public class CommandDispatcher<Session extends ProtocolSession> implements Exten * * @throws Exception */ - protected Request parseRequest(Session session, ByteBuffer buffer) throws Exception { + protected Request parseRequest(SessionT session, ByteBuffer buffer) throws Exception { String curCommandName; String curCommandArgument = null; byte[] line; http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandHandler.java ---------------------------------------------------------------------- diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandHandler.java b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandHandler.java index 9565558..5627a8f 100644 --- a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandHandler.java +++ b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/CommandHandler.java @@ -34,11 +34,11 @@ import org.apache.james.protocols.api.Response; * therefore the command handlers must store all the state information * in the Session object */ - public interface CommandHandler<Session extends ProtocolSession> extends ProtocolHandler { + public interface CommandHandler<SessionT extends ProtocolSession> extends ProtocolHandler { /** * Handle the command **/ - Response onCommand(Session session, Request request); + Response onCommand(SessionT session, Request request); /** * Return a Collection of implemented commands http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/protocols/api/src/main/java/org/apache/james/protocols/api/handler/ConnectHandler.java ---------------------------------------------------------------------- diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/ConnectHandler.java b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/ConnectHandler.java index 7bcfddf..e310d71 100644 --- a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/ConnectHandler.java +++ b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/ConnectHandler.java @@ -30,7 +30,7 @@ import org.apache.james.protocols.api.Response; * therefore the handlers must store all the state information * in the Session object */ -public interface ConnectHandler<Session extends ProtocolSession> extends ProtocolHandler { +public interface ConnectHandler<SessionT extends ProtocolSession> extends ProtocolHandler { /** * Handle connection and disconnect if true is returned * @@ -38,6 +38,6 @@ public interface ConnectHandler<Session extends ProtocolSession> extends Protoco * @return response or null * **/ - Response onConnect(Session session); + Response onConnect(SessionT session); } http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/protocols/api/src/main/java/org/apache/james/protocols/api/handler/LineHandler.java ---------------------------------------------------------------------- diff --git a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/LineHandler.java b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/LineHandler.java index 585813d..5449271 100644 --- a/protocols/api/src/main/java/org/apache/james/protocols/api/handler/LineHandler.java +++ b/protocols/api/src/main/java/org/apache/james/protocols/api/handler/LineHandler.java @@ -29,7 +29,7 @@ import org.apache.james.protocols.api.Response; * * Only one {@link LineHandler} will get called per line */ -public interface LineHandler<Session extends ProtocolSession> extends ProtocolHandler { +public interface LineHandler<SessionT extends ProtocolSession> extends ProtocolHandler { /** * Processing the give line. The line includes the {@link ProtocolSession#getLineDelimiter()} delimiter. @@ -38,6 +38,6 @@ public interface LineHandler<Session extends ProtocolSession> extends ProtocolHa * @param line not null * @return response or null */ - Response onLine(Session session, ByteBuffer buffer); + Response onLine(SessionT session, ByteBuffer buffer); } http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/protocols/imap/src/main/java/org/apache/james/imap/api/message/IdRange.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/api/message/IdRange.java b/protocols/imap/src/main/java/org/apache/james/imap/api/message/IdRange.java index 92c96d2..7739269 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/api/message/IdRange.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/api/message/IdRange.java @@ -39,43 +39,43 @@ public final class IdRange implements Iterable<Long>, Comparable<IdRange> { .toString(); } - private long _lowVal; + private long lowVal; - private long _highVal; + private long highVal; public IdRange(long singleVal) { - _lowVal = singleVal; - _highVal = singleVal; + lowVal = singleVal; + highVal = singleVal; } public IdRange(long lowVal, long highVal) { if (lowVal > highVal) { throw new IllegalArgumentException("LowVal must be <= HighVal"); } - _lowVal = lowVal; - _highVal = highVal; + this.lowVal = lowVal; + this.highVal = highVal; } public long getLowVal() { - return _lowVal; + return lowVal; } public long getHighVal() { - return _highVal; + return highVal; } public void setLowVal(long lowVal) { - if (lowVal > _highVal) { + if (lowVal > highVal) { throw new IllegalArgumentException("LowVal must be <= HighVal"); } - _lowVal = lowVal; + this.lowVal = lowVal; } public void setHighVal(long highVal) { - if (_lowVal > highVal) { + if (lowVal > highVal) { throw new IllegalArgumentException("HighVal must be >= LowVal"); } - _highVal = highVal; + this.highVal = highVal; } /** @@ -85,7 +85,7 @@ public final class IdRange implements Iterable<Long>, Comparable<IdRange> { * @return include */ public boolean includes(long value) { - return _lowVal <= value && value <= _highVal; + return lowVal <= value && value <= highVal; } /** @@ -94,8 +94,8 @@ public final class IdRange implements Iterable<Long>, Comparable<IdRange> { public int hashCode() { final int PRIME = 31; int result = 1; - result = PRIME * result + (int) (_highVal ^ (_highVal >>> 32)); - result = PRIME * result + (int) (_lowVal ^ (_lowVal >>> 32)); + result = PRIME * result + (int) (highVal ^ (highVal >>> 32)); + result = PRIME * result + (int) (lowVal ^ (lowVal >>> 32)); return result; } @@ -113,10 +113,10 @@ public final class IdRange implements Iterable<Long>, Comparable<IdRange> { return false; } final IdRange other = (IdRange) obj; - if (_highVal != other._highVal) { + if (highVal != other.highVal) { return false; } - if (_lowVal != other._lowVal) { + if (lowVal != other.lowVal) { return false; } return true; @@ -128,14 +128,14 @@ public final class IdRange implements Iterable<Long>, Comparable<IdRange> { * @return a <code>String</code> representation of this object. */ public String toString() { - return "IdRange ( " + this._lowVal + "->" + this._highVal + " )"; + return "IdRange ( " + this.lowVal + "->" + this.highVal + " )"; } public String getFormattedString() { - if (this._lowVal == this._highVal) { - return Long.toString(this._lowVal); + if (this.lowVal == this.highVal) { + return Long.toString(this.lowVal); } else { - return this._lowVal + ":" + this._highVal; + return this.lowVal + ":" + this.highVal; } } http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/protocols/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java index 0457a3f..8329b06 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/ImapRequestLineReader.java @@ -189,7 +189,7 @@ public abstract class ImapRequestLineReader { * Reads an argument of type "atom" from the request. */ public String atom() throws DecodingException { - return consumeWord(new ATOM_CHARValidator(), true); + return consumeWord(new AtomCharValidator(), true); } /** @@ -851,7 +851,7 @@ public abstract class ImapRequestLineReader { } } - public static class ATOM_CHARValidator implements CharacterValidator { + public static class AtomCharValidator implements CharacterValidator { public boolean isValid(char chr) { return (isCHAR(chr) && !isAtomSpecial(chr) && !isListWildcard(chr) && !isQuotedSpecial(chr)); } @@ -861,7 +861,7 @@ public abstract class ImapRequestLineReader { } } - public static class TagCharValidator extends ATOM_CHARValidator { + public static class TagCharValidator extends AtomCharValidator { public boolean isValid(char chr) { if (chr == '+') { return false; http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ImapParserFactory.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ImapParserFactory.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ImapParserFactory.java index f28ecdc..8a0287a 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ImapParserFactory.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ImapParserFactory.java @@ -35,90 +35,90 @@ import org.apache.james.imap.decode.MessagingImapCommandParser; * Command instances are created on demand, when first accessed. */ public class ImapParserFactory implements ImapCommandParserFactory { - private final Map<String, Class<?>> _imapCommands; + private final Map<String, Class<?>> imapCommands; private final StatusResponseFactory statusResponseFactory; public ImapParserFactory(StatusResponseFactory statusResponseFactory) { this.statusResponseFactory = statusResponseFactory; - _imapCommands = new HashMap<>(); + imapCommands = new HashMap<>(); // Commands valid in any state // CAPABILITY, NOOP, and LOGOUT - _imapCommands.put(ImapConstants.CAPABILITY_COMMAND_NAME, CapabilityCommandParser.class); - _imapCommands.put(ImapConstants.NOOP_COMMAND_NAME, NoopCommandParser.class); - _imapCommands.put(ImapConstants.LOGOUT_COMMAND_NAME, LogoutCommandParser.class); + imapCommands.put(ImapConstants.CAPABILITY_COMMAND_NAME, CapabilityCommandParser.class); + imapCommands.put(ImapConstants.NOOP_COMMAND_NAME, NoopCommandParser.class); + imapCommands.put(ImapConstants.LOGOUT_COMMAND_NAME, LogoutCommandParser.class); // Commands valid in NON_AUTHENTICATED state. // AUTHENTICATE and LOGIN - _imapCommands.put(ImapConstants.AUTHENTICATE_COMMAND_NAME, AuthenticateCommandParser.class); - _imapCommands.put(ImapConstants.LOGIN_COMMAND_NAME, LoginCommandParser.class); + imapCommands.put(ImapConstants.AUTHENTICATE_COMMAND_NAME, AuthenticateCommandParser.class); + imapCommands.put(ImapConstants.LOGIN_COMMAND_NAME, LoginCommandParser.class); // Commands valid in AUTHENTICATED or SELECTED state. // RFC2060: SELECT, EXAMINE, CREATE, DELETE, RENAME, SUBSCRIBE, // UNSUBSCRIBE, LIST, LSUB, STATUS, and APPEND - _imapCommands.put(ImapConstants.SELECT_COMMAND_NAME, SelectCommandParser.class); - _imapCommands.put(ImapConstants.EXAMINE_COMMAND_NAME, ExamineCommandParser.class); - _imapCommands.put(ImapConstants.CREATE_COMMAND_NAME, CreateCommandParser.class); - _imapCommands.put(ImapConstants.DELETE_COMMAND_NAME, DeleteCommandParser.class); - _imapCommands.put(ImapConstants.RENAME_COMMAND_NAME, RenameCommandParser.class); - _imapCommands.put(ImapConstants.SUBSCRIBE_COMMAND_NAME, SubscribeCommandParser.class); - _imapCommands.put(ImapConstants.UNSUBSCRIBE_COMMAND_NAME, UnsubscribeCommandParser.class); - _imapCommands.put(ImapConstants.LIST_COMMAND_NAME, ListCommandParser.class); - _imapCommands.put(ImapConstants.XLIST_COMMAND_NAME, XListCommandParser.class); - _imapCommands.put(ImapConstants.LSUB_COMMAND_NAME, LsubCommandParser.class); - _imapCommands.put(ImapConstants.STATUS_COMMAND_NAME, StatusCommandParser.class); - _imapCommands.put(ImapConstants.APPEND_COMMAND_NAME, AppendCommandParser.class); + imapCommands.put(ImapConstants.SELECT_COMMAND_NAME, SelectCommandParser.class); + imapCommands.put(ImapConstants.EXAMINE_COMMAND_NAME, ExamineCommandParser.class); + imapCommands.put(ImapConstants.CREATE_COMMAND_NAME, CreateCommandParser.class); + imapCommands.put(ImapConstants.DELETE_COMMAND_NAME, DeleteCommandParser.class); + imapCommands.put(ImapConstants.RENAME_COMMAND_NAME, RenameCommandParser.class); + imapCommands.put(ImapConstants.SUBSCRIBE_COMMAND_NAME, SubscribeCommandParser.class); + imapCommands.put(ImapConstants.UNSUBSCRIBE_COMMAND_NAME, UnsubscribeCommandParser.class); + imapCommands.put(ImapConstants.LIST_COMMAND_NAME, ListCommandParser.class); + imapCommands.put(ImapConstants.XLIST_COMMAND_NAME, XListCommandParser.class); + imapCommands.put(ImapConstants.LSUB_COMMAND_NAME, LsubCommandParser.class); + imapCommands.put(ImapConstants.STATUS_COMMAND_NAME, StatusCommandParser.class); + imapCommands.put(ImapConstants.APPEND_COMMAND_NAME, AppendCommandParser.class); // RFC2342 NAMESPACE - _imapCommands.put(ImapConstants.NAMESPACE_COMMAND_NAME, NamespaceCommandParser.class); + imapCommands.put(ImapConstants.NAMESPACE_COMMAND_NAME, NamespaceCommandParser.class); // RFC4314 GETACL, SETACL, DELETEACL, LISTRIGHTS, MYRIGHTS - _imapCommands.put(ImapConstants.GETACL_COMMAND_NAME, GetACLCommandParser.class); - _imapCommands.put(ImapConstants.SETACL_COMMAND_NAME, SetACLCommandParser.class); - _imapCommands.put(ImapConstants.DELETEACL_COMMAND_NAME, DeleteACLCommandParser.class); - _imapCommands.put(ImapConstants.LISTRIGHTS_COMMAND_NAME, ListRightsCommandParser.class); - _imapCommands.put(ImapConstants.MYRIGHTS_COMMAND_NAME, MyRightsCommandParser.class); + imapCommands.put(ImapConstants.GETACL_COMMAND_NAME, GetACLCommandParser.class); + imapCommands.put(ImapConstants.SETACL_COMMAND_NAME, SetACLCommandParser.class); + imapCommands.put(ImapConstants.DELETEACL_COMMAND_NAME, DeleteACLCommandParser.class); + imapCommands.put(ImapConstants.LISTRIGHTS_COMMAND_NAME, ListRightsCommandParser.class); + imapCommands.put(ImapConstants.MYRIGHTS_COMMAND_NAME, MyRightsCommandParser.class); // Commands only valid in SELECTED state. // CHECK, CLOSE, EXPUNGE, SEARCH, FETCH, STORE, COPY, UID and IDLE - _imapCommands.put(ImapConstants.CHECK_COMMAND_NAME, CheckCommandParser.class); - _imapCommands.put(ImapConstants.CLOSE_COMMAND_NAME, CloseCommandParser.class); - _imapCommands.put(ImapConstants.EXPUNGE_COMMAND_NAME, ExpungeCommandParser.class); - _imapCommands.put(ImapConstants.COPY_COMMAND_NAME, CopyCommandParser.class); - _imapCommands.put(ImapConstants.MOVE_COMMAND_NAME, MoveCommandParser.class); - _imapCommands.put(ImapConstants.SEARCH_COMMAND_NAME, SearchCommandParser.class); - _imapCommands.put(ImapConstants.FETCH_COMMAND_NAME, FetchCommandParser.class); - _imapCommands.put(ImapConstants.STORE_COMMAND_NAME, StoreCommandParser.class); - _imapCommands.put(ImapConstants.UID_COMMAND_NAME, UidCommandParser.class); - _imapCommands.put(ImapConstants.IDLE_COMMAND_NAME, IdleCommandParser.class); - _imapCommands.put(ImapConstants.STARTTLS, StartTLSCommandParser.class); + imapCommands.put(ImapConstants.CHECK_COMMAND_NAME, CheckCommandParser.class); + imapCommands.put(ImapConstants.CLOSE_COMMAND_NAME, CloseCommandParser.class); + imapCommands.put(ImapConstants.EXPUNGE_COMMAND_NAME, ExpungeCommandParser.class); + imapCommands.put(ImapConstants.COPY_COMMAND_NAME, CopyCommandParser.class); + imapCommands.put(ImapConstants.MOVE_COMMAND_NAME, MoveCommandParser.class); + imapCommands.put(ImapConstants.SEARCH_COMMAND_NAME, SearchCommandParser.class); + imapCommands.put(ImapConstants.FETCH_COMMAND_NAME, FetchCommandParser.class); + imapCommands.put(ImapConstants.STORE_COMMAND_NAME, StoreCommandParser.class); + imapCommands.put(ImapConstants.UID_COMMAND_NAME, UidCommandParser.class); + imapCommands.put(ImapConstants.IDLE_COMMAND_NAME, IdleCommandParser.class); + imapCommands.put(ImapConstants.STARTTLS, StartTLSCommandParser.class); // RFC3691 - _imapCommands.put(ImapConstants.UNSELECT_COMMAND_NAME, UnselectCommandParser.class); + imapCommands.put(ImapConstants.UNSELECT_COMMAND_NAME, UnselectCommandParser.class); // RFC4978 - _imapCommands.put(ImapConstants.COMPRESS_COMMAND_NAME, CompressCommandParser.class); + imapCommands.put(ImapConstants.COMPRESS_COMMAND_NAME, CompressCommandParser.class); - _imapCommands.put(ImapConstants.ENABLE_COMMAND_NAME, EnableCommandParser.class); + imapCommands.put(ImapConstants.ENABLE_COMMAND_NAME, EnableCommandParser.class); // RFC2087 // GETQUOTAROOT, GETQUOTA, SETQUOTA - _imapCommands.put(ImapConstants.GETQUOTAROOT_COMMAND_NAME, GetQuotaRootCommandParser.class); - _imapCommands.put(ImapConstants.GETQUOTA_COMMAND_NAME, GetQuotaCommandParser.class); - _imapCommands.put(ImapConstants.SETQUOTA_COMMAND_NAME, SetQuotaCommandParser.class); + imapCommands.put(ImapConstants.GETQUOTAROOT_COMMAND_NAME, GetQuotaRootCommandParser.class); + imapCommands.put(ImapConstants.GETQUOTA_COMMAND_NAME, GetQuotaCommandParser.class); + imapCommands.put(ImapConstants.SETQUOTA_COMMAND_NAME, SetQuotaCommandParser.class); //RFC5464 //SETMETADATA, GETMETADATA - _imapCommands.put(ImapConstants.SETANNOTATION_COMMAND_NAME, SetAnnotationCommandParser.class); - _imapCommands.put(ImapConstants.GETANNOTATION_COMMAND_NAME, GetAnnotationCommandParser.class); + imapCommands.put(ImapConstants.SETANNOTATION_COMMAND_NAME, SetAnnotationCommandParser.class); + imapCommands.put(ImapConstants.GETANNOTATION_COMMAND_NAME, GetAnnotationCommandParser.class); } /** * @see org.apache.james.imap.decode.ImapCommandParserFactory#getParser(java.lang.String) */ public ImapCommandParser getParser(String commandName) { - Class<?> cmdClass = _imapCommands.get(commandName.toUpperCase(Locale.US)); + Class<?> cmdClass = imapCommands.get(commandName.toUpperCase(Locale.US)); if (cmdClass == null) { return null; http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ListCommandParser.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ListCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ListCommandParser.java index 357079a..97600c0 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ListCommandParser.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/ListCommandParser.java @@ -23,7 +23,7 @@ import org.apache.james.imap.api.ImapConstants; import org.apache.james.imap.api.ImapMessage; import org.apache.james.imap.api.process.ImapSession; import org.apache.james.imap.decode.ImapRequestLineReader; -import org.apache.james.imap.decode.ImapRequestLineReader.ATOM_CHARValidator; +import org.apache.james.imap.decode.ImapRequestLineReader.AtomCharValidator; import org.apache.james.imap.message.request.ListRequest; import org.apache.james.protocols.imap.DecodingException; @@ -59,7 +59,7 @@ public class ListCommandParser extends AbstractUidCommandParser { } } - private class ListCharValidator extends ATOM_CHARValidator { + private class ListCharValidator extends AtomCharValidator { public boolean isValid(char chr) { if (ImapRequestLineReader.isListWildcard(chr)) { return true; http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java index 31475f6..7dfe286 100644 --- a/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java +++ b/protocols/imap/src/main/java/org/apache/james/imap/decode/parser/SearchCommandParser.java @@ -347,7 +347,7 @@ public class SearchCommandParser extends AbstractUidCommandParser { final int next = consumeAndCap(request); switch (next) { case 'E': - return _new(request); + return newOperator(request); case 'O': return not(session, request, charset); default: @@ -564,7 +564,7 @@ public class SearchCommandParser extends AbstractUidCommandParser { return result; } - private SearchKey _new(ImapRequestLineReader request) throws DecodingException { + private SearchKey newOperator(ImapRequestLineReader request) throws DecodingException { final SearchKey result; nextIsW(request); result = SearchKey.buildNew(); http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/protocols/imap/src/test/java/org/apache/james/imap/api/message/response/StatusResponseTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/api/message/response/StatusResponseTest.java b/protocols/imap/src/test/java/org/apache/james/imap/api/message/response/StatusResponseTest.java index ae7c6e4..81ee9f9 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/api/message/response/StatusResponseTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/api/message/response/StatusResponseTest.java @@ -38,7 +38,7 @@ public class StatusResponseTest { } @Test - public void ResponseCodeShouldBuildTheLongestEntryForMetadata() throws Exception { + public void responseCodeShouldBuildTheLongestEntryForMetadata() throws Exception { assertThat(StatusResponse.ResponseCode.longestMetadataEntry(1024).getCode()).isEqualTo("METADATA LONGENTRIES"); assertThat(StatusResponse.ResponseCode.longestMetadataEntry(1024).getNumber()).isEqualTo(1024); } http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/protocols/imap/src/test/java/org/apache/james/imap/processor/GetAnnotationProcessorTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/processor/GetAnnotationProcessorTest.java b/protocols/imap/src/test/java/org/apache/james/imap/processor/GetAnnotationProcessorTest.java index fa677c7..3838797 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/processor/GetAnnotationProcessorTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/processor/GetAnnotationProcessorTest.java @@ -86,7 +86,7 @@ public class GetAnnotationProcessorTest { private ImapSession mockImapSession; private MailboxSession mailboxSession; - private Set<MailboxAnnotationKey> KEYS; + private Set<MailboxAnnotationKey> keys; private StatusResponse statusResponse; private GetAnnotationRequest.Builder annotationRequestBuilder; @@ -105,7 +105,7 @@ public class GetAnnotationProcessorTest { mailboxSession = new MockMailboxSession("username"); inbox = MailboxPath.inbox(mailboxSession); - KEYS = ImmutableSet.of(PRIVATE_KEY); + keys = ImmutableSet.of(PRIVATE_KEY); annotationRequestBuilder = GetAnnotationRequest.builder() .tag(TAG) .command(ImapCommand.anyStateCommand("Name")) @@ -177,9 +177,9 @@ public class GetAnnotationProcessorTest { @Test public void processShouldGetAnnotationsByKeysAndReturnCompleteResponse() throws Exception { - processor.process(annotationRequestBuilder.keys(KEYS).build(), mockResponder, mockImapSession); + processor.process(annotationRequestBuilder.keys(keys).build(), mockResponder, mockImapSession); - verify(mockMailboxManager, times(1)).getAnnotationsByKeys(eq(inbox), eq(mailboxSession), eq(KEYS)); + verify(mockMailboxManager, times(1)).getAnnotationsByKeys(eq(inbox), eq(mailboxSession), eq(keys)); verify(mockStatusResponseFactory, times(1)).taggedOk(any(String.class), any(ImapCommand.class), humanTextCaptor.capture()); verify(mockResponder, times(2)).respond(captorAnnotationResponse.capture()); verifyNoMoreInteractions(mockResponder); @@ -254,11 +254,11 @@ public class GetAnnotationProcessorTest { @Test public void processShouldGetAnnotationsByOneDepthAndReturnCompleteResponseWithTruncateDataByMaxsize() throws Exception { - when(mockMailboxManager.getAnnotationsByKeysWithOneDepth(inbox, mailboxSession, KEYS)).thenReturn(ImmutableList.of(PRIVATE_ANNOTATION, PRIVATE_CHILD_ANNOTATION)); + when(mockMailboxManager.getAnnotationsByKeysWithOneDepth(inbox, mailboxSession, keys)).thenReturn(ImmutableList.of(PRIVATE_ANNOTATION, PRIVATE_CHILD_ANNOTATION)); - processor.process(annotationRequestBuilder.maxsize(Optional.of(14)).depth(Depth.ONE).keys(KEYS).build(), mockResponder, mockImapSession); + processor.process(annotationRequestBuilder.maxsize(Optional.of(14)).depth(Depth.ONE).keys(keys).build(), mockResponder, mockImapSession); - verify(mockMailboxManager, times(1)).getAnnotationsByKeysWithOneDepth(eq(inbox), eq(mailboxSession), eq(KEYS)); + verify(mockMailboxManager, times(1)).getAnnotationsByKeysWithOneDepth(eq(inbox), eq(mailboxSession), eq(keys)); verify(mockStatusResponseFactory, times(1)).taggedOk(any(String.class), any(ImapCommand.class), humanTextCaptor.capture(), @@ -290,11 +290,11 @@ public class GetAnnotationProcessorTest { @Test public void processShouldGetAnnotationsByInfinityDepthAndReturnCompleteResponseWithTruncateDataByMaxsize() throws Exception { - when(mockMailboxManager.getAnnotationsByKeysWithAllDepth(inbox, mailboxSession, KEYS)).thenReturn(ImmutableList.of(PRIVATE_ANNOTATION, PRIVATE_CHILD_ANNOTATION, PRIVATE_GRANDCHILD_ANNOTATION)); + when(mockMailboxManager.getAnnotationsByKeysWithAllDepth(inbox, mailboxSession, keys)).thenReturn(ImmutableList.of(PRIVATE_ANNOTATION, PRIVATE_CHILD_ANNOTATION, PRIVATE_GRANDCHILD_ANNOTATION)); - processor.process(annotationRequestBuilder.maxsize(Optional.of(14)).depth(Depth.INFINITY).keys(KEYS).build(), mockResponder, mockImapSession); + processor.process(annotationRequestBuilder.maxsize(Optional.of(14)).depth(Depth.INFINITY).keys(keys).build(), mockResponder, mockImapSession); - verify(mockMailboxManager, times(1)).getAnnotationsByKeysWithAllDepth(eq(inbox), eq(mailboxSession), eq(KEYS)); + verify(mockMailboxManager, times(1)).getAnnotationsByKeysWithAllDepth(eq(inbox), eq(mailboxSession), eq(keys)); verify(mockStatusResponseFactory, times(1)).taggedOk(any(String.class), any(ImapCommand.class), humanTextCaptor.capture(), @@ -309,9 +309,9 @@ public class GetAnnotationProcessorTest { @Test public void processShouldGetAnnotationsByInfinityDepthAndReturnCompleteResponse() throws Exception { - when(mockMailboxManager.getAnnotationsByKeysWithAllDepth(inbox, mailboxSession, KEYS)).thenReturn(ImmutableList.of(PRIVATE_ANNOTATION, PRIVATE_CHILD_ANNOTATION, PRIVATE_GRANDCHILD_ANNOTATION)); + when(mockMailboxManager.getAnnotationsByKeysWithAllDepth(inbox, mailboxSession, keys)).thenReturn(ImmutableList.of(PRIVATE_ANNOTATION, PRIVATE_CHILD_ANNOTATION, PRIVATE_GRANDCHILD_ANNOTATION)); - processor.process(annotationRequestBuilder.depth(Depth.INFINITY).keys(KEYS).build(), mockResponder, mockImapSession); + processor.process(annotationRequestBuilder.depth(Depth.INFINITY).keys(keys).build(), mockResponder, mockImapSession); verify(mockStatusResponseFactory, times(1)).taggedOk(any(String.class), any(ImapCommand.class), http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/protocols/imap/src/test/java/org/apache/james/imap/processor/SetAnnotationProcessorTest.java ---------------------------------------------------------------------- diff --git a/protocols/imap/src/test/java/org/apache/james/imap/processor/SetAnnotationProcessorTest.java b/protocols/imap/src/test/java/org/apache/james/imap/processor/SetAnnotationProcessorTest.java index 7a57b26..1cf4960 100644 --- a/protocols/imap/src/test/java/org/apache/james/imap/processor/SetAnnotationProcessorTest.java +++ b/protocols/imap/src/test/java/org/apache/james/imap/processor/SetAnnotationProcessorTest.java @@ -75,7 +75,7 @@ public class SetAnnotationProcessorTest { private ImapSession mockImapSession; private MailboxSession mockMailboxSession; - private List<MailboxAnnotation> MAILBOX_ANNOTATIONS; + private List<MailboxAnnotation> mailboxAnnotations; private StatusResponse okResponse; private MailboxPath inbox; @@ -93,8 +93,8 @@ public class SetAnnotationProcessorTest { mockMailboxSession = new MockMailboxSession("username"); inbox = MailboxPath.inbox(mockMailboxSession); - MAILBOX_ANNOTATIONS = ImmutableList.of(MailboxAnnotation.newInstance(new MailboxAnnotationKey("/private/key"), "anyValue")); - request = new SetAnnotationRequest(TAG, ImapCommand.anyStateCommand("Name"), ImapConstants.INBOX_NAME, MAILBOX_ANNOTATIONS); + mailboxAnnotations = ImmutableList.of(MailboxAnnotation.newInstance(new MailboxAnnotationKey("/private/key"), "anyValue")); + request = new SetAnnotationRequest(TAG, ImapCommand.anyStateCommand("Name"), ImapConstants.INBOX_NAME, mailboxAnnotations); humanTextCaptor = ArgumentCaptor.forClass(HumanReadableText.class); when(mockImapSession.getState()).thenReturn(ImapSessionState.SELECTED); @@ -121,7 +121,7 @@ public class SetAnnotationProcessorTest { @Test public void processShouldResponseNoWithNoSuchMailboxWhenManagerThrowMailboxNotFoundException() throws Exception { doThrow(MailboxNotFoundException.class).when(mockMailboxManager).updateAnnotations(eq(inbox), - eq(mockMailboxSession), eq(MAILBOX_ANNOTATIONS)); + eq(mockMailboxSession), eq(mailboxAnnotations)); processor.process(request, mockResponder, mockImapSession); @@ -133,7 +133,7 @@ public class SetAnnotationProcessorTest { @Test public void processShouldResponseNoWithGenericFailureWhenManagerThrowMailboxException() throws Exception { - doThrow(MailboxException.class).when(mockMailboxManager).updateAnnotations(eq(inbox), eq(mockMailboxSession), eq(MAILBOX_ANNOTATIONS)); + doThrow(MailboxException.class).when(mockMailboxManager).updateAnnotations(eq(inbox), eq(mockMailboxSession), eq(mailboxAnnotations)); processor.process(request, mockResponder, mockImapSession); @@ -149,7 +149,7 @@ public class SetAnnotationProcessorTest { processor.process(request, mockResponder, mockImapSession); - verify(mockMailboxManager).updateAnnotations(inbox, mockMailboxSession, MAILBOX_ANNOTATIONS); + verify(mockMailboxManager).updateAnnotations(inbox, mockMailboxSession, mailboxAnnotations); verify(mockResponder).respond(okResponse); verify(mockStatusResponseFactory, times(1)).taggedOk(any(String.class), any(ImapCommand.class), humanTextCaptor.capture()); @@ -158,7 +158,7 @@ public class SetAnnotationProcessorTest { @Test public void processShouldResponseNoWhenManagerThrowsAnnotationException() throws Exception { - doThrow(AnnotationException.class).when(mockMailboxManager).updateAnnotations(eq(inbox), eq(mockMailboxSession), eq(MAILBOX_ANNOTATIONS)); + doThrow(AnnotationException.class).when(mockMailboxManager).updateAnnotations(eq(inbox), eq(mockMailboxSession), eq(mailboxAnnotations)); processor.process(request, mockResponder, mockImapSession); http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractHookableCmdHandler.java ---------------------------------------------------------------------- diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractHookableCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractHookableCmdHandler.java index 4ec7e35..4a6cfc5 100644 --- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractHookableCmdHandler.java +++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/AbstractHookableCmdHandler.java @@ -49,11 +49,11 @@ import com.google.common.base.Throwables; * Abstract class which Handle hook-aware CommanHandler. * */ -public abstract class AbstractHookableCmdHandler<Hook extends org.apache.james.protocols.smtp.hook.Hook> implements CommandHandler<SMTPSession>, ExtensibleHandler { +public abstract class AbstractHookableCmdHandler<HookT extends org.apache.james.protocols.smtp.hook.Hook> implements CommandHandler<SMTPSession>, ExtensibleHandler { private static final Logger LOGGER = LoggerFactory.getLogger(AbstractHookableCmdHandler.class); private final MetricFactory metricFactory; - private List<Hook> hooks; + private List<HookT> hooks; private List<HookResultHook> rHooks; @Inject @@ -109,12 +109,12 @@ public abstract class AbstractHookableCmdHandler<Hook extends org.apache.james.p */ private Response processHooks(SMTPSession session, String command, String parameters) { - List<Hook> hooks = getHooks(); + List<HookT> hooks = getHooks(); if (hooks != null) { int count = hooks.size(); int i = 0; while (i < count) { - Hook rawHook = hooks.get(i); + HookT rawHook = hooks.get(i); LOGGER.debug("executing hook {}", rawHook.getClass().getName()); long start = System.currentTimeMillis(); @@ -180,7 +180,7 @@ public abstract class AbstractHookableCmdHandler<Hook extends org.apache.james.p * @param parameters the parameters * @return the HookResult, will be calculated using HookResultToSMTPResponse. */ - protected abstract HookResult callHook(Hook rawHook, SMTPSession session, String parameters); + protected abstract HookResult callHook(HookT rawHook, SMTPSession session, String parameters); /** * Convert the HookResult to SMTPResponse using default values. Should be override for using own values @@ -292,7 +292,7 @@ public abstract class AbstractHookableCmdHandler<Hook extends org.apache.james.p * * @return interface */ - protected abstract Class<Hook> getHookInterface(); + protected abstract Class<HookT> getHookInterface(); /** * @see org.apache.james.protocols.api.handler.ExtensibleHandler#wireExtensions(java.lang.Class, @@ -301,7 +301,7 @@ public abstract class AbstractHookableCmdHandler<Hook extends org.apache.james.p @SuppressWarnings("unchecked") public void wireExtensions(Class<?> interfaceName, List<?> extension) { if (getHookInterface().equals(interfaceName)) { - this.hooks = (List<Hook>) extension; + this.hooks = (List<HookT>) extension; } else if (HookResultHook.class.equals(interfaceName)) { this.rHooks = (List<HookResultHook>) extension; } @@ -313,7 +313,7 @@ public abstract class AbstractHookableCmdHandler<Hook extends org.apache.james.p * * @return list containing all hooks for the cmd handler */ - protected List<Hook> getHooks() { + protected List<HookT> getHooks() { return hooks; } http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java ---------------------------------------------------------------------- diff --git a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java index 1b54aba..a9d75f8 100644 --- a/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java +++ b/protocols/smtp/src/main/java/org/apache/james/protocols/smtp/core/esmtp/AuthCmdHandler.java @@ -263,7 +263,7 @@ public class AuthCmdHandler If both steps succeed, the user is logged in. */ StringTokenizer authTokenizer = new StringTokenizer(userpass, "\0"); - String authorize_id = authTokenizer.nextToken(); // Authorization Identity + String authorizeId = authTokenizer.nextToken(); // Authorization Identity user = authTokenizer.nextToken(); // Authentication Identity try { pass = authTokenizer.nextToken(); // Password @@ -284,7 +284,7 @@ public class AuthCmdHandler // caught. So we need to move the user to the // password, and the authorize_id to the user. pass = user; - user = authorize_id; + user = authorizeId; } authTokenizer = null; http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/server/container/util/src/main/java/org/apache/james/util/retry/DoublingRetrySchedule.java ---------------------------------------------------------------------- diff --git a/server/container/util/src/main/java/org/apache/james/util/retry/DoublingRetrySchedule.java b/server/container/util/src/main/java/org/apache/james/util/retry/DoublingRetrySchedule.java index d1500ef..08465d7 100644 --- a/server/container/util/src/main/java/org/apache/james/util/retry/DoublingRetrySchedule.java +++ b/server/container/util/src/main/java/org/apache/james/util/retry/DoublingRetrySchedule.java @@ -36,9 +36,9 @@ import org.apache.james.util.retry.api.RetrySchedule; */ public class DoublingRetrySchedule implements RetrySchedule { - private long _startInterval = 0; - private long _maxInterval = 0; - private long _multiplier = 1; + private long startInterval = 0; + private long maxInterval = 0; + private long multiplier = 1; /** * Creates a new instance of DoublingRetrySchedule. @@ -71,23 +71,23 @@ public class DoublingRetrySchedule implements RetrySchedule { */ public DoublingRetrySchedule(long startInterval, long maxInterval, int multiplier) { this(); - _startInterval = Math.max(0, startInterval); - _maxInterval = Math.max(0, maxInterval); - _multiplier = Math.max(1, multiplier); + this.startInterval = Math.max(0, startInterval); + this.maxInterval = Math.max(0, maxInterval); + this.multiplier = Math.max(1, multiplier); } /** */ @Override public long getInterval(int index) { - if (_startInterval > 0) { - return getInterval(index, _startInterval); + if (startInterval > 0) { + return getInterval(index, startInterval); } return index == 0 ? 0 : getInterval(index - 1, 1); } private long getInterval(int index, long startInterval) { - return _multiplier * Math.min((long) (startInterval * Math.pow(2, index)), _maxInterval); + return multiplier * Math.min((long) (startInterval * Math.pow(2, index)), maxInterval); } /** @@ -96,8 +96,8 @@ public class DoublingRetrySchedule implements RetrySchedule { @Override public String toString() { StringBuilder builder = new StringBuilder(); - builder.append("DoublingRetrySchedule [startInterval=").append(_startInterval).append( - ", maxInterval=").append(_maxInterval).append(", multiplier=").append(_multiplier).append("]"); + builder.append("DoublingRetrySchedule [startInterval=").append(startInterval).append( + ", maxInterval=").append(maxInterval).append(", multiplier=").append(multiplier).append("]"); return builder.toString(); } http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/server/container/util/src/main/java/org/apache/james/util/retry/ExceptionRetryHandler.java ---------------------------------------------------------------------- diff --git a/server/container/util/src/main/java/org/apache/james/util/retry/ExceptionRetryHandler.java b/server/container/util/src/main/java/org/apache/james/util/retry/ExceptionRetryHandler.java index e93e68d..dcc46c0 100644 --- a/server/container/util/src/main/java/org/apache/james/util/retry/ExceptionRetryHandler.java +++ b/server/container/util/src/main/java/org/apache/james/util/retry/ExceptionRetryHandler.java @@ -39,11 +39,12 @@ import org.apache.james.util.retry.api.RetrySchedule; * @see org.apache.james.util.retry.naming.RetryingContext */ public abstract class ExceptionRetryHandler implements RetryHandler { - private Class<?>[] _exceptionClasses = null; + + private Class<?>[] exceptionClasses = null; - private ExceptionRetryingProxy _proxy = null; - private RetrySchedule _schedule; - private int _maxRetries = 0; + private ExceptionRetryingProxy proxy = null; + private RetrySchedule schedule; + private int maxRetries = 0; /** * Creates a new instance of ExceptionRetryHandler. @@ -63,10 +64,10 @@ public abstract class ExceptionRetryHandler implements RetryHandler { */ public ExceptionRetryHandler(Class<?>[] exceptionClasses, ExceptionRetryingProxy proxy, RetrySchedule schedule, int maxRetries) { this(); - _exceptionClasses = exceptionClasses; - _proxy = proxy; - _schedule = schedule; - _maxRetries = maxRetries; + this.exceptionClasses = exceptionClasses; + this.proxy = proxy; + this.schedule = schedule; + this.maxRetries = maxRetries; } /** @@ -78,13 +79,13 @@ public abstract class ExceptionRetryHandler implements RetryHandler { while (!success) { try { if (retryCount > 0) { - _proxy.resetDelegate(); + proxy.resetDelegate(); } result = operation(); success = true; } catch (Exception ex) { - if (retryCount >= _maxRetries || !isRetryable(ex)) { + if (retryCount >= maxRetries || !isRetryable(ex)) { throw ex; } postFailure(ex, retryCount); @@ -93,7 +94,7 @@ public abstract class ExceptionRetryHandler implements RetryHandler { } catch (InterruptedException ex1) { // no-op } - retryCount = _maxRetries < 0 ? _maxRetries + retryCount = maxRetries < 0 ? maxRetries : retryCount + 1; } } @@ -108,8 +109,8 @@ public abstract class ExceptionRetryHandler implements RetryHandler { */ private boolean isRetryable(Throwable ex) { boolean isRetryable = false; - for (int i = 0; !isRetryable && i < _exceptionClasses.length; i++) { - isRetryable = _exceptionClasses[i].isInstance(ex); + for (int i = 0; !isRetryable && i < exceptionClasses.length; i++) { + isRetryable = exceptionClasses[i].isInstance(ex); } return isRetryable; } @@ -128,6 +129,6 @@ public abstract class ExceptionRetryHandler implements RetryHandler { * @return the retryInterval */ public long getRetryInterval(int retryCount) { - return _schedule.getInterval(retryCount); + return schedule.getInterval(retryCount); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/server/container/util/src/main/java/org/apache/james/util/retry/naming/RetryingContext.java ---------------------------------------------------------------------- diff --git a/server/container/util/src/main/java/org/apache/james/util/retry/naming/RetryingContext.java b/server/container/util/src/main/java/org/apache/james/util/retry/naming/RetryingContext.java index a022520..fd4cd35 100644 --- a/server/container/util/src/main/java/org/apache/james/util/retry/naming/RetryingContext.java +++ b/server/container/util/src/main/java/org/apache/james/util/retry/naming/RetryingContext.java @@ -51,9 +51,9 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy ServiceUnavailableException.class, NoInitialContextException.class }; - private Context _delegate = null; - private RetrySchedule _schedule = null; - private int _maxRetries = 0; + private Context delegate = null; + private RetrySchedule schedule = null; + private int maxRetries = 0; /** * Creates a new instance of RetryingContext. @@ -90,10 +90,10 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy public RetryingContext(Class<?>[] exceptionClasses, RetrySchedule schedule, int maxRetries) throws NamingException { this(); - _schedule = schedule; - _maxRetries = maxRetries; - _delegate = (Context) new LoggingRetryHandler(exceptionClasses, this, - _schedule, _maxRetries) { + this.schedule = schedule; + this.maxRetries = maxRetries; + this.delegate = (Context) new LoggingRetryHandler(exceptionClasses, this, + this.schedule, this.maxRetries) { @Override public Object operation() throws Exception { @@ -109,7 +109,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy @Override public Object addToEnvironment(final String propName, final Object propVal) throws NamingException { - return new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + return new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -124,7 +124,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public void bind(final Name name, final Object obj) throws NamingException { - new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -140,7 +140,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public void bind(final String name, final Object obj) throws NamingException { - new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -156,7 +156,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public void close() throws NamingException { - new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -173,7 +173,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public Name composeName(final Name name, final Name prefix) throws NamingException { - return (Name) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + return (Name) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -188,7 +188,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public String composeName(final String name, final String prefix) throws NamingException { - return (String) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + return (String) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -234,7 +234,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public void destroySubcontext(final Name name) throws NamingException { - new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -250,7 +250,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public void destroySubcontext(final String name) throws NamingException { - new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -267,7 +267,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy @Override public Hashtable<?, ?> getEnvironment() throws NamingException { return (Hashtable<?, ?>) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, - _schedule, _maxRetries) { + schedule, maxRetries) { @Override public Object operation() throws NamingException { @@ -281,7 +281,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public String getNameInNamespace() throws NamingException { - return (String) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + return (String) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -296,7 +296,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public NameParser getNameParser(final Name name) throws NamingException { - return (NameParser) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + return (NameParser) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -311,7 +311,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public NameParser getNameParser(final String name) throws NamingException { - return (NameParser) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + return (NameParser) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -328,7 +328,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy @Override public NamingEnumeration<NameClassPair> list(final Name name) throws NamingException { return (NamingEnumeration<NameClassPair>) new LoggingRetryHandler( - DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries) { + DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries) { @Override public Object operation() throws NamingException { @@ -344,7 +344,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy @Override public NamingEnumeration<NameClassPair> list(final String name) throws NamingException { return (NamingEnumeration<NameClassPair>) new LoggingRetryHandler( - DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries) { + DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries) { @Override public Object operation() throws NamingException { @@ -360,7 +360,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy @Override public NamingEnumeration<Binding> listBindings(final Name name) throws NamingException { return (NamingEnumeration<Binding>) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, - this, _schedule, _maxRetries) { + this, schedule, maxRetries) { @Override public Object operation() throws NamingException { @@ -376,7 +376,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy @Override public NamingEnumeration<Binding> listBindings(final String name) throws NamingException { return (NamingEnumeration<Binding>) new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, - this, _schedule, _maxRetries) { + this, schedule, maxRetries) { @Override public Object operation() throws NamingException { @@ -390,7 +390,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public Object lookup(final Name name) throws NamingException { - return new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + return new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -405,7 +405,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public Object lookup(final String name) throws NamingException { - return new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + return new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -420,7 +420,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public Object lookupLink(final Name name) throws NamingException { - return new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + return new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -435,7 +435,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public Object lookupLink(final String name) throws NamingException { - return new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + return new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -450,7 +450,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public void rebind(final Name name, final Object obj) throws NamingException { - new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -466,7 +466,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public void rebind(final String name, final Object obj) throws NamingException { - new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -482,7 +482,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public Object removeFromEnvironment(final String propName) throws NamingException { - return new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + return new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -497,7 +497,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public void rename(final Name oldName, final Name newName) throws NamingException { - new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -513,7 +513,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public void rename(final String oldName, final String newName) throws NamingException { - new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -529,7 +529,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public void unbind(final Name name) throws NamingException { - new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries + new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries ) { @Override @@ -545,7 +545,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public void unbind(final String name) throws NamingException { - new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, _schedule, _maxRetries) { + new LoggingRetryHandler(DEFAULT_EXCEPTION_CLASSES, this, schedule, maxRetries) { @Override public Object operation() throws NamingException { @@ -558,7 +558,7 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy /** */ public Context getDelegate() { - return _delegate; + return delegate; } @@ -566,24 +566,24 @@ public abstract class RetryingContext implements Context, ExceptionRetryingProxy */ @Override public void resetDelegate() throws Exception { - if (null != _delegate) { - _delegate.close(); + if (null != delegate) { + delegate.close(); } - _delegate = (Context)newDelegate(); + delegate = (Context)newDelegate(); } /** * @return the schedule */ public RetrySchedule getSchedule() { - return _schedule; + return schedule; } /** * @return the maxRetries */ public int getMaxRetries() { - return _maxRetries; + return maxRetries; } } http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/server/container/util/src/main/java/org/apache/james/util/sql/SqlResources.java ---------------------------------------------------------------------- diff --git a/server/container/util/src/main/java/org/apache/james/util/sql/SqlResources.java b/server/container/util/src/main/java/org/apache/james/util/sql/SqlResources.java index 60faeee..acf8a90 100644 --- a/server/container/util/src/main/java/org/apache/james/util/sql/SqlResources.java +++ b/server/container/util/src/main/java/org/apache/james/util/sql/SqlResources.java @@ -46,10 +46,10 @@ import org.w3c.dom.NodeList; */ public class SqlResources { /** A map of statement types to SQL statements */ - private final Map<String, String> m_sql = new HashMap<>(); + private final Map<String, String> sql = new HashMap<>(); /** A map of engine specific options */ - private final Map<String, String> m_dbOptions = new HashMap<>(); + private final Map<String, String> dbOptions = new HashMap<>(); /** A set of all used String values */ private static final Map<String, String> stringTable = java.util.Collections.synchronizedMap(new HashMap<String, String>()); @@ -143,10 +143,10 @@ public class SqlResources { Element dbOptionsElement = (Element) (sqlDoc.getElementsByTagName("dbOptions").item(0)); if (dbOptionsElement != null) { // First populate the map with default values - populateDbOptions("", dbOptionsElement, m_dbOptions); + populateDbOptions("", dbOptionsElement, dbOptions); // Now update the map with specific product values if (dbProduct != null) { - populateDbOptions(dbProduct, dbOptionsElement, m_dbOptions); + populateDbOptions(dbProduct, dbOptionsElement, dbOptions); } } @@ -244,8 +244,8 @@ public class SqlResources { } // Copy in default strings, then overwrite product-specific ones. - m_sql.putAll(defaultSqlStatements); - m_sql.putAll(dbProductSqlStatements); + sql.putAll(defaultSqlStatements); + sql.putAll(dbProductSqlStatements); } /** @@ -322,18 +322,18 @@ public class SqlResources { * @return the substituted string */ private String substituteSubString(String input, String find, String replace) { - int find_length = find.length(); - int replace_length = replace.length(); + int findLength = find.length(); + int replaceLength = replace.length(); StringBuilder output = new StringBuilder(input); int index = input.indexOf(find); int outputOffset = 0; while (index > -1) { - output.replace(index + outputOffset, index + outputOffset + find_length, replace); - outputOffset = outputOffset + (replace_length - find_length); + output.replace(index + outputOffset, index + outputOffset + findLength, replace); + outputOffset = outputOffset + (replaceLength - findLength); - index = input.indexOf(find, index + find_length); + index = input.indexOf(find, index + findLength); } return output.toString(); @@ -348,7 +348,7 @@ public class SqlResources { * @return the requested resource */ public String getSqlString(String name) { - return m_sql.get(name); + return sql.get(name); } /** @@ -382,7 +382,7 @@ public class SqlResources { * @return the requested dbOption value */ public String getDbOption(String name) { - return m_dbOptions.get(name); + return dbOptions.get(name); } } http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/server/container/util/src/test/java/org/apache/james/util/retry/ExceptionRetryHandlerTest.java ---------------------------------------------------------------------- diff --git a/server/container/util/src/test/java/org/apache/james/util/retry/ExceptionRetryHandlerTest.java b/server/container/util/src/test/java/org/apache/james/util/retry/ExceptionRetryHandlerTest.java index 83d8609..f6335bb 100644 --- a/server/container/util/src/test/java/org/apache/james/util/retry/ExceptionRetryHandlerTest.java +++ b/server/container/util/src/test/java/org/apache/james/util/retry/ExceptionRetryHandlerTest.java @@ -38,18 +38,18 @@ import org.junit.Test; */ public class ExceptionRetryHandlerTest { - private Class<?>[] _exceptionClasses = null; - private ExceptionRetryingProxy _proxy = null; - private RetrySchedule _schedule = null; + private Class<?>[] exceptionClasses = null; + private ExceptionRetryingProxy proxy = null; + private RetrySchedule schedule = null; /** * @see junit.framework.TestCase#setUp() */ @Before public void setUp() throws Exception { - _exceptionClasses = new Class<?>[]{Exception.class}; - _proxy = new TestRetryingProxy(); - _schedule = new TestRetrySchedule(); + exceptionClasses = new Class<?>[]{Exception.class}; + proxy = new TestRetryingProxy(); + schedule = new TestRetrySchedule(); } private class TestRetryingProxy implements ExceptionRetryingProxy { @@ -91,7 +91,7 @@ public class ExceptionRetryHandlerTest { @Test public final void testExceptionRetryHandler() { assertTrue(RetryHandler.class.isAssignableFrom(new ExceptionRetryHandler( - _exceptionClasses, _proxy, _schedule, 0) { + exceptionClasses, proxy, schedule, 0) { @Override public Object operation() throws Exception { @@ -107,7 +107,7 @@ public class ExceptionRetryHandlerTest { @Test public final void testPerform() throws Exception { Object result = new ExceptionRetryHandler( - _exceptionClasses, _proxy, _schedule, 0) { + exceptionClasses, proxy, schedule, 0) { @Override public Object operation() throws Exception { @@ -118,7 +118,7 @@ public class ExceptionRetryHandlerTest { try { new ExceptionRetryHandler( - _exceptionClasses, _proxy, _schedule, 0) { + exceptionClasses, proxy, schedule, 0) { @Override public Object operation() throws Exception { @@ -138,7 +138,7 @@ public class ExceptionRetryHandlerTest { public final void testPostFailure() { final List<Exception> results = new ArrayList<>(); RetryHandler handler = new ExceptionRetryHandler( - _exceptionClasses, _proxy, _schedule, 7) { + exceptionClasses, proxy, schedule, 7) { @Override public void postFailure(Exception ex, int retryCount) { @@ -166,7 +166,7 @@ public class ExceptionRetryHandlerTest { @Test public final void testOperation() throws Exception { RetryHandler handler = new ExceptionRetryHandler( - _exceptionClasses, _proxy, _schedule, 0) { + exceptionClasses, proxy, schedule, 0) { @Override public Object operation() throws Exception { @@ -182,7 +182,7 @@ public class ExceptionRetryHandlerTest { @Test public final void testGetRetryInterval() { ExceptionRetryHandler handler = new ExceptionRetryHandler( - _exceptionClasses, _proxy, _schedule, 0) { + exceptionClasses, proxy, schedule, 0) { @Override public Object operation() throws Exception { http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/server/container/util/src/test/java/org/apache/james/util/retry/naming/NamingExceptionRetryHandlerTest.java ---------------------------------------------------------------------- diff --git a/server/container/util/src/test/java/org/apache/james/util/retry/naming/NamingExceptionRetryHandlerTest.java b/server/container/util/src/test/java/org/apache/james/util/retry/naming/NamingExceptionRetryHandlerTest.java index 146a0eb..351d494 100644 --- a/server/container/util/src/test/java/org/apache/james/util/retry/naming/NamingExceptionRetryHandlerTest.java +++ b/server/container/util/src/test/java/org/apache/james/util/retry/naming/NamingExceptionRetryHandlerTest.java @@ -36,18 +36,18 @@ import org.junit.Test; */ public class NamingExceptionRetryHandlerTest { - private Class<?>[] _exceptionClasses = null; - private ExceptionRetryingProxy _proxy = null; - private RetrySchedule _schedule = null; + private Class<?>[] exceptionClasses = null; + private ExceptionRetryingProxy proxy = null; + private RetrySchedule schedule = null; /** * @see junit.framework.TestCase#setUp() */ @Before public void setUp() throws Exception { - _exceptionClasses = new Class<?>[]{NamingException.class}; - _proxy = new TestRetryingProxy(); - _schedule = new TestRetrySchedule(); + exceptionClasses = new Class<?>[]{NamingException.class}; + proxy = new TestRetryingProxy(); + schedule = new TestRetrySchedule(); } private class TestRetryingProxy implements ExceptionRetryingProxy { @@ -89,7 +89,7 @@ public class NamingExceptionRetryHandlerTest { @Test public final void testExceptionRetryHandler() { assertTrue(RetryHandler.class.isAssignableFrom(new NamingExceptionRetryHandler( - _exceptionClasses, _proxy, _schedule, 0) { + exceptionClasses, proxy, schedule, 0) { @Override public Object operation() throws Exception { @@ -105,7 +105,7 @@ public class NamingExceptionRetryHandlerTest { @Test public final void testPerform() throws NamingException { Object result = new NamingExceptionRetryHandler( - _exceptionClasses, _proxy, _schedule, 0) { + exceptionClasses, proxy, schedule, 0) { @Override public Object operation() throws NamingException { @@ -116,7 +116,7 @@ public class NamingExceptionRetryHandlerTest { try { new NamingExceptionRetryHandler( - _exceptionClasses, _proxy, _schedule, 0) { + exceptionClasses, proxy, schedule, 0) { @Override public Object operation() throws Exception { http://git-wip-us.apache.org/repos/asf/james-project/blob/52c18ef6/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java ---------------------------------------------------------------------- diff --git a/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java b/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java index e132822..3487a3c 100644 --- a/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java +++ b/server/data/data-jdbc/src/main/java/org/apache/james/mailrepository/jdbc/JDBCMailRepository.java @@ -522,7 +522,7 @@ public class JDBCMailRepository extends AbstractMailRepository { try { String insertMessageSQL = sqlQueries.getSqlString("insertMessageSQL", true); insertMessage = conn.prepareStatement(insertMessageSQL); - int number_of_parameters = insertMessage.getParameterMetaData().getParameterCount(); + int numberOfParameters = insertMessage.getParameterMetaData().getParameterCount(); insertMessage.setString(1, mc.getName()); insertMessage.setString(2, repositoryName); insertMessage.setString(3, mc.getState()); @@ -547,7 +547,7 @@ public class JDBCMailRepository extends AbstractMailRepository { insertMessage.setBinaryStream(10, is, (int) is.getSize()); // Store attributes - if (number_of_parameters > 10) { + if (numberOfParameters > 10) { ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); try { @@ -634,17 +634,17 @@ public class JDBCMailRepository extends AbstractMailRepository { if (rsMessageAttr.next()) { try { - byte[] serialized_attr; + byte[] serializedAttr; String getAttributesOption = sqlQueries.getDbOption("getAttributes"); if (getAttributesOption != null && (getAttributesOption.equalsIgnoreCase("useBlob") || getAttributesOption.equalsIgnoreCase("useBinaryStream"))) { Blob b = rsMessageAttr.getBlob(1); - serialized_attr = b.getBytes(1, (int) b.length()); + serializedAttr = b.getBytes(1, (int) b.length()); } else { - serialized_attr = rsMessageAttr.getBytes(1); + serializedAttr = rsMessageAttr.getBytes(1); } // this check is for better backwards compatibility - if (serialized_attr != null) { - ByteArrayInputStream bais = new ByteArrayInputStream(serialized_attr); + if (serializedAttr != null) { + ByteArrayInputStream bais = new ByteArrayInputStream(serializedAttr); ObjectInputStream ois = new ObjectInputStream(bais); attributes = (HashMap<String, Object>) ois.readObject(); ois.close(); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
