geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From johndam...@apache.org
Subject svn commit: r1800719 - in /geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config: DefaultConfigBuilder.java cdi/ConfigExtension.java cdi/ConfigInjectionBean.java
Date Tue, 04 Jul 2017 00:31:24 GMT
Author: johndament
Date: Tue Jul  4 00:31:24 2017
New Revision: 1800719

URL: http://svn.apache.org/viewvc?rev=1800719&view=rev
Log:
GERONIMO-6566 TCK Check - Don't leverage optional property value when defaultValue is default.

TCK Assertions: CDIPlainInjectionTest#can_inject_simple_values_when_defined

Modified:
    geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/DefaultConfigBuilder.java
    geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java
    geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigInjectionBean.java

Modified: geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/DefaultConfigBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/DefaultConfigBuilder.java?rev=1800719&r1=1800718&r2=1800719&view=diff
==============================================================================
--- geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/DefaultConfigBuilder.java
(original)
+++ geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/DefaultConfigBuilder.java
Tue Jul  4 00:31:24 2017
@@ -103,18 +103,18 @@ public class DefaultConfigBuilder implem
         if (!ignoreDiscoveredSources) {
             // load all ConfigSource services
             ServiceLoader<ConfigSource> configSourceLoader = ServiceLoader.load(ConfigSource.class,
forClassLoader);
-            configSourceLoader.forEach(configSource -> configSources.add(configSource));
+            configSourceLoader.forEach(configSources::add);
 
             // load all ConfigSources from ConfigSourceProviders
             ServiceLoader<ConfigSourceProvider> configSourceProviderLoader = ServiceLoader.load(ConfigSourceProvider.class,
forClassLoader);
             configSourceProviderLoader.forEach(configSourceProvider ->
                     configSourceProvider.getConfigSources(forClassLoader)
-                            .forEach(configSource -> configSources.add(configSource)));
+                            .forEach(configSources::add));
         }
 
         if (!ignoreDiscoveredConverters) {
             ServiceLoader<Converter> converterLoader = ServiceLoader.load(Converter.class,
forClassLoader);
-            converterLoader.forEach(converter -> converters.add(converter));
+            converterLoader.forEach(converters::add);
         }
 
         ConfigImpl config = new ConfigImpl();

Modified: geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java
URL: http://svn.apache.org/viewvc/geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java?rev=1800719&r1=1800718&r2=1800719&view=diff
==============================================================================
--- geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java
(original)
+++ geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigExtension.java
Tue Jul  4 00:31:24 2017
@@ -81,8 +81,7 @@ public class ConfigExtension implements
                 // a direct injection of a ConfigProperty
                 // that means a Converter must exist.
                 String key = ConfigInjectionBean.getConfigKey(injectionPoint, configProperty);
-                if ((configProperty.defaultValue() == null || configProperty.defaultValue().length()
== 0
-                        || configProperty.defaultValue().equals(DEFAULT_UNCONFIGURED_VALUE))
+                if ((isDefaultUnset(configProperty.defaultValue()))
                         && !config.getOptionalValue(key, (Class) type).isPresent())
{
                     deploymentProblems.add("No Config Value exists for " + key);
                 }
@@ -101,4 +100,7 @@ public class ConfigExtension implements
     }
 
 
+    static boolean isDefaultUnset(String defaultValue) {
+        return defaultValue == null || defaultValue.length() == 0 || defaultValue.equals(DEFAULT_UNCONFIGURED_VALUE);
+    }
 }

Modified: geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigInjectionBean.java
URL: http://svn.apache.org/viewvc/geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigInjectionBean.java?rev=1800719&r1=1800718&r2=1800719&view=diff
==============================================================================
--- geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigInjectionBean.java
(original)
+++ geronimo/components/config/trunk/impl/src/main/java/org/apache/geronimo/config/cdi/ConfigInjectionBean.java
Tue Jul  4 00:31:24 2017
@@ -130,7 +130,7 @@ public class ConfigInjectionBean<T> impl
         }
         else {
             Class clazz = (Class) annotated.getBaseType();
-            if (defaultValue == null || defaultValue.length() == 0) {
+            if (ConfigExtension.isDefaultUnset(defaultValue)) {
                 return (T) getConfig().getValue(key, clazz);
             }
             else {



Mime
View raw message