chibenwa commented on a change in pull request #461:
URL: https://github.com/apache/james-project/pull/461#discussion_r641661721
##########
File path:
server/container/guice/guice-utils/src/main/java/org/apache/james/utils/ExtensionConfiguration.java
##########
@@ -19,24 +19,25 @@
package org.apache.james.utils;
-import java.util.Arrays;
import java.util.List;
-import java.util.Optional;
import org.apache.commons.configuration2.Configuration;
import com.github.steveash.guavate.Guavate;
+import com.google.common.base.Splitter;
import com.google.common.collect.ImmutableList;
public class ExtensionConfiguration {
public static final ExtensionConfiguration DEFAULT = new
ExtensionConfiguration(ImmutableList.of());
public static ExtensionConfiguration from(Configuration configuration) {
- List<String> list =
Optional.ofNullable(configuration.getStringArray("guice.extension.module"))
- .map(Arrays::asList)
- .orElse(ImmutableList.of());
+ String rawString = configuration.getString("guice.extension.module",
"");
- return new ExtensionConfiguration(list.stream()
+ return new ExtensionConfiguration(Splitter.on(",")
+ .omitEmptyStrings()
+ .trimResults()
Review comment:
I had a look, Joiner and Splitter are thread safe, thus can be safely
shared as constants
The point is we never did it in the source code. I think it could be nice to
conduct a global refactoring regarding this.
I guess the best way to move is thus fix these usage here and open another
PR for doing this refctoring.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]