mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-06 21:45:43 +01:00
fix some warning and removed some unused imports
This commit is contained in:
@@ -52,12 +52,10 @@ import sonia.scm.util.AssertUtil;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Timer;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledThreadPoolExecutor;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.SCMContextProvider;
|
||||
import sonia.scm.schedule.Scheduler;
|
||||
import sonia.scm.schedule.Task;
|
||||
@@ -307,21 +305,17 @@ public class GitRepositoryHandler
|
||||
protected void create(Repository repository, File directory)
|
||||
throws RepositoryException, IOException
|
||||
{
|
||||
org.eclipse.jgit.lib.Repository gitRepository = null;
|
||||
|
||||
try
|
||||
{
|
||||
gitRepository = new FileRepositoryBuilder().setGitDir(
|
||||
directory).readEnvironment().findGitDir().build();
|
||||
try (org.eclipse.jgit.lib.Repository gitRepository = build(directory)) {
|
||||
gitRepository.create(true);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (gitRepository != null)
|
||||
{
|
||||
gitRepository.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private org.eclipse.jgit.lib.Repository build(File directory) throws IOException {
|
||||
return new FileRepositoryBuilder()
|
||||
.setGitDir(directory)
|
||||
.readEnvironment()
|
||||
.findGitDir()
|
||||
.build();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -269,7 +269,7 @@ public class GitBrowseCommand extends AbstractGitCommand
|
||||
walk.markStart(commit);
|
||||
result = Util.getFirst(walk);
|
||||
}
|
||||
catch (Exception ex)
|
||||
catch (IOException ex)
|
||||
{
|
||||
logger.error("could not parse commit for file", ex);
|
||||
}
|
||||
@@ -414,7 +414,7 @@ public class GitBrowseCommand extends AbstractGitCommand
|
||||
revision);
|
||||
}
|
||||
|
||||
Map<String, SubRepository> subRepositories = null;
|
||||
Map<String, SubRepository> subRepositories;
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
try
|
||||
@@ -456,7 +456,6 @@ public class GitBrowseCommand extends AbstractGitCommand
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private Map<ObjectId, Map<String, SubRepository>> subrepositoryCache =
|
||||
Maps.newHashMap();
|
||||
/** sub repository cache */
|
||||
private final Map<ObjectId, Map<String, SubRepository>> subrepositoryCache = Maps.newHashMap();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user