james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From btell...@apache.org
Subject [2/5] james-project git commit: JAMES-1954 Solve IntelliJ warning in CommandDispatcher
Date Mon, 13 Mar 2017 11:33:23 GMT
JAMES-1954 Solve IntelliJ warning in CommandDispatcher


Project: http://git-wip-us.apache.org/repos/asf/james-project/repo
Commit: http://git-wip-us.apache.org/repos/asf/james-project/commit/381f2d76
Tree: http://git-wip-us.apache.org/repos/asf/james-project/tree/381f2d76
Diff: http://git-wip-us.apache.org/repos/asf/james-project/diff/381f2d76

Branch: refs/heads/master
Commit: 381f2d76fc7b6d413cbbd66f2611c2526d34e19a
Parents: 76f0f5b
Author: benwa <btellier@linagora.com>
Authored: Mon Mar 6 14:36:22 2017 +0700
Committer: benwa <btellier@linagora.com>
Committed: Mon Mar 13 18:32:07 2017 +0700

----------------------------------------------------------------------
 .../protocols/api/handler/CommandDispatcher.java | 19 +++++++------------
 1 file changed, 7 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/james-project/blob/381f2d76/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 2a29dfe..3fd4692 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
@@ -179,17 +179,15 @@ public class CommandDispatcher<Session extends ProtocolSession>
implements Exten
         }
         List<CommandHandler<Session>> commandHandlers = getCommandHandlers(request.getCommand(),
session);
         // fetch the command handlers registered to the command
-        Iterator<CommandHandler<Session>> handlers = commandHandlers.iterator();
-        
-        while (handlers.hasNext()) {
+
+        for (CommandHandler<Session> commandHandler : commandHandlers) {
             final long start = System.currentTimeMillis();
-            CommandHandler<Session> cHandler = handlers.next();
-            Response response = cHandler.onCommand(session, request);
+            Response response = commandHandler.onCommand(session, request);
             if (response != null) {
                 long executionTime = System.currentTimeMillis() - start;
 
                 // now process the result handlers
-                response = executeResultHandlers(session, response, executionTime, cHandler,
rHandlers.iterator());
+                response = executeResultHandlers(session, response, executionTime, commandHandler,
rHandlers.iterator());
                 if (response != null) {
                     return response;
                 }
@@ -223,7 +221,7 @@ public class CommandDispatcher<Session extends ProtocolSession>
implements Exten
                 // just return the new FutureResponse which will get notified once its ready
                 return futureResponse;
             }  else {
-                response = resultHandlers.next().onResponse(session, response, executionTime,
(CommandHandler<Session>) cHandler);
+                response = resultHandlers.next().onResponse(session, response, executionTime,
cHandler);
                 
                 // call the next ResultHandler 
                 return executeResultHandlers(session, response, executionTime, cHandler,
resultHandlers);
@@ -233,14 +231,11 @@ public class CommandDispatcher<Session extends ProtocolSession>
implements Exten
     }
     /**
      * Parse the line into a {@link Request}
-     * 
-     * @param session
-     * @param line
-     * @return request
+     *
      * @throws Exception
      */
     protected Request parseRequest(Session session, ByteBuffer buffer) throws Exception {
-        String curCommandName = null;
+        String curCommandName;
         String curCommandArgument = null;
         byte[] line;
         if (buffer.hasArray()) {


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message