You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by rc...@apache.org on 2019/12/06 09:06:26 UTC

[james-project] 01/02: [refactoring] clean up array copy

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 <rk...@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-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org