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 2585703 Adding NPE checks
2585703 is described below
commit 2585703ad461cbab365226fae1de9b87bf24a76e
Author: Martin Stockhammer <[email protected]>
AuthorDate: Fri Jul 10 07:29:13 2020 +0200
Adding NPE checks
---
.../apache/archiva/components/cache/ehcache/EhcacheCache.java | 10 ++++++++--
.../registry/commons/CommonsConfigurationRegistry.java | 11 ++++++++++-
2 files changed, 18 insertions(+), 3 deletions(-)
diff --git
a/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/components/cache/ehcache/EhcacheCache.java
b/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/components/cache/ehcache/EhcacheCache.java
index c114255..ec92316 100644
---
a/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/components/cache/ehcache/EhcacheCache.java
+++
b/spring-cache/spring-cache-providers/spring-cache-ehcache/src/main/java/org/apache/archiva/components/cache/ehcache/EhcacheCache.java
@@ -185,8 +185,14 @@ public class EhcacheCache<V, T>
@Override
public void clear( )
{
- ehcache.removeAll( );
- stats.clear( );
+ if (ehcache!=null)
+ {
+ ehcache.removeAll( );
+ }
+ if (stats!=null)
+ {
+ stats.clear( );
+ }
}
@PostConstruct
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 7c3f033..55c2079 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
@@ -39,6 +39,7 @@ import
org.apache.commons.configuration2.ex.ConfigurationException;
import org.apache.commons.configuration2.tree.DefaultExpressionEngine;
import org.apache.commons.configuration2.tree.DefaultExpressionEngineSymbols;
import org.apache.commons.configuration2.tree.ImmutableNode;
+import org.apache.commons.configuration2.tree.OverrideCombiner;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.text.StringSubstitutor;
import org.apache.commons.text.lookup.StringLookupFactory;
@@ -114,7 +115,7 @@ public class CommonsConfigurationRegistry
{
// default constructor
logger.debug( "empty constructor" );
- this.configurationBuilder = new CombinedConfigurationBuilder( );
+ this.configurationBuilder = new CombinedConfigurationBuilder( );
try
{
this.configuration = configurationBuilder.getConfiguration();
@@ -482,6 +483,14 @@ public class CommonsConfigurationRegistry
}
}
+ public void addConfiguration(Configuration newConfiguration, String name,
String prefix) {
+ CombinedConfiguration configuration = (CombinedConfiguration)
this.configuration;
+ if (configuration.getConfigurationNames( ).contains( name )) {
+ configuration.removeConfiguration( name );
+ }
+ configuration.addConfiguration( newConfiguration, name, prefix );
+ }
+
/**
*
* Adds a new configuration source to the combined configuration.