This is an automated email from the ASF dual-hosted git repository.

martin_s pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/archiva-components.git


The following commit(s) were added to refs/heads/master by this push:
     new d8d214d  Adding annotation-api dependency for JDK11
d8d214d is described below

commit d8d214de96adf8afbe0906e938b5a50a39281692
Author: Martin Stockhammer <[email protected]>
AuthorDate: Sun Nov 17 15:33:17 2019 +0100

    Adding annotation-api dependency for JDK11
---
 spring-registry/pom.xml                                             | 6 ++++++
 spring-registry/spring-registry-commons/pom.xml                     | 5 +++++
 .../components/registry/commons/CommonsConfigurationRegistry.java   | 5 +++++
 3 files changed, 16 insertions(+)

diff --git a/spring-registry/pom.xml b/spring-registry/pom.xml
index 7da5f94..671d680 100644
--- a/spring-registry/pom.xml
+++ b/spring-registry/pom.xml
@@ -74,6 +74,12 @@
         <artifactId>commons-beanutils</artifactId>
         <version>${commons.beanutils.version}</version>
       </dependency>
+
+      <dependency>
+        <groupId>javax.annotation</groupId>
+        <artifactId>javax.annotation-api</artifactId>
+        <version>${javax.annotation.version}</version>
+      </dependency>
     </dependencies>
   </dependencyManagement>
   <dependencies>
diff --git a/spring-registry/spring-registry-commons/pom.xml 
b/spring-registry/spring-registry-commons/pom.xml
index 1f4e67b..a163fba 100644
--- a/spring-registry/spring-registry-commons/pom.xml
+++ b/spring-registry/spring-registry-commons/pom.xml
@@ -74,6 +74,11 @@
     </dependency>
 
     <dependency>
+      <groupId>javax.annotation</groupId>
+      <artifactId>javax.annotation-api</artifactId>
+    </dependency>
+
+    <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
     </dependency>
diff --git 
a/spring-registry/spring-registry-commons/src/main/java/org/apache/archiva/components/registry/commons/CommonsConfigurationRegistry.java
 
b/spring-registry/spring-registry-commons/src/main/java/org/apache/archiva/components/registry/commons/CommonsConfigurationRegistry.java
index e069118..6894541 100644
--- 
a/spring-registry/spring-registry-commons/src/main/java/org/apache/archiva/components/registry/commons/CommonsConfigurationRegistry.java
+++ 
b/spring-registry/spring-registry-commons/src/main/java/org/apache/archiva/components/registry/commons/CommonsConfigurationRegistry.java
@@ -22,6 +22,7 @@ package org.apache.archiva.components.registry.commons;
 import org.apache.archiva.components.registry.Registry;
 import org.apache.archiva.components.registry.RegistryException;
 import org.apache.archiva.components.registry.RegistryListener;
+import org.apache.commons.configuration.BaseConfiguration;
 import org.apache.commons.configuration.CombinedConfiguration;
 import org.apache.commons.configuration.Configuration;
 import org.apache.commons.configuration.ConfigurationException;
@@ -87,6 +88,7 @@ public class CommonsConfigurationRegistry
     {
         // default constructor
         logger.debug( "empty constructor" );
+        this.configuration = new CombinedConfiguration( );
     }
 
     public CommonsConfigurationRegistry( Configuration configuration )
@@ -326,6 +328,9 @@ public class CommonsConfigurationRegistry
     public void addConfigurationFromResource( String resource, String prefix )
         throws RegistryException
     {
+        if (!(this.configuration instanceof CombinedConfiguration)) {
+            throw new RegistryException( "This is not a combined configuration 
so cannot add resource" );
+        }
         CombinedConfiguration configuration = (CombinedConfiguration) 
this.configuration;
         if ( resource.endsWith( ".properties" ) )
         {

Reply via email to