Some general style changes, javadoc comments, removed c++ style variable names, changed HTML to use lowercase <font> instead of <FONT> etc

Sorry no unit tests

Kev
Index: CVSEntry.java
===================================================================
RCS file: 
/home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/cvslib/CVSEntry.java,v
retrieving revision 1.12
diff -u -r1.12 CVSEntry.java
--- CVSEntry.java       9 Mar 2004 16:48:14 -0000       1.12
+++ CVSEntry.java       6 Dec 2004 10:16:39 -0000
@@ -24,46 +24,86 @@
  *
  * @version $Revision: 1.12 $ $Date: 2004/03/09 16:48:14 $
  */
-class CVSEntry {
-    private Date m_date;
-    private String m_author;
-    private final String m_comment;
-    private final Vector m_files = new Vector();
-
-    public CVSEntry(Date date, String author, String comment) {
-        m_date = date;
-        m_author = author;
-        m_comment = comment;
-    }
-
-    public void addFile(String file, String revision) {
-        m_files.addElement(new RCSFile(file, revision));
-    }
-
-    public void addFile(String file, String revision, String previousRevision) 
{
-        m_files.addElement(new RCSFile(file, revision, previousRevision));
-    }
-
-    Date getDate() {
-        return m_date;
-    }
-
-    void setAuthor(final String author) {
-        m_author = author;
-    }
-
-    String getAuthor() {
-        return m_author;
-    }
-
-    String getComment() {
-        return m_comment;
-    }
-
-    Vector getFiles() {
-        return m_files;
-    }
-
+public class CVSEntry {
+    private Date date;
+    private String author;
+    private final String comment;
+    private final Vector files = new Vector();
+
+    /**
+     * Creates a new instance of a CVSEntry
+     * @param date the date
+     * @param author the author
+     * @param comment a comment to be added to the revision
+     */
+    public CVSEntry(final Date date, final String author, final String 
comment) {
+        this.date = date;
+        this.author = author;
+        this.comment = comment;
+    }
+
+    /**
+     * Adds a file to the CVSEntry
+     * @param file the file to add
+     * @param revision the revision
+     */
+    public void addFile(final String file, final String revision) {
+        files.addElement(new RCSFile(file, revision));
+    }
+
+    /**
+     * Adds a file to the CVSEntry
+     * @param file the file to add
+     * @param revision the revision
+     * @param previousRevision the previous revision
+     */
+    public void addFile(final String file, final String revision, final String 
previousRevision) {
+        files.addElement(new RCSFile(file, revision, previousRevision));
+    }
+
+    /**
+     * Gets the date of the CVSEntry
+     * @return the date
+     */
+    public Date getDate() {
+        return date;
+    }
+
+    /**
+     * Sets the author of the CVSEntry
+     * @param author the author
+     */
+    public void setAuthor(final String author) {
+        this.author = author;
+    }
+
+    /**
+     * Gets the author of the CVSEntry
+     * @return the author
+     */
+    public String getAuthor() {
+        return author;
+    }
+
+    /**
+     * Gets the comment for the CVSEntry
+     * @return the comment
+     */
+    public String getComment() {
+        return comment;
+    }
+
+    /**
+     * Gets the files in this CVSEntry
+     * @return the files
+     */
+    public Vector getFiles() {
+        return files;
+    }
+
+    /**
+     * Gets a String containing author, date, files and comment 
+     */
     public String toString() {
         return getAuthor() + "\n" + getDate() + "\n" + getFiles() + "\n"
             + getComment();
Index: ChangeLogParser.java
===================================================================
RCS file: 
/home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogParser.java,v
retrieving revision 1.27
diff -u -r1.27 ChangeLogParser.java
--- ChangeLogParser.java        9 Mar 2004 16:48:14 -0000       1.27
+++ ChangeLogParser.java        6 Dec 2004 10:16:39 -0000
@@ -37,35 +37,35 @@
     private static final int GET_PREVIOUS_REV = 5;
 
     /** input format for dates read in from cvs log */
-    private static final SimpleDateFormat c_inputDate
+    private static final SimpleDateFormat inputDate
         = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
 
     static {
         TimeZone utc = TimeZone.getTimeZone("UTC");
-        c_inputDate.setTimeZone(utc);
+        inputDate.setTimeZone(utc);
     }
 
     //The following is data used while processing stdout of CVS command
-    private String m_file;
-    private String m_date;
-    private String m_author;
-    private String m_comment;
-    private String m_revision;
-    private String m_previousRevision;
+    private String file;
+    private String date;
+    private String author;
+    private String comment;
+    private String revision;
+    private String previousRevision;
 
-    private int m_status = GET_FILE;
+    private int status = GET_FILE;
 
     /** rcs entries */
-    private final Hashtable m_entries = new Hashtable();
+    private final Hashtable entries = new Hashtable();
 
     /**
      * Get a list of rcs entries as an array.
      *
      * @return a list of rcs entries as an array
      */
-    CVSEntry[] getEntrySetAsArray() {
-        final CVSEntry[] array = new CVSEntry[ m_entries.size() ];
-        Enumeration e = m_entries.elements();
+    public CVSEntry[] getEntrySetAsArray() {
+        final CVSEntry[] array = new CVSEntry[ entries.size() ];
+        Enumeration e = entries.elements();
         int i = 0;
         while (e.hasMoreElements()) {
             array[i++] = (CVSEntry) e.nextElement();
@@ -76,9 +76,10 @@
     /**
      * Receive notification about the process writing
      * to standard output.
+     * @param line the line to process
      */
     public void stdout(final String line) {
-        switch(m_status) {
+        switch(status) {
             case GET_FILE:
                 // make sure attributes are reset when
                 // working on a 'new' file.
@@ -114,110 +115,110 @@
             //We have ended changelog for that particular file
             //so we can save it
             final int end
-                = m_comment.length() - lineSeparator.length(); //was -1
-            m_comment = m_comment.substring(0, end);
+                = comment.length() - lineSeparator.length(); //was -1
+            comment = comment.substring(0, end);
             saveEntry();
-            m_status = GET_FILE;
+            status = GET_FILE;
         } else if (line.equals("----------------------------")) {
             final int end
-                = m_comment.length() - lineSeparator.length(); //was -1
-            m_comment = m_comment.substring(0, end);
-            m_status = GET_PREVIOUS_REV;
+                = comment.length() - lineSeparator.length(); //was -1
+            comment = comment.substring(0, end);
+            status = GET_PREVIOUS_REV;
         } else {
-            m_comment += line + lineSeparator;
+            comment += line + lineSeparator;
         }
     }
 
     /**
      * Process a line while in "GET_FILE" state.
      *
-     * @param line the line
+     * @param line the line to process
      */
     private void processFile(final String line) {
         if (line.startsWith("Working file:")) {
-            m_file = line.substring(14, line.length());
-            m_status = GET_REVISION;
+            file = line.substring(14, line.length());
+            status = GET_REVISION;
         }
     }
 
     /**
      * Process a line while in "REVISION" state.
      *
-     * @param line the line
+     * @param line the line to process
      */
     private void processRevision(final String line) {
         if (line.startsWith("revision")) {
-            m_revision = line.substring(9);
-            m_status = GET_DATE;
+            revision = line.substring(9);
+            status = GET_DATE;
         } else if (line.startsWith("======")) {
             //There was no revisions in this changelog
             //entry so lets move unto next file
-            m_status = GET_FILE;
+            status = GET_FILE;
         }
     }
 
     /**
      * Process a line while in "DATE" state.
      *
-     * @param line the line
+     * @param line the line to process
      */
     private void processDate(final String line) {
         if (line.startsWith("date:")) {
-            m_date = line.substring(6, 25);
+            date = line.substring(6, 25);
             String lineData = line.substring(line.indexOf(";") + 1);
-            m_author = lineData.substring(10, lineData.indexOf(";"));
+            author = lineData.substring(10, lineData.indexOf(";"));
 
-            m_status = GET_COMMENT;
+            status = GET_COMMENT;
 
             //Reset comment to empty here as we can accumulate multiple lines
             //in the processComment method
-            m_comment = "";
+            comment = "";
         }
     }
 
     /**
      * Process a line while in "GET_PREVIOUS_REVISION" state.
      *
-     * @param line the line
+     * @param line the line to process
      */
     private void processGetPreviousRevision(final String line) {
         if (!line.startsWith("revision")) {
             throw new IllegalStateException("Unexpected line from CVS: "
                 + line);
         }
-        m_previousRevision = line.substring(9);
+        previousRevision = line.substring(9);
 
         saveEntry();
 
-        m_revision = m_previousRevision;
-        m_status = GET_DATE;
+        revision = previousRevision;
+        status = GET_DATE;
     }
 
     /**
      * Utility method that saves the current entry.
      */
     private void saveEntry() {
-        final String entryKey = m_date + m_author + m_comment;
+        final String entryKey = date + author + comment;
         CVSEntry entry;
-        if (!m_entries.containsKey(entryKey)) {
-            entry = new CVSEntry(parseDate(m_date), m_author, m_comment);
-            m_entries.put(entryKey, entry);
+        if (!entries.containsKey(entryKey)) {
+            entry = new CVSEntry(parseDate(date), author, comment);
+            entries.put(entryKey, entry);
         } else {
-            entry = (CVSEntry) m_entries.get(entryKey);
+            entry = (CVSEntry) entries.get(entryKey);
         }
 
-        entry.addFile(m_file, m_revision, m_previousRevision);
+        entry.addFile(file, revision, previousRevision);
     }
 
     /**
      * Parse date out from expected format.
      *
-     * @param date the string holding dat
+     * @param date the string holding date
      * @return the date object or null if unknown date format
      */
     private Date parseDate(final String date) {
         try {
-            return c_inputDate.parse(date);
+            return inputDate.parse(date);
         } catch (ParseException e) {
             //final String message = REZ.getString( 
"changelog.bat-date.error", date );
             //getContext().error( message );
@@ -226,15 +227,14 @@
     }
 
     /**
-     * reset all internal attributes except status.
+     * Reset all internal attributes except status.
      */
-    private void reset() {
-        m_file = null;
-        m_date = null;
-        m_author = null;
-        m_comment = null;
-        m_revision = null;
-        m_previousRevision = null;
+    public void reset() {
+        this.file = null;
+        this.date = null;
+        this.author = null;
+        this.comment = null;
+        this.revision = null;
+        this.previousRevision = null;
     }
-
 }
Index: ChangeLogTask.java
===================================================================
RCS file: 
/home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogTask.java,v
retrieving revision 1.30
diff -u -r1.30 ChangeLogTask.java
--- ChangeLogTask.java  9 Mar 2004 16:48:14 -0000       1.30
+++ ChangeLogTask.java  6 Dec 2004 10:16:39 -0000
@@ -31,35 +31,34 @@
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.DirectoryScanner;
 import org.apache.tools.ant.Project;
-import org.apache.tools.ant.taskdefs.Execute;
 import org.apache.tools.ant.taskdefs.AbstractCvsTask;
-import org.apache.tools.ant.types.Commandline;
 import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.util.FileUtils;
 
 /**
  * Examines the output of cvs log and group related changes together.
  *
  * It produces an XML output representing the list of changes.
- * <PRE>
- * <FONT color=#0000ff>&lt;!-- Root element --&gt;</FONT>
- * <FONT color=#6a5acd>&lt;!ELEMENT</FONT> changelog <FONT 
color=#ff00ff>(entry</FONT><FONT color=#ff00ff>+</FONT><FONT 
color=#ff00ff>)</FONT><FONT color=#6a5acd>&gt;</FONT>
- * <FONT color=#0000ff>&lt;!-- CVS Entry --&gt;</FONT>
- * <FONT color=#6a5acd>&lt;!ELEMENT</FONT> entry <FONT 
color=#ff00ff>(date,author,file</FONT><FONT color=#ff00ff>+</FONT><FONT 
color=#ff00ff>,msg)</FONT><FONT color=#6a5acd>&gt;</FONT>
- * <FONT color=#0000ff>&lt;!-- Date of cvs entry --&gt;</FONT>
- * <FONT color=#6a5acd>&lt;!ELEMENT</FONT> date <FONT 
color=#ff00ff>(#PCDATA)</FONT><FONT color=#6a5acd>&gt;</FONT>
- * <FONT color=#0000ff>&lt;!-- Author of change --&gt;</FONT>
- * <FONT color=#6a5acd>&lt;!ELEMENT</FONT> author <FONT 
color=#ff00ff>(#PCDATA)</FONT><FONT color=#6a5acd>&gt;</FONT>
- * <FONT color=#0000ff>&lt;!-- List of files affected --&gt;</FONT>
- * <FONT color=#6a5acd>&lt;!ELEMENT</FONT> msg <FONT 
color=#ff00ff>(#PCDATA)</FONT><FONT color=#6a5acd>&gt;</FONT>
- * <FONT color=#0000ff>&lt;!-- File changed --&gt;</FONT>
- * <FONT color=#6a5acd>&lt;!ELEMENT</FONT> file <FONT 
color=#ff00ff>(name,revision,prevrevision</FONT><FONT 
color=#ff00ff>?</FONT><FONT color=#ff00ff>)</FONT><FONT 
color=#6a5acd>&gt;</FONT>
- * <FONT color=#0000ff>&lt;!-- Name of the file --&gt;</FONT>
- * <FONT color=#6a5acd>&lt;!ELEMENT</FONT> name <FONT 
color=#ff00ff>(#PCDATA)</FONT><FONT color=#6a5acd>&gt;</FONT>
- * <FONT color=#0000ff>&lt;!-- Revision number --&gt;</FONT>
- * <FONT color=#6a5acd>&lt;!ELEMENT</FONT> revision <FONT 
color=#ff00ff>(#PCDATA)</FONT><FONT color=#6a5acd>&gt;</FONT>
- * <FONT color=#0000ff>&lt;!-- Previous revision number --&gt;</FONT>
- * <FONT color=#6a5acd>&lt;!ELEMENT</FONT> prevrevision <FONT 
color=#ff00ff>(#PCDATA)</FONT><FONT color=#6a5acd>&gt;</FONT>
- * </PRE>
+ * <pre>
+ * <font color=#0000ff>&lt;!-- Root element --&gt;</font>
+ * <font color=#6a5acd>&lt;!ELEMENT</font> changelog <font 
color=#ff00ff>(entry</font><font color=#ff00ff>+</font><font 
color=#ff00ff>)</font><font color=#6a5acd>&gt;</font>
+ * <font color=#0000ff>&lt;!-- CVS Entry --&gt;</font>
+ * <font color=#6a5acd>&lt;!ELEMENT</font> entry <font 
color=#ff00ff>(date,author,file</font><font color=#ff00ff>+</font><font 
color=#ff00ff>,msg)</font><font color=#6a5acd>&gt;</font>
+ * <font color=#0000ff>&lt;!-- Date of cvs entry --&gt;</font>
+ * <font color=#6a5acd>&lt;!ELEMENT</font> date <font 
color=#ff00ff>(#PCDATA)</font><font color=#6a5acd>&gt;</font>
+ * <font color=#0000ff>&lt;!-- Author of change --&gt;</font>
+ * <font color=#6a5acd>&lt;!ELEMENT</font> author <font 
color=#ff00ff>(#PCDATA)</font><font color=#6a5acd>&gt;</font>
+ * <font color=#0000ff>&lt;!-- List of files affected --&gt;</font>
+ * <font color=#6a5acd>&lt;!ELEMENT</font> msg <font 
color=#ff00ff>(#PCDATA)</font><font color=#6a5acd>&gt;</font>
+ * <font color=#0000ff>&lt;!-- File changed --&gt;</font>
+ * <font color=#6a5acd>&lt;!ELEMENT</font> file <font 
color=#ff00ff>(name,revision,prevrevision</font><font 
color=#ff00ff>?</font><font color=#ff00ff>)</font><font 
color=#6a5acd>&gt;</font>
+ * <font color=#0000ff>&lt;!-- Name of the file --&gt;</font>
+ * <font color=#6a5acd>&lt;!ELEMENT</font> name <font 
color=#ff00ff>(#PCDATA)</font><font color=#6a5acd>&gt;</font>
+ * <font color=#0000ff>&lt;!-- Revision number --&gt;</font>
+ * <font color=#6a5acd>&lt;!ELEMENT</font> revision <font 
color=#ff00ff>(#PCDATA)</font><font color=#6a5acd>&gt;</font>
+ * <font color=#0000ff>&lt;!-- Previous revision number --&gt;</font>
+ * <font color=#6a5acd>&lt;!ELEMENT</font> prevrevision <font 
color=#ff00ff>(#PCDATA)</font><font color=#6a5acd>&gt;</font>
+ * </pre>
  *
  * @version $Revision: 1.30 $ $Date: 2004/03/09 16:48:14 $
  * @since Ant 1.5
@@ -67,48 +66,48 @@
  */
 public class ChangeLogTask extends AbstractCvsTask {
     /** User list */
-    private File m_usersFile;
+    private File usersFile;
 
     /** User list */
-    private Vector m_cvsUsers = new Vector();
+    private Vector cvsUsers = new Vector();
 
     /** Input dir */
-    private File m_dir;
+    private File inputDir;
 
     /** Output file */
-    private File m_destfile;
+    private File destFile;
 
     /** The earliest date at which to start processing entries.  */
-    private Date m_start;
+    private Date startDate;
 
     /** The latest date at which to stop processing entries.  */
-    private Date m_stop;
+    private Date endDate;
 
     /**
      * Filesets containing list of files against which the cvs log will be
-     * performed. If empty then all files will in the working directory will
+     * performed. If empty then all files in the working directory will
      * be checked.
      */
-    private final Vector m_filesets = new Vector();
+    private final Vector filesets = new Vector();
 
 
     /**
      * Set the base dir for cvs.
      *
-     * @param dir The new dir value
+     * @param inputDir The new dir value
      */
-    public void setDir(final File dir) {
-        m_dir = dir;
+    public void setDir(final File inputDir) {
+        this.inputDir = inputDir;
     }
 
 
     /**
      * Set the output file for the log.
      *
-     * @param destfile The new destfile value
+     * @param destFile The new destfile value
      */
-    public void setDestfile(final File destfile) {
-        m_destfile = destfile;
+    public void setDestfile(final File destFile) {
+        this.destFile = destFile;
     }
 
 
@@ -118,7 +117,7 @@
      * @param usersFile The file containing the users info.
      */
     public void setUsersfile(final File usersFile) {
-        m_usersFile = usersFile;
+        this.usersFile = usersFile;
     }
 
 
@@ -128,7 +127,7 @@
      * @param user the user
      */
     public void addUser(final CvsUser user) {
-        m_cvsUsers.addElement(user);
+        cvsUsers.addElement(user);
     }
 
 
@@ -138,17 +137,17 @@
      * @param start The date at which the changelog should start.
      */
     public void setStart(final Date start) {
-        m_start = start;
+        this.startDate = start;
     }
 
 
     /**
      * Set the date at which the changelog should stop.
      *
-     * @param stop The date at which the changelog should stop.
+     * @param endDate The date at which the changelog should stop.
      */
-    public void setEnd(final Date stop) {
-        m_stop = stop;
+    public void setEnd(final Date endDate) {
+        this.endDate = endDate;
     }
 
 
@@ -171,7 +170,7 @@
      * @param fileSet a set of files about which cvs logs will be generated.
      */
     public void addFileset(final FileSet fileSet) {
-        m_filesets.addElement(fileSet);
+        filesets.addElement(fileSet);
     }
 
 
@@ -182,7 +181,7 @@
      *            cvs command
      */
     public void execute() throws BuildException {
-        File savedDir = m_dir; // may be altered in validate
+        File savedDir = inputDir; // may be altered in validate
 
         try {
 
@@ -191,15 +190,12 @@
 
             loadUserlist(userList);
 
-            for (Enumeration e = m_cvsUsers.elements();
-                e.hasMoreElements();) {
-                final CvsUser user = (CvsUser) e.nextElement();
-
+            for(int i = 0, size = cvsUsers.size(); i<size; i++) {
+                final CvsUser user = (CvsUser) cvsUsers.get(i);
                 user.validate();
                 userList.put(user.getUserID(), user.getDisplayname());
             }
 
-
             setCommand("log");
 
             if (getTag() != null) {
@@ -209,18 +205,18 @@
                 myCvsVersion.setCvsRoot(getCvsRoot());
                 myCvsVersion.setCvsRsh(getCvsRsh());
                 myCvsVersion.setPassfile(getPassFile());
-                myCvsVersion.setDest(m_dir);
+                myCvsVersion.setDest(inputDir);
                 myCvsVersion.execute();
                 if (myCvsVersion.supportsCvsLogWithSOption()) {
                     addCommandArgument("-S");
                 }
             }
-            if (null != m_start) {
+            if (null != startDate) {
                 final SimpleDateFormat outputDate =
                     new SimpleDateFormat("yyyy-MM-dd");
 
                 // We want something of the form: -d ">=YYYY-MM-dd"
-                final String dateRange = ">=" + outputDate.format(m_start);
+                final String dateRange = ">=" + outputDate.format(startDate);
 
         // Supply '-d' as a separate argument - Bug# 14397
                 addCommandArgument("-d");
@@ -228,8 +224,8 @@
             }
 
             // Check if list of files to check has been specified
-            if (!m_filesets.isEmpty()) {
-                final Enumeration e = m_filesets.elements();
+            if (!filesets.isEmpty()) {
+                final Enumeration e = filesets.elements();
 
                 while (e.hasMoreElements()) {
                     final FileSet fileSet = (FileSet) e.nextElement();
@@ -249,7 +245,7 @@
 
             log(getCommand(), Project.MSG_VERBOSE);
 
-            setDest(m_dir);
+            setDest(inputDir);
             setExecuteStreamHandler(handler);
             super.execute();
             final String errors = handler.getErrors();
@@ -266,7 +262,7 @@
             writeChangeLog(filteredEntrySet);
 
         } finally {
-            m_dir = savedDir;
+            inputDir = savedDir;
         }
     }
 
@@ -277,23 +273,23 @@
      */
     private void validate()
          throws BuildException {
-        if (null == m_dir) {
-            m_dir = getProject().getBaseDir();
+        if (null == inputDir) {
+            inputDir = getProject().getBaseDir();
         }
-        if (null == m_destfile) {
+        if (null == destFile) {
             final String message = "Destfile must be set.";
 
             throw new BuildException(message);
         }
-        if (!m_dir.exists()) {
+        if (!inputDir.exists()) {
             final String message = "Cannot find base dir "
-                 + m_dir.getAbsolutePath();
+                 + inputDir.getAbsolutePath();
 
             throw new BuildException(message);
         }
-        if (null != m_usersFile && !m_usersFile.exists()) {
+        if (null != usersFile && !usersFile.exists()) {
             final String message = "Cannot find user lookup list "
-                 + m_usersFile.getAbsolutePath();
+                 + usersFile.getAbsolutePath();
 
             throw new BuildException(message);
         }
@@ -308,9 +304,9 @@
      */
     private void loadUserlist(final Properties userList)
          throws BuildException {
-        if (null != m_usersFile) {
+        if (null != usersFile) {
             try {
-                userList.load(new FileInputStream(m_usersFile));
+                userList.load(new FileInputStream(usersFile));
             } catch (final IOException ioe) {
                 throw new BuildException(ioe.toString(), ioe);
             }
@@ -330,11 +326,11 @@
             final CVSEntry cvsEntry = entrySet[i];
             final Date date = cvsEntry.getDate();
 
-            if (null != m_start && m_start.after(date)) {
+            if (null != startDate && startDate.after(date)) {
                 //Skip dates that are too early
                 continue;
             }
-            if (null != m_stop && m_stop.before(date)) {
+            if (null != endDate && endDate.before(date)) {
                 //Skip dates that are too late
                 continue;
             }
@@ -372,7 +368,7 @@
         FileOutputStream output = null;
 
         try {
-            output = new FileOutputStream(m_destfile);
+            output = new FileOutputStream(destFile);
 
             final PrintWriter writer =
                 new PrintWriter(new OutputStreamWriter(output, "UTF-8"));
@@ -385,12 +381,7 @@
         } catch (final IOException ioe) {
             throw new BuildException(ioe.toString(), ioe);
         } finally {
-            if (null != output) {
-                try {
-                    output.close();
-                } catch (final IOException ioe) {
-                }
-            }
+            FileUtils.close(output);
         }
     }
 }
Index: ChangeLogWriter.java
===================================================================
RCS file: 
/home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/cvslib/ChangeLogWriter.java,v
retrieving revision 1.15
diff -u -r1.15 ChangeLogWriter.java
--- ChangeLogWriter.java        11 Nov 2004 17:27:09 -0000      1.15
+++ ChangeLogWriter.java        6 Dec 2004 10:16:39 -0000
@@ -26,18 +26,18 @@
  *
  * @version $Revision: 1.15 $ $Date: 2004/11/11 17:27:09 $
  */
-class ChangeLogWriter {
+public class ChangeLogWriter {
     /** output format for dates written to xml file */
-    private static final SimpleDateFormat c_outputDate
+    private static final SimpleDateFormat outputDate
         = new SimpleDateFormat("yyyy-MM-dd");
     /** output format for times written to xml file */
-    private static final SimpleDateFormat c_outputTime
+    private static final SimpleDateFormat outputTime
         = new SimpleDateFormat("HH:mm");
 
     static {
         TimeZone utc = TimeZone.getTimeZone("UTC");
-        c_outputDate.setTimeZone(utc);
-        c_outputTime.setTimeZone(utc);
+        outputDate.setTimeZone(utc);
+        outputTime.setTimeZone(utc);
     }
 
     /**
@@ -69,9 +69,9 @@
      */
     private void printEntry(final PrintWriter output, final CVSEntry entry) {
         output.println("\t<entry>");
-        output.println("\t\t<date>" + c_outputDate.format(entry.getDate())
+        output.println("\t\t<date>" + outputDate.format(entry.getDate())
             + "</date>");
-        output.println("\t\t<time>" + c_outputTime.format(entry.getDate())
+        output.println("\t\t<time>" + outputTime.format(entry.getDate())
             + "</time>");
         output.println("\t\t<author><![CDATA[" + entry.getAuthor()
             + "]]></author>");
Index: CvsTagDiff.java
===================================================================
RCS file: 
/home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/cvslib/CvsTagDiff.java,v
retrieving revision 1.23
diff -u -r1.23 CvsTagDiff.java
--- CvsTagDiff.java     9 Mar 2004 16:48:14 -0000       1.23
+++ CvsTagDiff.java     6 Dec 2004 10:16:40 -0000
@@ -36,7 +36,7 @@
  * Examines the output of cvs rdiff between two tags.
  *
  * It produces an XML output representing the list of changes.
- * <PRE>
+ * <pre>
  * &lt;!-- Root element --&gt;
  * &lt;!ELEMENT tagdiff ( entry+ ) &gt;
  * &lt;!-- Start tag of the report --&gt;
@@ -58,7 +58,7 @@
  * &lt;!ELEMENT revision ( #PCDATA ) &gt;
  * &lt;!-- Previous revision number --&gt;
  * &lt;!ELEMENT prevrevision ( #PCDATA ) &gt;
- * </PRE>
+ * </pre>
  *
  * @version $Revision: 1.23 $ $Date: 2004/03/09 16:48:14 $
  * @since Ant 1.5
@@ -95,89 +95,89 @@
     /**
      * The cvs package/module to analyse
      */
-    private String mypackage;
+    private String modulePackage;
 
     /**
      * The earliest tag from which diffs are to be included in the report.
      */
-    private String mystartTag;
+    private String startTag;
 
     /**
      * The latest tag from which diffs are to be included in the report.
      */
-    private String myendTag;
+    private String endTag;
 
     /**
      * The earliest date from which diffs are to be included in the report.
      */
-    private String mystartDate;
+    private String startDate;
 
     /**
      * The latest date from which diffs are to be included in the report.
      */
-    private String myendDate;
+    private String endDate;
 
     /**
      * The file in which to write the diff report.
      */
-    private File mydestfile;
+    private File destFile;
 
     /**
      * Used to create the temp file for cvs log
      */
-    private FileUtils myfileUtils = FileUtils.newFileUtils();
+    private FileUtils fileUtils = FileUtils.newFileUtils();
 
     /**
      * The package/module to analyze.
      * @param p the name of the package to analyse
      */
-    public void setPackage(String p) {
-        mypackage = p;
+    public void setPackage(final String p) {
+        modulePackage = p;
     }
 
     /**
      * Set the start tag.
      *
-     * @param s the start tag.
+     * @param startTag the start tag.
      */
-    public void setStartTag(String s) {
-        mystartTag = s;
+    public void setStartTag(final String startTag) {
+        this.startTag = startTag;
     }
 
     /**
      * Set the start date.
      *
-     * @param s the start date.
+     * @param startDate the start date.
      */
-    public void setStartDate(String s) {
-        mystartDate = s;
+    public void setStartDate(final String startDate) {
+        this.startDate = startDate;
     }
 
     /**
      * Set the end tag.
      *
-     * @param s the end tag.
+     * @param endTag the end tag.
      */
-    public void setEndTag(String s) {
-        myendTag = s;
+    public void setEndTag(final String endTag) {
+        this.endTag = endTag;
     }
 
     /**
      * Set the end date.
      *
-     * @param s the end date.
+     * @param endDate the end date.
      */
-    public void setEndDate(String s) {
-        myendDate = s;
+    public void setEndDate(final String endDate) {
+        this.endDate = endDate;
     }
 
     /**
      * Set the output file for the diff.
      *
-     * @param f the output file for the diff.
+     * @param destFile the output file for the diff.
      */
-    public void setDestFile(File f) {
-        mydestfile = f;
+    public void setDestFile(final File destFile) {
+        this.destFile = destFile;
     }
 
     /**
@@ -192,30 +192,30 @@
         // build the rdiff command
         addCommandArgument("rdiff");
         addCommandArgument("-s");
-        if (mystartTag != null) {
+        if (startTag != null) {
             addCommandArgument("-r");
-            addCommandArgument(mystartTag);
+            addCommandArgument(startTag);
         } else {
             addCommandArgument("-D");
-            addCommandArgument(mystartDate);
+            addCommandArgument(startDate);
         }
-        if (myendTag != null) {
+        if (endTag != null) {
             addCommandArgument("-r");
-            addCommandArgument(myendTag);
+            addCommandArgument(endTag);
         } else {
             addCommandArgument("-D");
-            addCommandArgument(myendDate);
+            addCommandArgument(endDate);
         }
         // support multiple packages
-        StringTokenizer myTokenizer = new StringTokenizer(mypackage);
-        while (myTokenizer.hasMoreTokens()) {
-            addCommandArgument(myTokenizer.nextToken());
+        StringTokenizer tokenizer = new StringTokenizer(modulePackage);
+        while (tokenizer.hasMoreTokens()) {
+            addCommandArgument(tokenizer.nextToken());
         }
         // force command not to be null
         setCommand("");
         File tmpFile = null;
         try {
-            tmpFile = myfileUtils.createTempFile("cvstagdiff", ".log", null);
+            tmpFile = fileUtils.createTempFile("cvstagdiff", ".log", null);
             tmpFile.deleteOnExit();
             setOutput(tmpFile);
 
@@ -236,7 +236,7 @@
     }
 
     /**
-     * Parse the tmpFile and return and array of CvsTagEntry to be
+     * Parse the tmpFile and return an array of CvsTagEntry to be
      * written in the output.
      *
      * @param tmpFile the File containing the output of the cvs rdiff command
@@ -264,14 +264,13 @@
             // File testantoine/antoine.bat is removed; TESTANTOINE_1 revision 
1.1.1.1
             //
             // get rid of 'File module/"
-            String toBeRemoved = FILE_STRING + mypackage + "/";
+            String toBeRemoved = FILE_STRING + modulePackage + "/";
             int headerLength = toBeRemoved.length();
             Vector entries = new Vector();
 
             String line = reader.readLine();
             int index;
-            CvsTagEntry entry = null;
-
+           
             while (null != line) {
                 if (line.length() > headerLength) {
                     if (line.startsWith(toBeRemoved)) {
@@ -281,42 +280,11 @@
                     }
 
                     if ((index = line.indexOf(FILE_IS_NEW)) != -1) {
-                        // it is a new file
-                        // set the revision but not the prevrevision
-                        String filename = line.substring(0, index);
-                        String rev = null;
-                        int indexrev = -1;
-                        if ((indexrev = line.indexOf(REVISION, index)) != -1) {
-                            rev = line.substring(indexrev + REVISION.length());
-                        }
-                        entry = new CvsTagEntry(filename, rev);
-                        entries.addElement(entry);
-                        log(entry.toString(), Project.MSG_VERBOSE);
+                        newFileTag(entries, line, index);
                     } else if ((index = line.indexOf(FILE_HAS_CHANGED)) != -1) 
{
-                        // it is a modified file
-                        // set the revision and the prevrevision
-                        String filename = line.substring(0, index);
-                        int revSeparator = line.indexOf(" to ", index);
-                        String prevRevision =
-                            line.substring(index + FILE_HAS_CHANGED.length(),
-                                revSeparator);
-                        String revision = line.substring(revSeparator + 
TO_STRING.length());
-                        entry = new CvsTagEntry(filename,
-                            revision,
-                            prevRevision);
-                        entries.addElement(entry);
-                        log(entry.toString(), Project.MSG_VERBOSE);
+                        changedFileTag(entries, line, index);
                     } else if ((index = line.indexOf(FILE_WAS_REMOVED)) != -1) 
{
-                        // it is a removed file
-                        String filename = line.substring(0, index);
-                        String rev = null;
-                        int indexrev = -1;
-                        if ((indexrev = line.indexOf(REVISION, index)) != -1) {
-                            rev = line.substring(indexrev + REVISION.length());
-                        }
-                        entry = new CvsTagEntry(filename, null, rev);
-                        entries.addElement(entry);
-                        log(entry.toString(), Project.MSG_VERBOSE);
+                        removedFileTag(entries, line, index);
                     }
                 }
                 line = reader.readLine();
@@ -329,17 +297,67 @@
         } catch (IOException e) {
             throw new BuildException("Error in parsing", e);
         } finally {
-            if (reader != null) {
-                try {
-                    reader.close();
-                } catch (IOException e) {
-                    log(e.toString(), Project.MSG_ERR);
-                }
-            }
+            FileUtils.close(reader);
         }
     }
 
     /**
+     * Parse the new file entries
+     * @param entries the CVSEntries
+     * @param line the line to parse
+     * @param index the index in the line
+     */
+    private void removedFileTag(Vector entries, String line, int index) {
+        String filename = line.substring(0, index);
+        String rev = null;
+        int indexrev = -1;
+        if ((indexrev = line.indexOf(REVISION, index)) != -1) {
+            rev = line.substring(indexrev + REVISION.length());
+        }
+        CvsTagEntry entry = new CvsTagEntry(filename, null, rev);
+        entries.addElement(entry);
+        log(entry.toString(), Project.MSG_VERBOSE);
+    }
+
+    /**
+     * Parse the changed file entries
+     * @param entries the CVSEntries
+     * @param line the line to parse
+     * @param index the index in the line
+     */
+    private void changedFileTag(Vector entries, String line, int index) {
+        // set the revision and the prevrevision
+        String filename = line.substring(0, index);
+        int revSeparator = line.indexOf(" to ", index);
+        String prevRevision =
+            line.substring(index + FILE_HAS_CHANGED.length(),
+                revSeparator);
+        String revision = line.substring(revSeparator + TO_STRING.length());
+        CvsTagEntry entry = new CvsTagEntry(filename, revision, prevRevision);
+        entries.addElement(entry);
+        log(entry.toString(), Project.MSG_VERBOSE);
+    }
+
+    /**
+     * Parse the removed file entries
+     * @param entries
+     * @param line the line to parse
+     * @param index the index in the line
+     */
+    private void newFileTag(Vector entries, String line, int index) {
+        // set the revision but not the prevrevision
+        String filename = line.substring(0, index);
+        String rev = null;
+        int indexrev = -1;
+        if ((indexrev = line.indexOf(REVISION, index)) != -1) {
+            rev = line.substring(indexrev + REVISION.length());
+        }
+        CvsTagEntry entry = new CvsTagEntry(filename, rev);
+        entries.addElement(entry);
+        log(entry.toString(), Project.MSG_VERBOSE);
+    }
+
+    /**
      * Write the rdiff log.
      *
      * @param entries a <code>CvsTagEntry[]</code> value
@@ -348,24 +366,24 @@
     private void writeTagDiff(CvsTagEntry[] entries) throws BuildException {
         FileOutputStream output = null;
         try {
-            output = new FileOutputStream(mydestfile);
+            output = new FileOutputStream(destFile);
             PrintWriter writer = new PrintWriter(
                                      new OutputStreamWriter(output, "UTF-8"));
             writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
             writer.print("<tagdiff ");
-            if (mystartTag != null) {
-                writer.print("startTag=\"" + mystartTag + "\" ");
+            if (startTag != null) {
+                writer.print("startTag=\"" + startTag + "\" ");
             } else {
-                writer.print("startDate=\"" + mystartDate + "\" ");
+                writer.print("startDate=\"" + startDate + "\" ");
             }
-            if (myendTag != null) {
-                writer.print("endTag=\"" + myendTag + "\" ");
+            if (endTag != null) {
+                writer.print("endTag=\"" + endTag + "\" ");
             } else {
-                writer.print("endDate=\"" + myendDate + "\" ");
+                writer.print("endDate=\"" + endDate + "\" ");
             }
 
             writer.print("cvsroot=\"" + getCvsRoot() + "\" ");
-            writer.print("package=\"" + mypackage + "\" ");
+            writer.print("package=\"" + modulePackage + "\" ");
 
             writer.println(">");
             for (int i = 0, c = entries.length; i < c; i++) {
@@ -379,13 +397,7 @@
         } catch (IOException ioe) {
             throw new BuildException(ioe.toString(), ioe);
         } finally {
-            if (null != output) {
-                try {
-                    output.close();
-                } catch (IOException ioe) {
-                    log(ioe.toString(), Project.MSG_ERR);
-                }
-            }
+            FileUtils.close(output);
         }
     }
 
@@ -417,28 +429,28 @@
      * @exception BuildException if a parameter is not correctly set
      */
     private void validate() throws BuildException {
-        if (null == mypackage) {
+        if (null == modulePackage) {
             throw new BuildException("Package/module must be set.");
         }
 
-        if (null == mydestfile) {
+        if (null == destFile) {
             throw new BuildException("Destfile must be set.");
         }
 
-        if (null == mystartTag && null == mystartDate) {
+        if (null == startTag && null == startDate) {
             throw new BuildException("Start tag or start date must be set.");
         }
 
-        if (null != mystartTag && null != mystartDate) {
+        if (null != startTag && null != startDate) {
             throw new BuildException("Only one of start tag and start date "
                                      + "must be set.");
         }
 
-        if (null == myendTag && null == myendDate) {
+        if (null == endTag && null == endDate) {
             throw new BuildException("End tag or end date must be set.");
         }
 
-        if (null != myendTag && null != myendDate) {
+        if (null != endTag && null != endDate) {
             throw new BuildException("Only one of end tag and end date must "
                                      + "be set.");
         }
Index: CvsTagEntry.java
===================================================================
RCS file: 
/home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/cvslib/CvsTagEntry.java,v
retrieving revision 1.7
diff -u -r1.7 CvsTagEntry.java
--- CvsTagEntry.java    22 Nov 2004 09:23:31 -0000      1.7
+++ CvsTagEntry.java    6 Dec 2004 10:16:40 -0000
@@ -19,52 +19,85 @@
 /**
  * Holds the information of a line of rdiff
  */
-class CvsTagEntry {
-    String m_filename;
-    String m_prevRevision;
-    String m_revision;
-
-    public CvsTagEntry(String filename) {
+public class CvsTagEntry {
+    
+    /** the filename */
+    private String filename;
+    
+    /** the previous revision */
+    private String prevRevision;
+    
+    /** the revision */
+    private String revision;
+
+    /**
+     * Creates a new CvsTagEntry
+     * @param filename the filename to add
+     */
+    public CvsTagEntry(final String filename) {
         this(filename, null, null);
     }
 
-    public CvsTagEntry(String filename, String revision) {
+    /**
+     * Creates a new CvsTagEntry
+     * @param filename the filename to add
+     * @param revision the revision
+     */
+    public CvsTagEntry(final String filename, final String revision) {
         this(filename, revision, null);
     }
 
-    public CvsTagEntry(String filename, String revision,
-                       String prevRevision) {
-        m_filename = filename;
-        m_revision = revision;
-        m_prevRevision = prevRevision;
-    }
-
+    /**
+     * Creates a new CvsTagEntry
+     * @param filename the filename to add
+     * @param revision the revision
+     * @param prevRevision the previous revision
+     */
+    public CvsTagEntry(final String filename, final String revision,
+                       final String prevRevision) {
+        this.filename = filename;
+        this.revision = revision;
+        this.prevRevision = prevRevision;
+    }
+
+    /**
+     * Gets the filename for this CvsTagEntry
+     * @return the filename
+     */
     public String getFile() {
-        return m_filename;
+        return filename;
     }
 
+    /**
+     * Gets the revision for this CvsTagEntry
+     * @return the revision
+     */
     public String getRevision() {
-        return m_revision;
+        return revision;
     }
 
+    /**
+     * Gets the previous revision for this CvsTagEntry
+     * @return the previous revision
+     */
     public String getPreviousRevision() {
-        return m_prevRevision;
+        return prevRevision;
     }
 
     public String toString() {
         StringBuffer buffer = new StringBuffer();
-        buffer.append(m_filename);
-        if ((m_revision == null)) {
+        buffer.append(filename);
+        if ((revision == null)) {
             buffer.append(" was removed");
-            if (m_prevRevision != null) {
-                buffer.append("; previous revision was 
").append(m_prevRevision);
+            if (prevRevision != null) {
+                buffer.append("; previous revision was ").append(prevRevision);
             }
-        } else if (m_revision != null && m_prevRevision == null) {
+        } else if (revision != null && prevRevision == null) {
             buffer.append(" is new; current revision is ")
-                .append(m_revision);
-        } else if (m_revision != null && m_prevRevision != null) {
+                .append(revision);
+        } else if (revision != null && prevRevision != null) {
             buffer.append(" has changed from ")
-                .append(m_prevRevision).append(" to ").append(m_revision);
+                .append(prevRevision).append(" to ").append(revision);
         }
         return buffer.toString();
     }
Index: CvsUser.java
===================================================================
RCS file: 
/home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/cvslib/CvsUser.java,v
retrieving revision 1.9
diff -u -r1.9 CvsUser.java
--- CvsUser.java        9 Mar 2004 16:48:14 -0000       1.9
+++ CvsUser.java        6 Dec 2004 10:16:40 -0000
@@ -25,9 +25,9 @@
  */
 public class CvsUser {
     /** The user's Id */
-    private String m_userID;
+    private String userID;
     /** The user's full name */
-    private String m_displayName;
+    private String displayName;
 
 
     /**
@@ -36,7 +36,7 @@
      * @param displayName the user's full name
      */
     public void setDisplayname(final String displayName) {
-        m_displayName = displayName;
+        this.displayName = displayName;
     }
 
 
@@ -46,7 +46,7 @@
      * @param userID the user's new id value.
      */
     public void setUserid(final String userID) {
-        m_userID = userID;
+        this.userID = userID;
     }
 
 
@@ -55,8 +55,8 @@
      *
      * @return The userID value
      */
-    String getUserID() {
-        return m_userID;
+    public String getUserID() {
+        return userID;
     }
 
 
@@ -65,26 +65,26 @@
      *
      * @return the user's full name
      */
-    String getDisplayname() {
-        return m_displayName;
+    public String getDisplayname() {
+        return displayName;
     }
 
 
     /**
-     * validate that this object is configured.
+     * Validate that this object is configured.
      *
      * @exception BuildException if the instance has not be correctly
      *            configured.
      */
-    void validate() throws BuildException {
-        if (null == m_userID) {
+    public void validate() throws BuildException {
+        if (null == userID) {
             final String message = "Username attribute must be set.";
 
             throw new BuildException(message);
         }
-        if (null == m_displayName) {
+        if (null == displayName) {
             final String message =
-                "Displayname attribute must be set for userID " + m_userID;
+                "Displayname attribute must be set for userID " + userID;
 
             throw new BuildException(message);
         }
Index: CvsVersion.java
===================================================================
RCS file: 
/home/cvspublic/ant/src/main/org/apache/tools/ant/taskdefs/cvslib/CvsVersion.java,v
retrieving revision 1.7
diff -u -r1.7 CvsVersion.java
--- CvsVersion.java     9 Mar 2004 16:48:14 -0000       1.7
+++ CvsVersion.java     6 Dec 2004 10:16:40 -0000
@@ -45,22 +45,23 @@
     private String serverVersion;
     private String clientVersionProperty;
     private String serverVersionProperty;
+    
     /**
-     * get the CVS client version
+     * Get the CVS client version
      * @return CVS client version
      */
     public String getClientVersion() {
         return clientVersion;
     }
     /**
-     * get the CVS server version
+     * Get the CVS server version
      * @return CVS server version
      */
     public String getServerVersion() {
         return serverVersion;
     }
     /**
-     * set a property where to store the CVS client version
+     * Set a property where to store the CVS client version
      * @param clientVersionProperty  property for CVS client version
      */
     public void setClientVersionProperty(String clientVersionProperty) {
@@ -68,26 +69,25 @@
     }
 
     /**
-     * set a property where to store the CVS server version
+     * Set a property where to store the CVS server version
      * @param serverVersionProperty  property for CVS server version
      */
     public void setServerVersionProperty(String serverVersionProperty) {
         this.serverVersionProperty = serverVersionProperty;
     }
     /**
-     * find out if the server version supports log with S option
+     * Find out if the server version supports log with S option
      * @return  boolean indicating if the server version supports log with S 
option
      */
     public boolean supportsCvsLogWithSOption() {
         if (serverVersion == null) {
             return false;
         }
-        StringTokenizer mySt = new StringTokenizer(serverVersion, ".");
-        long versionNumber;
+        StringTokenizer tokenizer = new StringTokenizer(serverVersion, ".");
         long counter = MULTIPLY * MULTIPLY;
         long version = 0;
-        while (mySt.hasMoreTokens()) {
-            String s = mySt.nextToken();
+        while (tokenizer.hasMoreTokens()) {
+            String s = tokenizer.nextToken();
             int i = 0;
             for (i = 0; i < s.length(); i++) {
                 if (!Character.isDigit(s.charAt(i))) {

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to