diff options
author | Brett Porter <brett@apache.org> | 2007-08-17 07:47:06 +0000 |
---|---|---|
committer | Brett Porter <brett@apache.org> | 2007-08-17 07:47:06 +0000 |
commit | c8571f77e285d4012e75b1ebe28b0fb85b6f9379 (patch) | |
tree | 7c33fe814199bc44707625e385158054275b3cf3 /archiva-base/archiva-configuration | |
parent | db8685f9ddade743c6e88f609242827f8cee6ba8 (diff) | |
download | archiva-c8571f77e285d4012e75b1ebe28b0fb85b6f9379.tar.gz archiva-c8571f77e285d4012e75b1ebe28b0fb85b6f9379.zip |
[MRM-436] configuration tests don't always set database scanning fields, so add some null guards
git-svn-id: https://svn.apache.org/repos/asf/maven/archiva/trunk@566959 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'archiva-base/archiva-configuration')
-rw-r--r-- | archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java index 38d7a6751..82ff2069b 100644 --- a/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java +++ b/archiva-base/archiva-configuration/src/main/java/org/apache/maven/archiva/configuration/DefaultArchivaConfiguration.java @@ -268,17 +268,17 @@ public class DefaultArchivaConfiguration private String unescapeCronExpression( String cronExpression ) { - return StringUtils.replace( cronExpression, "\\," , "," ); + return StringUtils.replace( cronExpression, "\\,", "," ); } private String escapeCronExpression( String cronExpression ) { - return StringUtils.replace( cronExpression, "," , "\\," ); + return StringUtils.replace( cronExpression, ",", "\\," ); } - private Configuration processExpressions( Configuration config ) + private Configuration processExpressions( Configuration config ) { - // TODO: for commons-configuration 1.3 only + // TODO: for commons-configuration 1.3 only for ( Iterator i = config.getRepositories().iterator(); i.hasNext(); ) { RepositoryConfiguration c = (RepositoryConfiguration) i.next(); @@ -286,8 +286,12 @@ public class DefaultArchivaConfiguration c.setRefreshCronExpression( unescapeCronExpression( c.getRefreshCronExpression() ) ); } - String cron = config.getDatabaseScanning().getCronExpression(); - config.getDatabaseScanning().setCronExpression( unescapeCronExpression( cron ) ); + DatabaseScanningConfiguration databaseScanning = config.getDatabaseScanning(); + if ( databaseScanning != null ) + { + String cron = databaseScanning.getCronExpression(); + databaseScanning.setCronExpression( unescapeCronExpression( cron ) ); + } return config; } @@ -298,12 +302,15 @@ public class DefaultArchivaConfiguration { RepositoryConfiguration c = (RepositoryConfiguration) i.next(); - c.setRefreshCronExpression( - escapeCronExpression( c.getRefreshCronExpression() ) ); + c.setRefreshCronExpression( escapeCronExpression( c.getRefreshCronExpression() ) ); } - String cron = config.getDatabaseScanning().getCronExpression(); - config.getDatabaseScanning().setCronExpression( escapeCronExpression( cron ) ); + DatabaseScanningConfiguration databaseScanning = config.getDatabaseScanning(); + if ( databaseScanning != null ) + { + String cron = databaseScanning.getCronExpression(); + databaseScanning.setCronExpression( escapeCronExpression( cron ) ); + } return config; } |