diff options
author | James Moger <james.moger@gitblit.com> | 2013-09-30 09:30:04 -0400 |
---|---|---|
committer | James Moger <james.moger@gitblit.com> | 2013-09-30 10:11:28 -0400 |
commit | 699e71e76b15081baf746c6ce9c9144f7e5f1ff9 (patch) | |
tree | 4a9ea25c258caeae3dea4bc1de809f47bc615d81 /src/main/java/com/gitblit/git | |
parent | 235ad956fa84cad4fac1b2e69a0c9e4f50376ea3 (diff) | |
download | gitblit-699e71e76b15081baf746c6ce9c9144f7e5f1ff9.tar.gz gitblit-699e71e76b15081baf746c6ce9c9144f7e5f1ff9.zip |
Trim trailing whitespace and organize imports
Change-Id: I9f91138b20219be6e3c4b28251487df262bff6cc
Diffstat (limited to 'src/main/java/com/gitblit/git')
7 files changed, 33 insertions, 30 deletions
diff --git a/src/main/java/com/gitblit/git/GitDaemon.java b/src/main/java/com/gitblit/git/GitDaemon.java index b760fbcc..bb578efc 100644 --- a/src/main/java/com/gitblit/git/GitDaemon.java +++ b/src/main/java/com/gitblit/git/GitDaemon.java @@ -73,9 +73,9 @@ import com.gitblit.utils.StringUtils; /**
* Gitblit's Git Daemon ignores any and all per-repository daemon settings and
* integrates into Gitblit's security model.
- *
+ *
* @author James Moger
- *
+ *
*/
public class GitDaemon {
@@ -113,7 +113,7 @@ public class GitDaemon { /**
* Construct the Gitblit Git daemon.
- *
+ *
* @param bindInterface
* the ip address of the interface to bind
* @param port
@@ -128,10 +128,10 @@ public class GitDaemon { // set the repository resolver and pack factories
repositoryResolver = new RepositoryResolver<GitDaemonClient>(folder);
}
-
+
/**
* Configure a new daemon for the specified network address.
- *
+ *
* @param addr
* address to listen for connections on. If null, any available
* port will be chosen on all network interfaces.
@@ -177,11 +177,11 @@ public class GitDaemon { }
} };
}
-
+
public int getPort() {
return myAddress.getPort();
}
-
+
public String formatUrl(String servername, String repository) {
if (getPort() == 9418) {
// standard port
@@ -199,7 +199,7 @@ public class GitDaemon { /**
* Set the timeout before willing to abort an IO call.
- *
+ *
* @param seconds
* number of seconds to wait (with no data transfer occurring)
* before aborting an IO read or write operation with the
@@ -211,7 +211,7 @@ public class GitDaemon { /**
* Start this daemon on a background thread.
- *
+ *
* @throws IOException
* the server socket could not be opened.
* @throws IllegalStateException
@@ -228,6 +228,7 @@ public class GitDaemon { run.set(true);
acceptSocket = listenSock;
acceptThread = new Thread(processors, "Git-Daemon-Accept") {
+ @Override
public void run() {
while (isRunning()) {
try {
@@ -250,7 +251,7 @@ public class GitDaemon { }
};
acceptThread.start();
-
+
logger.info(MessageFormat.format("Git Daemon is listening on {0}:{1,number,0}", myAddress.getAddress().getHostAddress(), myAddress.getPort()));
}
@@ -290,6 +291,7 @@ public class GitDaemon { dc.setRemoteAddress(((InetSocketAddress) peer).getAddress());
new Thread(processors, "Git-Daemon-Client " + peer.toString()) {
+ @Override
public void run() {
try {
dc.execute(s);
diff --git a/src/main/java/com/gitblit/git/GitDaemonClient.java b/src/main/java/com/gitblit/git/GitDaemonClient.java index e7455e0d..8d8cac6d 100644 --- a/src/main/java/com/gitblit/git/GitDaemonClient.java +++ b/src/main/java/com/gitblit/git/GitDaemonClient.java @@ -65,7 +65,7 @@ public class GitDaemonClient { private InputStream rawIn;
private OutputStream rawOut;
-
+
private String repositoryName;
GitDaemonClient(final GitDaemon d) {
@@ -95,11 +95,11 @@ public class GitDaemonClient { public OutputStream getOutputStream() {
return rawOut;
}
-
+
public void setRepositoryName(String repositoryName) {
this.repositoryName = repositoryName;
}
-
+
/** @return the name of the requested repository. */
public String getRepositoryName() {
return repositoryName;
diff --git a/src/main/java/com/gitblit/git/GitDaemonService.java b/src/main/java/com/gitblit/git/GitDaemonService.java index 03c4e1cd..8dee7d0b 100644 --- a/src/main/java/com/gitblit/git/GitDaemonService.java +++ b/src/main/java/com/gitblit/git/GitDaemonService.java @@ -68,6 +68,7 @@ public abstract class GitDaemonService { GitDaemonService(final String cmdName, final String cfgName) {
command = cmdName.startsWith("git-") ? cmdName : "git-" + cmdName; //$NON-NLS-1$ //$NON-NLS-2$
configKey = new SectionParser<ServiceConfig>() {
+ @Override
public ServiceConfig parse(final Config cfg) {
return new ServiceConfig(GitDaemonService.this, cfg, cfgName);
}
diff --git a/src/main/java/com/gitblit/git/GitServlet.java b/src/main/java/com/gitblit/git/GitServlet.java index 5a401066..310d4da3 100644 --- a/src/main/java/com/gitblit/git/GitServlet.java +++ b/src/main/java/com/gitblit/git/GitServlet.java @@ -24,9 +24,9 @@ import com.gitblit.GitBlit; /**
* The GitServlet provides http/https access to Git repositories.
* Access to this servlet is protected by the GitFilter.
- *
+ *
* @author James Moger
- *
+ *
*/
public class GitServlet extends org.eclipse.jgit.http.server.GitServlet {
diff --git a/src/main/java/com/gitblit/git/GitblitReceivePack.java b/src/main/java/com/gitblit/git/GitblitReceivePack.java index 2d648bdd..090e5416 100644 --- a/src/main/java/com/gitblit/git/GitblitReceivePack.java +++ b/src/main/java/com/gitblit/git/GitblitReceivePack.java @@ -106,7 +106,7 @@ public class GitblitReceivePack extends ReceivePack implements PreReceiveHook, P setAllowCreates(user.canCreateRef(repository));
setAllowDeletes(user.canDeleteRef(repository));
setAllowNonFastForwards(user.canRewindRef(repository));
-
+
// setup pre and post receive hook
setPreReceiveHook(this);
setPostReceiveHook(this);
diff --git a/src/main/java/com/gitblit/git/GitblitUploadPackFactory.java b/src/main/java/com/gitblit/git/GitblitUploadPackFactory.java index 6c06fa3d..01dfc08b 100644 --- a/src/main/java/com/gitblit/git/GitblitUploadPackFactory.java +++ b/src/main/java/com/gitblit/git/GitblitUploadPackFactory.java @@ -36,9 +36,9 @@ import com.gitblit.models.UserModel; /** * The upload pack factory creates an upload pack which controls what refs are * advertised to cloning/pulling clients. - * + * * @author James Moger - * + * * @param <X> the connection type */ public class GitblitUploadPackFactory<X> implements UploadPackFactory<X> { @@ -51,7 +51,7 @@ public class GitblitUploadPackFactory<X> implements UploadPackFactory<X> { int timeout = 0; if (req instanceof HttpServletRequest) { - // http/https request may or may not be authenticated + // http/https request may or may not be authenticated user = GitBlit.self().authenticate((HttpServletRequest) req); if (user == null) { user = UserModel.ANONYMOUS; @@ -67,7 +67,7 @@ public class GitblitUploadPackFactory<X> implements UploadPackFactory<X> { UploadPack up = new UploadPack(db); up.setRefFilter(refFilter); up.setTimeout(timeout); - + return up; } @@ -76,13 +76,13 @@ public class GitblitUploadPackFactory<X> implements UploadPackFactory<X> { * requesting user. */ public static class UserRefFilter implements RefFilter { - + final UserModel user; - + public UserRefFilter(UserModel user) { this.user = user; } - + @Override public Map<String, Ref> filter(Map<String, Ref> refs) { if (user.canAdmin()) { diff --git a/src/main/java/com/gitblit/git/RepositoryResolver.java b/src/main/java/com/gitblit/git/RepositoryResolver.java index 21a83760..e44b153f 100644 --- a/src/main/java/com/gitblit/git/RepositoryResolver.java +++ b/src/main/java/com/gitblit/git/RepositoryResolver.java @@ -34,14 +34,14 @@ import com.gitblit.models.UserModel; /** * Resolves repositories and grants export access. - * + * * @author James Moger * */ public class RepositoryResolver<X> extends FileResolver<X> { private final Logger logger = LoggerFactory.getLogger(RepositoryResolver.class); - + public RepositoryResolver(File repositoriesFolder) { super(repositoriesFolder, true); } @@ -53,7 +53,7 @@ public class RepositoryResolver<X> extends FileResolver<X> { public Repository open(final X req, final String name) throws RepositoryNotFoundException, ServiceNotEnabledException { Repository repo = super.open(req, name); - + // Set repository name for the pack factories // We do this because the JGit API does not have a consistent way to // retrieve the repository name from the pack factories or the hooks. @@ -68,7 +68,7 @@ public class RepositoryResolver<X> extends FileResolver<X> { } return repo; } - + /** * Check if this repository can be served by the requested client connection. */ @@ -79,7 +79,7 @@ public class RepositoryResolver<X> extends FileResolver<X> { String scheme = null; UserModel user = null; String origin = null; - + if (req instanceof GitDaemonClient) { // git daemon request // this is an anonymous/unauthenticated protocol @@ -90,7 +90,7 @@ public class RepositoryResolver<X> extends FileResolver<X> { } else if (req instanceof HttpServletRequest) { // http/https request HttpServletRequest httpRequest = (HttpServletRequest) req; - scheme = httpRequest.getScheme(); + scheme = httpRequest.getScheme(); origin = httpRequest.getRemoteAddr(); user = GitBlit.self().authenticate(httpRequest); if (user == null) { @@ -104,7 +104,7 @@ public class RepositoryResolver<X> extends FileResolver<X> { scheme, repositoryName, user.username, origin)); return true; } - + // user can not access this git repo logger.warn(MessageFormat.format("{0}:// access of {1} by {2} from {3} DENIED", scheme, repositoryName, user.username, origin)); |