mirror of https://github.com/apache/archiva.git
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
This commit is contained in:
parent
53f8581435
commit
b978de05ff
|
@ -588,7 +588,7 @@ public class DefaultManagedRepositoryAdmin
|
||||||
|
|
||||||
if ( context != null )
|
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;
|
return context;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,10 +610,8 @@ public class DefaultManagedRepositoryAdmin
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
String indexDir = repository.getIndexDirectory();
|
String indexDir = repository.getIndexDirectory();
|
||||||
File managedRepository = new File( repository.getLocation() );
|
//File managedRepository = new File( repository.getLocation() );
|
||||||
|
|
||||||
File indexDirectory = null;
|
File indexDirectory = null;
|
||||||
if ( StringUtils.isNotBlank( indexDir ) )
|
if ( StringUtils.isNotBlank( indexDir ) )
|
||||||
|
@ -622,14 +620,14 @@ public class DefaultManagedRepositoryAdmin
|
||||||
// not absolute so create it in repository directory
|
// not absolute so create it in repository directory
|
||||||
if ( !indexDirectory.isAbsolute() )
|
if ( !indexDirectory.isAbsolute() )
|
||||||
{
|
{
|
||||||
indexDirectory = new File( managedRepository, repository.getIndexDirectory() );
|
indexDirectory = new File( repositoryDirectory, repository.getIndexDirectory() );
|
||||||
repository.setIndexDirectory( indexDirectory.getAbsolutePath() );
|
repository.setIndexDirectory( indexDirectory.getAbsolutePath() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
indexDirectory = new File( managedRepository, ".indexer" );
|
indexDirectory = new File( repositoryDirectory, ".indexer" );
|
||||||
if ( !managedRepository.isAbsolute() )
|
if ( !repositoryDirectory.isAbsolute() )
|
||||||
{
|
{
|
||||||
indexDirectory = new File( repositoryDirectory, ".indexer" );
|
indexDirectory = new File( repositoryDirectory, ".indexer" );
|
||||||
repository.setIndexDirectory( indexDirectory.getAbsolutePath() );
|
repository.setIndexDirectory( indexDirectory.getAbsolutePath() );
|
||||||
|
@ -645,9 +643,9 @@ public class DefaultManagedRepositoryAdmin
|
||||||
|
|
||||||
if ( context == null )
|
if ( context == null )
|
||||||
{
|
{
|
||||||
context = indexer.addIndexingContext( repository.getId(), repository.getId(), managedRepository,
|
context = indexer.addIndexingContext( repository.getId(), repository.getId(), repositoryDirectory,
|
||||||
indexDirectory,
|
indexDirectory,
|
||||||
managedRepository.toURI().toURL().toExternalForm(),
|
repositoryDirectory.toURI().toURL().toExternalForm(),
|
||||||
indexDirectory.toURI().toURL().toString(), indexCreators );
|
indexDirectory.toURI().toURL().toString(), indexCreators );
|
||||||
|
|
||||||
context.setSearchable( repository.isScanned() );
|
context.setSearchable( repository.isScanned() );
|
||||||
|
|
Loading…
Reference in New Issue