dion 02/05/27 06:49:42
Modified: src/java/org/apache/maven/java DepVisitor.java
src/java/org/apache/maven/util AsyncStreamReader.java
JarUtil.java HttpUtils.java
Log:
More checkstyle fixes
Revision Changes Path
1.5 +10 -2
jakarta-turbine-maven/src/java/org/apache/maven/java/DepVisitor.java
Index: DepVisitor.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/java/DepVisitor.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- DepVisitor.java 27 May 2002 12:48:03 -0000 1.4
+++ DepVisitor.java 27 May 2002 13:49:42 -0000 1.5
@@ -3,7 +3,7 @@
/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2002 The Apache Software Foundation. All rights
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -52,6 +52,8 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
+ *
+ * ====================================================================
*/
import java.util.ArrayList;
@@ -108,10 +110,16 @@
return data;
}
+ /** handle the package declaration by adding the package name to the
+ * list of package statements
+ * @param node the package declaration node being visited
+ * @param data 'user' data returned from processing the node
+ * @returns the result of processing the child nodes
+ */
public Object visit(ASTPackageDeclaration node, Object data)
{
Token t = node.getFirstToken().next;
- packageStatements.add(node.literal(t,";"));
+ packageStatements.add(node.literal(t, ";"));
data = node.childrenAccept(this, data);
return data;
1.2 +7 -4
jakarta-turbine-maven/src/java/org/apache/maven/util/AsyncStreamReader.java
Index: AsyncStreamReader.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/util/AsyncStreamReader.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- AsyncStreamReader.java 5 Apr 2002 05:21:06 -0000 1.1
+++ AsyncStreamReader.java 27 May 2002 13:49:42 -0000 1.2
@@ -52,7 +52,10 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
+ *
+ * ====================================================================
*/
+
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
@@ -63,14 +66,14 @@
* provide the output as a String
*
* @author <a href="mailto:[EMAIL PROTECTED]">dIon Gillard</a>
- * @version $Id: AsyncStreamReader.java,v 1.1 2002/04/05 05:21:06 dion Exp $
+ * @version $Id: AsyncStreamReader.java,v 1.2 2002/05/27 13:49:42 dion Exp $
*/
public class AsyncStreamReader extends Thread
{
/** buffer to dump output to */
- StringBuffer streamBuffer = new StringBuffer();
+ private StringBuffer streamBuffer = new StringBuffer();
/** stream to read from */
- BufferedReader stream;
+ private BufferedReader stream;
/**
* Create a reader to process the provided stream
@@ -82,7 +85,7 @@
{
throw new NullPointerException("input stream parameter is null");
}
- stream = new BufferedReader( new InputStreamReader(anInputStream) );
+ stream = new BufferedReader(new InputStreamReader(anInputStream));
}
/**
1.2 +13 -8
jakarta-turbine-maven/src/java/org/apache/maven/util/JarUtil.java
Index: JarUtil.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/util/JarUtil.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- JarUtil.java 3 Mar 2002 02:53:29 -0000 1.1
+++ JarUtil.java 27 May 2002 13:49:42 -0000 1.2
@@ -52,14 +52,13 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
+ *
+ * ====================================================================
*/
-import java.io.File;
-
import java.util.Enumeration;
import java.util.List;
import java.util.ArrayList;
-
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
@@ -67,19 +66,25 @@
* A little JAR utility class.
*
* @author <a href="mailto:[EMAIL PROTECTED]">Dave Bryson</a>
- * @version $Id: JarUtil.java,v 1.1 2002/03/03 02:53:29 jvanzyl Exp $
+ * @author dion
+ * @version $Id: JarUtil.java,v 1.2 2002/05/27 13:49:42 dion Exp $
*/
public class JarUtil
{
- public static List getClassEntries(JarFile jarFile)
- throws Exception
+ /** retrieve all entries in the jar that end in .class
+ * @param jarFile the jar file to search for classes
+ * @return a list of {@link JarEntry jar entries}
+ * @throws Exception if any error occurs
+ * FIXME: throwing Exception is lazy
+ */
+ public static List getClassEntries(JarFile jarFile) throws Exception
{
List entries = new ArrayList();
Enumeration all = jarFile.entries();
- while ( all.hasMoreElements() )
+ while (all.hasMoreElements())
{
- JarEntry je = (JarEntry)all.nextElement();
+ JarEntry je = (JarEntry) all.nextElement();
String name = je.getName();
if (name.endsWith(".class"))
1.3 +54 -37
jakarta-turbine-maven/src/java/org/apache/maven/util/HttpUtils.java
Index: HttpUtils.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-maven/src/java/org/apache/maven/util/HttpUtils.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- HttpUtils.java 3 May 2002 06:03:26 -0000 1.2
+++ HttpUtils.java 27 May 2002 13:49:42 -0000 1.3
@@ -1,9 +1,9 @@
package org.apache.maven.util;
-/*
+/* ====================================================================
* The Apache Software License, Version 1.1
*
- * Copyright (c) 2000-2001 The Apache Software Foundation. All rights
+ * Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -18,21 +18,21 @@
* the documentation and/or other materials provided with the
* distribution.
*
- * 3. The end-user documentation included with the redistribution, if
- * any, must include the following acknowlegement:
+ * 3. The end-user documentation included with the redistribution,
+ * if any, must include the following acknowledgment:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
- * Alternately, this acknowlegement may appear in the software itself,
- * if and wherever such third-party acknowlegements normally appear.
+ * Alternately, this acknowledgment may appear in the software itself,
+ * if and wherever such third-party acknowledgments normally appear.
*
- * 4. The names "The Jakarta Project", "Ant", and "Apache Software
- * Foundation" must not be used to endorse or promote products derived
- * from this software without prior written permission. For written
- * permission, please contact [EMAIL PROTECTED]
- *
- * 5. Products derived from this software may not be called "Apache"
- * nor may "Apache" appear in their names without prior written
- * permission of the Apache Group.
+ * 4. The names "Apache" and "Apache Software Foundation" and
+ * "Apache Maven" must not be used to endorse or promote products
+ * derived from this software without prior written permission. For
+ * written permission, please contact [EMAIL PROTECTED]
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ * "Apache Maven", nor may "Apache" appear in their name, without
+ * prior written permission of the Apache Software Foundation.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
@@ -52,13 +52,13 @@
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
+ *
+ * ====================================================================
*/
-import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
-import java.io.FileReader;
import java.io.InputStream;
import java.io.IOException;
@@ -67,11 +67,6 @@
import java.net.HttpURLConnection;
import java.util.Date;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.HashMap;
/**
* Http utils for retrieving files.
@@ -85,10 +80,21 @@
/**
* Retrieve a remote file. Returns true if the file was successfully
* retrieved or if it is up to date (when the useTimestamp flag is set).
+ * @param source the {@link URL} of the file to retrieve
+ * @param destinationFile where to store it
+ * @param file <strong>doesn't appear to be used</strong>
+ * @param verbose the amount of logging to be displayed
+ * @param ignoreErrors whether to ignore errors during I/O or throw an
+ * exception when they happen
+ * @param useTimestamp whether to check the modified timestamp on the
+ * <code>destinationFile</code> against the remote <code>source</code>
+ * @param uname the user name to use for basic authentication
+ * @param pword the password to use for basic authentication
+ * @return true if the retrieval succeeded, false otherwise
*/
public static boolean getFile(URL source, File destinationFile, String file,
- boolean verbose, boolean ignoreErrors, boolean
useTimestamp,
- String uname, String pword)
+ boolean verbose, boolean ignoreErrors, boolean useTimestamp,
+ String uname, String pword)
{
boolean retrievedFile = false;
try
@@ -138,7 +144,8 @@
// auth and we will eventually move over httpclient
// in the commons.
}
- connection.setRequestProperty("Authorization", "Basic " + encoding);
+ connection.setRequestProperty("Authorization", "Basic " +
+ encoding);
}
//connect to the remote site (may take some time)
@@ -146,8 +153,10 @@
//next test for a 304 result (HTTP only)
if (connection instanceof HttpURLConnection)
{
- HttpURLConnection httpConnection = (HttpURLConnection) connection;
- if (httpConnection.getResponseCode() ==
HttpURLConnection.HTTP_NOT_MODIFIED)
+ HttpURLConnection httpConnection = (HttpURLConnection)
+ connection;
+ if (httpConnection.getResponseCode() ==
+ HttpURLConnection.HTTP_NOT_MODIFIED)
{
//not modified so no file download. just return instead
//and trace out something so the user doesn't think that the
@@ -156,16 +165,19 @@
return true;
}
// test for 401 result (HTTP only)
- if (httpConnection.getResponseCode() ==
HttpURLConnection.HTTP_UNAUTHORIZED)
+ if (httpConnection.getResponseCode() ==
+ HttpURLConnection.HTTP_UNAUTHORIZED)
{
- logx("Not authorized - check " + destinationFile + " for
details");
+ logx("Not authorized - check " + destinationFile +
+ " for details");
return false;
}
}
- //REVISIT: at this point even non HTTP connections may support the
if-modified-since
- //behaviour -we just check the date of the content and skip the write
if it is not
- //newer. Some protocols (FTP) dont include dates, of course.
+ // REVISIT: at this point even non HTTP connections may support the
+ // if-modified-since behaviour - we just check the date of the
+ // content and skip the write if it is not newer.
+ // Some protocols (FTP) dont include dates, of course.
FileOutputStream fos = new FileOutputStream(destinationFile);
logx("Writing " + destinationFile);
@@ -207,8 +219,9 @@
fos.close();
is.close();
- //if (and only if) the use file time option is set, then the
- //saved file now has its timestamp set to that of the downloaded file
+ // if (and only if) the use file time option is set, then the
+ // saved file now has its timestamp set to that of the downloaded
+ // file
if (useTimestamp)
{
long remoteTimestamp = connection.getLastModified();
@@ -216,7 +229,8 @@
{
Date t = new Date(remoteTimestamp);
logx("last modified = " + t.toString() +
- ((remoteTimestamp == 0) ? " - using current time instead" :
""));
+ ((remoteTimestamp == 0) ?
+ " - using current time instead" : ""));
}
if (remoteTimestamp != 0)
{
@@ -228,7 +242,7 @@
}
catch (FileNotFoundException fnfe)
{
- logx( "Error getting " + source + " ; it does not exist." );
+ logx("Error getting " + source + " ; it does not exist.");
}
catch (Exception e)
{
@@ -243,7 +257,7 @@
/**
* set the timestamp of a named file to a specified time.
*
- * @param file
+ * @param file the file to touch
* @param timemillis in milliseconds since the start of the era
* @return true if it succeeded. False means that this is a java1.1 system
* and that file times can not be set
@@ -268,7 +282,10 @@
return true;
}
- // We need to move to the commons-logging goodies here.
+ /** We need to move to the commons-logging goodies here.
+ * Log a message to System.out
+ * @param message the message to log
+ */
private static void logx(String message)
{
System.out.println(message);
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>