Skip to content

Commit

Permalink
Cleaning up warnings.
Browse files Browse the repository at this point in the history
Oliver
  • Loading branch information
Oliver Ferrigni committed Sep 10, 2010
1 parent 8f144bb commit 46a422c
Show file tree
Hide file tree
Showing 19 changed files with 20 additions and 33 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ public void run() {

Repository db = createCloneToRepo();
String remoteName = "origin";
File gitDir = new File(".git");
addRemoteConfigForRemoteGitDirectory(db, remoteName, serverPort, ".git");
FetchResult r = cloneFromRemote(db, remoteName);
System.out.println("results = " + r.getTrackingRefUpdates().size());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
package com.asolutions.scmsshd.test.integration;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Properties;

import org.apache.commons.io.FileUtils;
Expand All @@ -15,7 +13,6 @@
import org.junit.Test;
import org.spearce.jgit.lib.Ref;
import org.spearce.jgit.lib.Repository;
import org.spearce.jgit.lib.TextProgressMonitor;
import org.spearce.jgit.transport.FetchResult;

import com.asolutions.scmsshd.SCuMD;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package com.asolutions.scmsshd.authenticators;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.NamingEnumeration;
import javax.naming.NamingException;
import javax.naming.directory.Attributes;
import javax.naming.directory.InitialDirContext;
import javax.naming.directory.SearchControls;
import javax.naming.ldap.InitialLdapContext;
import javax.security.auth.login.LoginContext;
import javax.naming.directory.SearchResult;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand All @@ -34,7 +33,7 @@ public Object provide(String url, String username, String password,
//initialize counter to total the results

// Search for objects using the filter
NamingEnumeration answer = context.search(username, searchFilter, searchCtls);
NamingEnumeration<SearchResult> answer = context.search(username, searchFilter, searchCtls);
return (answer.next());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public Object authenticate(String username, String password, ServerSession sessi
return null;
}

public void setAuthenticators(ArrayList authList) {
public void setAuthenticators(ArrayList<IPasswordAuthenticator> authList) {
this.authList = authList;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public AuthorizationLevel userIsAuthorizedForProject(String username, String pro
return null;
}

public void setProjectAuthorizers(ArrayList authList) {
public void setProjectAuthorizers(ArrayList<IProjectAuthorizer> authList) {
this.authList = authList;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

public class BadCommandException extends Exception {

private static final long serialVersionUID = 4904880805323643780L;

public BadCommandException(String reason) {
super(reason);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ protected void runCommand(FilteredCommand filteredCommand,
ReceivePack rp = receivePackProvider.provide(repo);

rp.receive(inputStream, outputStream, errorStream);
int i = 0;
}
catch (IOException e){
log.error("rp caught ioe: ", e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import com.asolutions.scmsshd.authorizors.AuthorizationLevel;
import com.asolutions.scmsshd.commands.FilteredCommand;
import com.asolutions.scmsshd.commands.handlers.ISCMCommandHandler;
import com.asolutions.scmsshd.exceptions.MustHaveWritePrivilagesToPushFailure;

public class GitSCMCommandHandler implements ISCMCommandHandler {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

public class Failure extends RuntimeException {

private static final long serialVersionUID = 5704607166844629700L;
private int resultCode;
private final String genericError;
private final String specifics;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

public class MustHaveWritePrivilagesToPushFailure extends Failure{

private static final long serialVersionUID = 7650486977318806435L;

public MustHaveWritePrivilagesToPushFailure(String specifics) {
super(0, "You must have write privilages to be able to push", specifics);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@

public class MustCallIsValidUserFirstException extends RuntimeException {

private static final long serialVersionUID = 4644966710914857550L;

}
7 changes: 0 additions & 7 deletions src/main/java/com/asolutions/scmsshd/sshd/SCMCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import java.io.InputStream;
import java.io.OutputStream;

import java.util.logging.Level;
import org.apache.sshd.server.CommandFactory.Command;
import org.apache.sshd.server.CommandFactory.ExitCallback;
import org.apache.sshd.server.CommandFactory.SessionAware;
Expand All @@ -20,8 +19,6 @@ public class SCMCommand implements Command, SessionAware {

private final String command;
private final String project;
private ServerSession session;
private final IProjectAuthorizer projectAuthorizer;

private OutputStream err;
private ExitCallback callback;
Expand All @@ -32,7 +29,6 @@ public SCMCommand(String command, String argument,
IProjectAuthorizer projectAuthorizer) {
this.command = "/usr/local/bin/" + command;
this.project = "/var/git" + argument.replaceAll("'", "");
this.projectAuthorizer = projectAuthorizer;
}

public void setErrorStream(OutputStream err) {
Expand Down Expand Up @@ -65,7 +61,6 @@ public void run() {
}

private void runImp() {
int rc = 0;
try {
try {
execute();
Expand All @@ -88,7 +83,6 @@ private void runImp() {
}

private void execute() throws IOException {
String commandAry[] = { command, project };
String string = command + " " + project;
log.debug("Creating Process: {}", string);
System.out.println("Creating Process: " + string);
Expand All @@ -101,7 +95,6 @@ private void execute() throws IOException {
}

public void setSession(ServerSession session) {
this.session = session;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

public class UnparsableProjectException extends Exception {

private static final long serialVersionUID = 643951700141491862L;

public UnparsableProjectException(String reason) {
super(reason);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public void testPassIfAnyPass() throws Exception {
}});

PassIfAnyInCollectionPassAuthenticator auth = new PassIfAnyInCollectionPassAuthenticator();
ArrayList authList = new ArrayList();
ArrayList<IPasswordAuthenticator> authList = new ArrayList<IPasswordAuthenticator>();
authList.add(failsAuth);
authList.add(passesAuth);
authList.add(failsAuth);
Expand All @@ -57,7 +57,7 @@ public void testFailIfNonePass() throws Exception {
}});

PassIfAnyInCollectionPassAuthenticator auth = new PassIfAnyInCollectionPassAuthenticator();
ArrayList authList = new ArrayList();
ArrayList<IPasswordAuthenticator> authList = new ArrayList<IPasswordAuthenticator>();
authList.add(failsAuth);
authList.add(failsAuth);
auth.setAuthenticators(authList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public void testIfAnyPassItPasses() throws Exception {
}});

PassIfAnyInCollectionPassAuthorizor auth = new PassIfAnyInCollectionPassAuthorizor();
ArrayList authList = new ArrayList();
ArrayList<IProjectAuthorizer> authList = new ArrayList<IProjectAuthorizer>();
authList.add(failsAuth);
authList.add(passesAuth);
authList.add(failsAuth);
Expand All @@ -51,7 +51,7 @@ public void testIfNonePassItFails() throws Exception {
}});

PassIfAnyInCollectionPassAuthorizor auth = new PassIfAnyInCollectionPassAuthorizor();
ArrayList authList = new ArrayList();
ArrayList<IProjectAuthorizer> authList = new ArrayList<IProjectAuthorizer>();
authList.add(failsAuth);
authList.add(failsAuth);
auth.setProjectAuthorizers(authList);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,9 @@ public void testThrowsExceptionIfWrongAccessLevel() throws Exception {

final GitSCMRepositoryProvider mockRepoProvider = context
.mock(GitSCMRepositoryProvider.class);
final Repository mockRepoistory = context.mock(Repository.class);
final File base = new File(pathtobasedir);
final GitReceivePackProvider mockReceivePackProvider = context
.mock(GitReceivePackProvider.class);
final ReceivePack mockUploadPack = context.mock(ReceivePack.class);

final Properties mockConfig = context.mock(Properties.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
import com.asolutions.scmsshd.authorizors.AuthorizationLevel;
import com.asolutions.scmsshd.commands.FilteredCommand;
import com.asolutions.scmsshd.commands.handlers.ISCMCommandHandler;
import com.asolutions.scmsshd.exceptions.Failure;
import com.asolutions.scmsshd.exceptions.MustHaveWritePrivilagesToPushFailure;

import static org.junit.Assert.*;

public class GitSCMCommandHandlerTest extends MockTestCase {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
package com.asolutions.scmsshd.commands.git;

import static org.junit.Assert.assertEquals;

import java.util.Properties;

import org.junit.Test;
import org.spearce.jgit.util.QuotedString.GitPathStyle;

import static org.junit.Assert.*;

import com.asolutions.MockTestCase;
import com.asolutions.scmsshd.commands.FilteredCommand;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import com.asolutions.scmsshd.authorizors.AuthorizationLevel;
import com.asolutions.scmsshd.commands.FilteredCommand;
import com.asolutions.scmsshd.commands.factories.GitSCMCommandFactory;
import com.asolutions.scmsshd.commands.handlers.ISCMCommandHandler;

public class GitUploadPackSCMCommandHandlerTest extends MockTestCase {

Expand Down

1 comment on commit 46a422c

@gaffo
Copy link

@gaffo gaffo commented on 46a422c Sep 10, 2010

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks Good

Please sign in to comment.