tamaya-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rsandt...@apache.org
Subject incubator-tamaya git commit: fixed broken build
Date Mon, 26 Jan 2015 08:55:26 GMT
Repository: incubator-tamaya
Updated Branches:
  refs/heads/master 8169c4e18 -> 1a3ecf119


fixed broken build


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

Branch: refs/heads/master
Commit: 1a3ecf119d6bd44a032dad843b8573796a2df365
Parents: 8169c4e
Author: Reinhard Sandtner <rsandtner@apache.org>
Authored: Mon Jan 26 09:55:03 2015 +0100
Committer: Reinhard Sandtner <rsandtner@apache.org>
Committed: Mon Jan 26 09:55:03 2015 +0100

----------------------------------------------------------------------
 .../main/resources/findbugs/findbugs-exclude.xml | 19 +++++++++++++++++++
 .../org/apache/tamaya/TestConfiguration.java     | 10 ++++++++++
 .../org/apache/tamaya/TestConfiguration.java     |  2 --
 .../tamaya/builder/ConfigurationBuilder.java     | 13 +++++++++++++
 .../ProgrammaticConfigurationContext.java        | 11 +++++++++++
 5 files changed, 53 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a3ecf11/buildconfigurations/src/main/resources/findbugs/findbugs-exclude.xml
----------------------------------------------------------------------
diff --git a/buildconfigurations/src/main/resources/findbugs/findbugs-exclude.xml b/buildconfigurations/src/main/resources/findbugs/findbugs-exclude.xml
index 9cdc594..3d57540 100644
--- a/buildconfigurations/src/main/resources/findbugs/findbugs-exclude.xml
+++ b/buildconfigurations/src/main/resources/findbugs/findbugs-exclude.xml
@@ -120,6 +120,25 @@ under the License.
         <Class name="org.apache.tamaya.core.internal.converters.BooleanConverter"/>
     </Match>
 
+    <!--
+     * findBugs does not detect usage via method references
+     * should be removed after see TODO ProgrammaticConfigurationContext:131
+    -->
+    <Match>
+        <Class name="org.apache.tamaya.builder.ProgrammaticConfigurationContext" />
+        <Method name="comparePropertySources"
+                params="org.apache.tamaya.spi.PropertySource,org.apache.tamaya.spi.PropertySource"
+                returns="int" />
+        <Bug pattern="UPM_UNCALLED_PRIVATE_METHOD" />
+    </Match>
+    <Match>
+        <Class name="org.apache.tamaya.builder.ProgrammaticConfigurationContext" />
+        <Method name="comparePropertyFilters"
+                params="org.apache.tamaya.spi.PropertyFilter,org.apache.tamaya.spi.PropertyFilter"
+                returns="int" />
+        <Bug pattern="UPM_UNCALLED_PRIVATE_METHOD" />
+    </Match>
+
     <!-- Issues to review -->
 
     <Match>

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a3ecf11/java7/api/src/test/java/org/apache/tamaya/TestConfiguration.java
----------------------------------------------------------------------
diff --git a/java7/api/src/test/java/org/apache/tamaya/TestConfiguration.java b/java7/api/src/test/java/org/apache/tamaya/TestConfiguration.java
index 888eaad..0f19665 100644
--- a/java7/api/src/test/java/org/apache/tamaya/TestConfiguration.java
+++ b/java7/api/src/test/java/org/apache/tamaya/TestConfiguration.java
@@ -80,6 +80,16 @@ public class TestConfiguration implements Configuration{
     }
 
     @Override
+    public <T> T get(String key, TypeLiteral<T> type) {
+        throw new RuntimeException("Method not implemented yet.");
+    }
+
+    @Override
+    public <T> T get(String key, PropertyConverter<T> converter) {
+        throw new RuntimeException("Method not implemented yet.");
+    }
+
+    @Override
     public Configuration with(ConfigOperator operator) {
         return null;
     }

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a3ecf11/java8/api/src/test/java/org/apache/tamaya/TestConfiguration.java
----------------------------------------------------------------------
diff --git a/java8/api/src/test/java/org/apache/tamaya/TestConfiguration.java b/java8/api/src/test/java/org/apache/tamaya/TestConfiguration.java
index 2501b32..31500ae 100644
--- a/java8/api/src/test/java/org/apache/tamaya/TestConfiguration.java
+++ b/java8/api/src/test/java/org/apache/tamaya/TestConfiguration.java
@@ -18,8 +18,6 @@
  */
 package org.apache.tamaya;
 
