You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by di...@apache.org on 2003/10/28 19:18:26 UTC
cvs commit: maven/src/plugins-build/changelog/src/main/org/apache/maven/cvslib CvsConnection.java
dion 2003/10/28 10:18:26
Modified: src/plugins-build/changelog/src/main/org/apache/maven/cvslib
CvsConnection.java
Log:
Style
Revision Changes Path
1.2 +50 -58 maven/src/plugins-build/changelog/src/main/org/apache/maven/cvslib/CvsConnection.java
Index: CvsConnection.java
===================================================================
RCS file: /home/cvs/maven/src/plugins-build/changelog/src/main/org/apache/maven/cvslib/CvsConnection.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CvsConnection.java 25 Oct 2003 18:33:14 -0000 1.1
+++ CvsConnection.java 28 Oct 2003 18:18:26 -0000 1.2
@@ -80,7 +80,7 @@
/**
* A Cvs connection that simulates a command line interface.
- *
+ *
* @author <a href="mailto:epugh@upstate.com">Eric Pugh</a>
*/
public class CvsConnection
@@ -90,37 +90,37 @@
private static final Log LOG =
LogFactory.getLog(CvsConnection.class);
/**
- * The path to the repository on the server
- */
+ * The path to the repository on the server
+ */
private String repository;
/**
- * The local path to use to perform operations (the top level)
- */
+ * The local path to use to perform operations (the top level)
+ */
private String localPath;
/**
- * The connection to the server
- */
+ * The connection to the server
+ */
private Connection connection;
/**
- * The client that manages interactions with the server
- */
+ * The client that manages interactions with the server
+ */
private Client client;
/**
- * The global options being used. GlobalOptions are only global for a
- * particular command.
- */
+ * The global options being used. GlobalOptions are only global for a
+ * particular command.
+ */
private GlobalOptions globalOptions;
/**
- * Execute a configured CVS command
- *
- * @param command the command to execute
- * @throws CommandException if there is an error running the command
- */
+ * Execute a configured CVS command
+ *
+ * @param command the command to execute
+ * @throws CommandException if there is an error running the command
+ */
public void executeCommand(Command command)
throws CommandException, AuthenticationException
{
@@ -143,8 +143,8 @@
}
/**
- * Creates the connection and the client and connects.
- */
+ * Creates the connection and the client and connects.
+ */
private void connect(CVSRoot root, String password)
throws IllegalArgumentException, AuthenticationException
{
@@ -170,11 +170,11 @@
/**
- * Obtain the CVS root, either from the -D option cvs.root or from the CVS
- * directory
- *
- * @return the CVSRoot string
- */
+ * Obtain the CVS root, either from the -D option cvs.root or from the CVS
+ * directory
+ *
+ * @return the CVSRoot string
+ */
private static String getCVSRoot(String workingDir)
{
String root = null;
@@ -202,7 +202,9 @@
try
{
if (r != null)
+ {
r.close();
+ }
}
catch (IOException e)
{
@@ -217,12 +219,12 @@
}
/**
- * Process global options passed into the application
- *
- * @param args the argument list, complete
- * @param globalOptions the global options structure that will be passed to
- * the command
- */
+ * Process global options passed into the application
+ *
+ * @param args the argument list, complete
+ * @param globalOptions the global options structure that will be passed to
+ * the command
+ */
private static int processGlobalOptions(
String[] args,
GlobalOptions globalOptions)
@@ -234,7 +236,7 @@
while ((ch = go.getopt()) != GetOpt.optEOF)
{
//System.out.println("Global option '"+((char) ch)+"',
- // '"+go.optArgGet()+"'");
+ // '"+go.optArgGet()+"'");
boolean success =
globalOptions.setCVSCommand((char) ch, go.optArgGet());
if (!success)
@@ -245,13 +247,13 @@
}
/**
- * Lookup the password in the .cvspass file. This file is looked for in the
- * user.home directory if the option cvs.passfile is not set
- *
- * @param CVSRoot the CVS root for which the password is being searched
- * @return the password, scrambled
- */
- private static String lookupPassword(String CVSRoot)
+ * Lookup the password in the .cvspass file. This file is looked for in the
+ * user.home directory if the option cvs.passfile is not set
+ *
+ * @param CVSRoot the CVS root for which the password is being searched
+ * @return the password, scrambled
+ */
+ private static String lookupPassword(String cvsRoot)
{
File passFile =
new File(
@@ -268,9 +270,9 @@
String line;
while ((line = reader.readLine()) != null)
{
- if (line.startsWith(CVSRoot))
+ if (line.startsWith(cvsRoot))
{
- password = line.substring(CVSRoot.length() + 1);
+ password = line.substring(cvsRoot.length() + 1);
break;
}
}
@@ -297,20 +299,18 @@
if (password == null)
{
LOG.error(
- "Didn't find password for CVSROOT '" + CVSRoot + "'.");
+ "Didn't find password for CVSROOT '" + cvsRoot + "'.");
}
return password;
}
/**
- * Process the CVS command passed in args[] array with all necessary
- * options. The only difference from main() method is, that this method
- * does not exit the JVM and provides command output.
- *
- * @param args The command with options
- * @param files The files to execute the command on.
- * @param stdout The standard output of the command
- */
+ * Process the CVS command passed in args[] array with all necessary
+ * options. The only difference from main() method is, that this method
+ * does not exit the JVM and provides command output.
+ *
+ * @param args The command with options
+ */
public static boolean processCommand(
String[] args,
String localPath,
@@ -326,10 +326,10 @@
// Set up any global options specified. These occur before the
// name of the command to run
int commandIndex = -1;
+
try
{
commandIndex = processGlobalOptions(args, globalOptions);
-
}
catch (IllegalArgumentException e)
{
@@ -418,21 +418,13 @@
try
{
cvsCommand.connect(root, password);
-
-
cvsCommand.addListener(listener);
cvsCommand.executeCommand(c);
-
}
catch (Exception t)
{
LOG.error("Error: " + t,t);
-
return false;
- }
- finally
- {
-
}
return true;
}
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org