This is an automated email from the ASF dual-hosted git repository.

rcordier pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/james-project.git

commit 2397b99a0f71aecce23ee557a76e41e1b78718c5
Author: RĂ©mi KOWALSKI <rkowal...@linagora.com>
AuthorDate: Thu Dec 5 15:54:02 2019 +0100

    [refactoring] clean up array copy
---
 .../netty/AbstractSSLAwareChannelPipelineFactory.java         | 11 +++--------
 1 file changed, 3 insertions(+), 8 deletions(-)

diff --git 
a/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java
 
b/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java
index 5dee691..4631f28 100644
--- 
a/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java
+++ 
b/protocols/netty/src/main/java/org/apache/james/protocols/netty/AbstractSSLAwareChannelPipelineFactory.java
@@ -21,6 +21,7 @@ package org.apache.james.protocols.netty;
 import javax.net.ssl.SSLContext;
 import javax.net.ssl.SSLEngine;
 
+import org.apache.commons.lang3.ArrayUtils;
 import org.jboss.netty.channel.ChannelPipeline;
 import org.jboss.netty.channel.group.ChannelGroup;
 import org.jboss.netty.handler.execution.ExecutionHandler;
@@ -46,17 +47,11 @@ public abstract class 
AbstractSSLAwareChannelPipelineFactory extends AbstractCha
             ChannelHandlerFactory frameHandlerFactory, HashedWheelTimer 
hashedWheelTimer) {
         this(timeout, maxConnections, maxConnectsPerIp, group, eHandler, 
frameHandlerFactory, hashedWheelTimer);
         
-        // We need to copy the String array becuase of possible security 
issues.
+        // We need to copy the String array because of possible security 
issues.
         // See https://issues.apache.org/jira/browse/PROTOCOLS-18
-        if (enabledCipherSuites != null) {
-            this.enabledCipherSuites = new String[enabledCipherSuites.length];
-            for (int i = 0; i < enabledCipherSuites.length; i++) {
-                this.enabledCipherSuites[i] = new 
String(enabledCipherSuites[i]);
-            }
-        }
+        this.enabledCipherSuites = ArrayUtils.clone(enabledCipherSuites);
     }
 
-    
     @Override
     public ChannelPipeline getPipeline() throws Exception {
         ChannelPipeline pipeline =  super.getPipeline();


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

Reply via email to