From b978de05ff5cda0c7293a615cc4aaed34449d092 Mon Sep 17 00:00:00 2001 From: Olivier Lamy Date: Wed, 6 Feb 2013 22:49:40 +0000 Subject: fix issue when creating repository with relative path index used a wrong repository directory git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1443259 13f79535-47bb-0310-9956-ffa450edef68 --- .../managed/DefaultManagedRepositoryAdmin.java | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java index 0ecdb3724..2fc8f7235 100644 --- a/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java +++ b/archiva-modules/archiva-base/archiva-repository-admin/archiva-repository-admin-default/src/main/java/org/apache/archiva/admin/repository/managed/DefaultManagedRepositoryAdmin.java @@ -588,7 +588,7 @@ public class DefaultManagedRepositoryAdmin if ( context != null ) { - log.debug( "skip adding repository indexingContent with id {} as already exists", repository.getId() ); + log.debug( "skip creating repository indexingContent with id {} as already exists", repository.getId() ); return context; } @@ -610,10 +610,8 @@ public class DefaultManagedRepositoryAdmin try { - - String indexDir = repository.getIndexDirectory(); - File managedRepository = new File( repository.getLocation() ); + //File managedRepository = new File( repository.getLocation() ); File indexDirectory = null; if ( StringUtils.isNotBlank( indexDir ) ) @@ -622,14 +620,14 @@ public class DefaultManagedRepositoryAdmin // not absolute so create it in repository directory if ( !indexDirectory.isAbsolute() ) { - indexDirectory = new File( managedRepository, repository.getIndexDirectory() ); + indexDirectory = new File( repositoryDirectory, repository.getIndexDirectory() ); repository.setIndexDirectory( indexDirectory.getAbsolutePath() ); } } else { - indexDirectory = new File( managedRepository, ".indexer" ); - if ( !managedRepository.isAbsolute() ) + indexDirectory = new File( repositoryDirectory, ".indexer" ); + if ( !repositoryDirectory.isAbsolute() ) { indexDirectory = new File( repositoryDirectory, ".indexer" ); repository.setIndexDirectory( indexDirectory.getAbsolutePath() ); @@ -645,9 +643,9 @@ public class DefaultManagedRepositoryAdmin if ( context == null ) { - context = indexer.addIndexingContext( repository.getId(), repository.getId(), managedRepository, + context = indexer.addIndexingContext( repository.getId(), repository.getId(), repositoryDirectory, indexDirectory, - managedRepository.toURI().toURL().toExternalForm(), + repositoryDirectory.toURI().toURL().toExternalForm(), indexDirectory.toURI().toURL().toString(), indexCreators ); context.setSearchable( repository.isScanned() ); -- cgit v1.2.3