-import org.apache.tamaya.spi.ConfigurationContext;
-
 import java.util.HashMap;
 import java.util.Map;
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a3ecf11/modules/builder/src/main/java/org/apache/tamaya/builder/ConfigurationBuilder.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/ConfigurationBuilder.java
b/modules/builder/src/main/java/org/apache/tamaya/builder/ConfigurationBuilder.java
index ff4a3f7..cabfe7a 100644
--- a/modules/builder/src/main/java/org/apache/tamaya/builder/ConfigurationBuilder.java
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/ConfigurationBuilder.java
@@ -38,6 +38,13 @@ public class ConfigurationBuilder {
     private ProgrammaticConfigurationContext.Builder contextBuilder = new ProgrammaticConfigurationContext.Builder();
 
     /**
+     * Flag if the config has already been built.
+     * Configuration can be built only once
+     */
+    private boolean built;
+
+
+    /**
      * Allows to set configuration context during unit tests.
      */
     ConfigurationBuilder setConfigurationContext(ConfigurationContext configurationContext)
{
@@ -79,6 +86,12 @@ public class ConfigurationBuilder {
      * @return a new Configuration instance.
      */
     public Configuration build() {
+        if (built) {
+            throw new IllegalStateException("building a Configuration can only be done once");
+        }
+
+        built = true;
+
         return new DefaultConfiguration(contextBuilder.build());
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-tamaya/blob/1a3ecf11/modules/builder/src/main/java/org/apache/tamaya/builder/ProgrammaticConfigurationContext.java
----------------------------------------------------------------------
diff --git a/modules/builder/src/main/java/org/apache/tamaya/builder/ProgrammaticConfigurationContext.java
b/modules/builder/src/main/java/org/apache/tamaya/builder/ProgrammaticConfigurationContext.java
index 750bf37..b90c271 100644
--- a/modules/builder/src/main/java/org/apache/tamaya/builder/ProgrammaticConfigurationContext.java
+++ b/modules/builder/src/main/java/org/apache/tamaya/builder/ProgrammaticConfigurationContext.java
@@ -127,6 +127,10 @@ class ProgrammaticConfigurationContext implements ConfigurationContext
{
      * @return the comparison result.
      */
     private int comparePropertySources(PropertySource source1, PropertySource source2) {
+
+        //X TODO this method duplicates org.apache.tamaya.core.internal.DefaultConfigurationContext.PropertySourceComparator.comparePropertySources()
+        //X maybe we should extract the Comperator in an own class for real code-reuse (copy
paste == bad code reuse)
+
         if (source1.getOrdinal() < source2.getOrdinal()) {
             return -1;
         } else if (source1.getOrdinal() > source2.getOrdinal()) {
@@ -144,6 +148,10 @@ class ProgrammaticConfigurationContext implements ConfigurationContext
{
      * @return the comparison result
      */
     private int comparePropertyFilters(PropertyFilter filter1, PropertyFilter filter2) {
+
+        //X TODO this method duplicates org.apache.tamaya.core.internal.DefaultConfigurationContext.PropertySourceComparator.comparePropertyFilters()
+        //X maybe we should extract the Comperator in an own class for real code-reuse (copy
paste == bad code reuse)
+
         Priority prio1 = filter1.getClass().getAnnotation(Priority.class);
         Priority prio2 = filter2.getClass().getAnnotation(Priority.class);
         int ord1 = prio1 != null ? prio1.value() : 0;
@@ -195,6 +203,9 @@ class ProgrammaticConfigurationContext implements ConfigurationContext
{
         return joiner.toString();
     }
 
+    /**
+     * The Builder for {@link ProgrammaticConfigurationContext}
+     */
     public final static class Builder {
         /**
          * The current unmodifiable list of loaded {@link org.apache.tamaya.spi.PropertySource}
instances.


Mime
View raw message