mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-13 08:55:44 +01:00
fix bug in AbstractSimpleRepositoryHandler
This commit is contained in:
@@ -13,7 +13,7 @@ import sonia.scm.ConfigurationException;
|
|||||||
import sonia.scm.SCMContextProvider;
|
import sonia.scm.SCMContextProvider;
|
||||||
import sonia.scm.io.CommandResult;
|
import sonia.scm.io.CommandResult;
|
||||||
import sonia.scm.io.ExtendedCommand;
|
import sonia.scm.io.ExtendedCommand;
|
||||||
import sonia.scm.util.Util;
|
import sonia.scm.util.IOUtil;
|
||||||
|
|
||||||
//~--- JDK imports ------------------------------------------------------------
|
//~--- JDK imports ------------------------------------------------------------
|
||||||
|
|
||||||
@@ -28,7 +28,6 @@ import java.util.logging.Level;
|
|||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
import javax.xml.bind.JAXB;
|
import javax.xml.bind.JAXB;
|
||||||
import sonia.scm.util.IOUtil;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -195,12 +194,12 @@ public abstract class AbstractSimpleRepositoryHandler<T extends SimpleRepository
|
|||||||
@Override
|
@Override
|
||||||
public Repository get(String id)
|
public Repository get(String id)
|
||||||
{
|
{
|
||||||
Repository repository = null;
|
|
||||||
File repositoryFile = getRepositoryFile(id);
|
File repositoryFile = getRepositoryFile(id);
|
||||||
|
Repository repository = null;
|
||||||
|
|
||||||
if (repositoryFile.exists())
|
if (repositoryFile.exists())
|
||||||
{
|
{
|
||||||
repository = JAXB.unmarshal(repositoryFile, Repository.class);
|
repository = getRepositoryFromConfig(repositoryFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
return repository;
|
return repository;
|
||||||
@@ -229,10 +228,12 @@ public abstract class AbstractSimpleRepositoryHandler<T extends SimpleRepository
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Repository repository = JAXB.unmarshal(repositoryFile,
|
Repository repository = getRepositoryFromConfig(repositoryFile);
|
||||||
Repository.class);
|
|
||||||
|
|
||||||
repositories.add(repository);
|
if (repository != null)
|
||||||
|
{
|
||||||
|
repositories.add(repository);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -316,6 +317,33 @@ public abstract class AbstractSimpleRepositoryHandler<T extends SimpleRepository
|
|||||||
return directory;
|
return directory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Method description
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @param repositoryFile
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
protected Repository getRepositoryFromConfig(File repositoryFile)
|
||||||
|
{
|
||||||
|
Repository repository = JAXB.unmarshal(repositoryFile, Repository.class);
|
||||||
|
File directory = getDirectory(repository);
|
||||||
|
|
||||||
|
if (!directory.exists())
|
||||||
|
{
|
||||||
|
if (logger.isLoggable(Level.WARNING))
|
||||||
|
{
|
||||||
|
logger.warning(
|
||||||
|
"could not find repository ".concat(repository.getName()));
|
||||||
|
}
|
||||||
|
|
||||||
|
repository = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return repository;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method description
|
* Method description
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user