archiva-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ol...@apache.org
Subject [1/2] archiva git commit: simplify section null checking, and guard against NPEs
Date Wed, 05 Oct 2016 03:31:04 GMT
Repository: archiva
Updated Branches:
  refs/heads/master 1fd9c951e -> 70323bbef


simplify section null checking, and guard against NPEs


Project: http://git-wip-us.apache.org/repos/asf/archiva/repo
Commit: http://git-wip-us.apache.org/repos/asf/archiva/commit/723cf8b2
Tree: http://git-wip-us.apache.org/repos/asf/archiva/tree/723cf8b2
Diff: http://git-wip-us.apache.org/repos/asf/archiva/diff/723cf8b2

Branch: refs/heads/master
Commit: 723cf8b2ee8302edc28e2ee8b5eead4750fd50e3
Parents: 5bc8ad7
Author: Dave Brosius <dbrosius@mebigfatguy.com>
Authored: Sat Sep 17 18:48:47 2016 -0400
Committer: Dave Brosius <dbrosius@mebigfatguy.com>
Committed: Sat Sep 17 18:48:47 2016 -0400

----------------------------------------------------------------------
 .../DefaultArchivaConfiguration.java            | 67 +++++++++++---------
 1 file changed, 36 insertions(+), 31 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/archiva/blob/723cf8b2/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java
----------------------------------------------------------------------
diff --git a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java
b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java
index 665c80a..f37171a 100644
--- a/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java
+++ b/archiva-modules/archiva-base/archiva-configuration/src/main/java/org/apache/archiva/configuration/DefaultArchivaConfiguration.java
@@ -489,45 +489,50 @@ public class DefaultArchivaConfiguration
         escapeCronExpressions( configuration );
 
         // [MRM-661] Due to a bug in the modello registry writer, we need to take these out
by hand. They'll be put back by the writer.
-        if ( configuration.getManagedRepositories().isEmpty() && section != null
)
-        {
-            section.removeSubset( "managedRepositories" );
-        }
-        if ( configuration.getRemoteRepositories().isEmpty() && section != null )
+        if ( section != null )
         {
-            section.removeSubset( "remoteRepositories" );
+            if ( configuration.getManagedRepositories().isEmpty() )
+            {
+                section.removeSubset( "managedRepositories" );
+            }
+            if ( configuration.getRemoteRepositories().isEmpty() )
+            {
+                section.removeSubset( "remoteRepositories" );
 
-        }
-        if ( configuration.getProxyConnectors().isEmpty() && section != null )
-        {
-            section.removeSubset( "proxyConnectors" );
-        }
-        if ( configuration.getNetworkProxies().isEmpty() && section != null )
-        {
-            section.removeSubset( "networkProxies" );
-        }
-        if ( configuration.getLegacyArtifactPaths().isEmpty() && section != null
)
-        {
-            section.removeSubset( "legacyArtifactPaths" );
-        }
-        if ( configuration.getRepositoryGroups().isEmpty() && section != null )
-        {
-            section.removeSubset( "repositoryGroups" );
-        }
-        if ( configuration.getRepositoryScanning() != null )
-        {
-            if ( configuration.getRepositoryScanning().getKnownContentConsumers().isEmpty()
&& section != null )
+            }
+            if ( configuration.getProxyConnectors().isEmpty() )
+            {
+                section.removeSubset( "proxyConnectors" );
+            }
+            if ( configuration.getNetworkProxies().isEmpty() )
+            {
+                section.removeSubset( "networkProxies" );
+            }
+            if ( configuration.getLegacyArtifactPaths().isEmpty() )
+            {
+                section.removeSubset( "legacyArtifactPaths" );
+            }
+            if ( configuration.getRepositoryGroups().isEmpty() )
             {
-                section.removeSubset( "repositoryScanning.knownContentConsumers" );
+                section.removeSubset( "repositoryGroups" );
             }
-            if ( configuration.getRepositoryScanning().getInvalidContentConsumers().isEmpty()
&& section != null )
+            if ( configuration.getRepositoryScanning() != null )
             {
-                section.removeSubset( "repositoryScanning.invalidContentConsumers" );
+                if ( configuration.getRepositoryScanning().getKnownContentConsumers().isEmpty()
)
+                {
+                    section.removeSubset( "repositoryScanning.knownContentConsumers" );
+                }
+                if ( configuration.getRepositoryScanning().getInvalidContentConsumers().isEmpty()
)
+                {
+                    section.removeSubset( "repositoryScanning.invalidContentConsumers" );
+                }
             }
+
+            new ConfigurationRegistryWriter().write( configuration, section );
+            section.save();
         }
 
-        new ConfigurationRegistryWriter().write( configuration, section );
-        section.save();
+
 
         this.configuration = unescapeExpressions( configuration );
 


Mime
View raw message