tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pottlin...@apache.org
Subject incubator-tamaya-sandbox git commit: TAMAYA-273 Fix infinite recursion in metamodel
Date Fri, 20 Jul 2018 21:22:41 GMT
Repository: incubator-tamaya-sandbox
Updated Branches:
  refs/heads/master 96fc9d5cb -> 681cb1e56


TAMAYA-273 Fix infinite recursion in metamodel

With the lazily loaded configuration in metamodel, the logic is
susceptible to an infinite recursion if any part of the configuration
setting does a getConfiguration in the middle.  The spi delegation logic
added getConfiguration logging to all static calls as part of
5a130523ab7d3a9d33091b13f62db90ddb8fba5c in incubator-tamaya, which
caused this module to infinitely recurse and fail. This commit breaks
the chain of possible recursion.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/commit/681cb1e5
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/tree/681cb1e5
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/diff/681cb1e5

Branch: refs/heads/master
Commit: 681cb1e5668b0a581528bf85e09d1ab6f54a30f9
Parents: 96fc9d5
Author: William Lieurance <william.lieurance@namikoda.com>
Authored: Wed Jul 11 02:37:21 2018 -0500
Committer: William Lieurance <william.lieurance@namikoda.com>
Committed: Wed Jul 11 03:45:27 2018 -0500

----------------------------------------------------------------------
 .../internal/DSLLoadingConfigurationProviderSpi.java      |  3 ---
 .../org/apache/tamaya/metamodel/ext/IntegrationTest.java  | 10 ++++++++--
 2 files changed, 8 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/681cb1e5/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/DSLLoadingConfigurationProviderSpi.java
----------------------------------------------------------------------
diff --git a/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/DSLLoadingConfigurationProviderSpi.java
b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/DSLLoadingConfigurationProviderSpi.java
index 1e2826c..05c68e3 100644
--- a/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/DSLLoadingConfigurationProviderSpi.java
+++ b/metamodel/src/main/java/org/apache/tamaya/metamodel/internal/DSLLoadingConfigurationProviderSpi.java
@@ -90,9 +90,6 @@ public class DSLLoadingConfigurationProviderSpi implements ConfigurationProvider
         if(config==null){
             synchronized (LOCK) {
                 if(config==null){
-                    MetaConfiguration.configure();
-                }
-                if(config==null){
                     // load defaults
                     this.config = new DefaultConfiguration(
                             new DefaultConfigurationContextBuilder()

http://git-wip-us.apache.org/repos/asf/incubator-tamaya-sandbox/blob/681cb1e5/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/IntegrationTest.java
----------------------------------------------------------------------
diff --git a/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/IntegrationTest.java
b/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/IntegrationTest.java
index edcaca5..874b82a 100644
--- a/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/IntegrationTest.java
+++ b/metamodel/src/test/java/org/apache/tamaya/metamodel/ext/IntegrationTest.java
@@ -42,8 +42,14 @@ public class IntegrationTest {
 
     @Test
     public void checkSystemLoads(){
-        assertThat(ConfigurationProvider.getConfiguration()).isNotNull();
-        System.out.println(ConfigurationProvider.getConfiguration());
+        Configuration defaultConfig = ConfigurationProvider.getConfiguration();
+        assertThat(defaultConfig).isNotNull();
+        
+        MetaConfiguration.configure();
+        Configuration defaultMetaConfig = ConfigurationProvider.getConfiguration();
+        assertThat(defaultMetaConfig).isNotNull();
+        
+        assertThat(defaultConfig).isNotEqualTo(defaultMetaConfig);
     }
 
     @Test


Mime
View raw message