jeantil commented on a change in pull request #461:
URL: https://github.com/apache/james-project/pull/461#discussion_r641519732
##########
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:
maybe extract
```
Splitter.on(",")
.omitEmptyStrings()
.trimResults()
```
to a local constant ? I don't think we need to build a new instance for
every call (not that it matters much since this should only run once per
process)
##########
File path:
server/container/guice/protocols/webadmin/src/main/java/org/apache/james/modules/server/WebAdminServerModule.java
##########
@@ -138,6 +138,16 @@ public WebAdminConfiguration
provideWebAdminConfiguration(FileSystem fileSystem,
}
}
+ @VisibleForTesting
+ ImmutableList<String> additionalRoutes(Configuration configurationFile) {
+ String rawString = configurationFile.getString("extensions.routes",
"");
+
+ return ImmutableList.copyOf(Splitter.on(',')
Review comment:
same as above: extract to local constant (note that I don't think
mutualizing the two would be beneficial)
--
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]