scohen 2003/03/05 19:28:36
Modified: net/src/java/org/apache/commons/net/ftp/parser
EnterpriseUnixFTPEntryParser.java
NTFTPEntryParser.java OS2FTPEntryParser.java
UnixFTPEntryParser.java VMSFTPEntryParser.java
Log:
make checkstyle happier. Note that problems with IllegalArgumentException
are a bug in checkstyle. RuntimeExceptions do not need to be declared, but
they should especially be commented.
Revision Changes Path
1.2 +25 -9
jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/EnterpriseUnixFTPEntryParser.java
Index: EnterpriseUnixFTPEntryParser.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/EnterpriseUnixFTPEntryParser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- EnterpriseUnixFTPEntryParser.java 2 Mar 2003 18:18:24 -0000 1.1
+++ EnterpriseUnixFTPEntryParser.java 6 Mar 2003 03:28:35 -0000 1.2
@@ -60,21 +60,37 @@
/**
* Parser for the Connect Enterprise Unix FTP Server From Sterling Commerce.
+ * Here is a sample of the sort of output line this parser processes:
+ * "-C--E-----FTP B QUA1I1 18128 41 Aug 12 13:56 QUADTEST"
* @version $Id$
* @author <a href="[EMAIL PROTECTED]">Winston Ojeda</a>
*/
public class EnterpriseUnixFTPEntryParser extends FTPFileListParserImpl
{
- // sample output line
- //"-C--E-----FTP B QUA1I1 18128 41 Aug 12 13:56 QUADTEST"
- private static final String MONTHS =
"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)";
+ /**
+ * months abbreviations looked for by this parser. Also used
+ * to determine <b>which</b> month has been matched by the parser.
+ */
+ private static final String MONTHS =
+ "(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)";
+
+ /**
+ * this is the regular expression used by this parser.
+ */
private static final String REGEX =
-
"(([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z]))"
+
- "(\\S*)\\s*" + "(\\S+)\\s*" + "(\\S*)\\s*" + "(\\d*)\\s*" +
- "(\\d*)\\s*" + MONTHS + "\\s*" + "((?:[012]\\d*)|(?:3[01]))\\s*" +
- "((\\d\\d\\d\\d)|((?:[01]\\d)|(?:2[0123])):([012345]\\d))\\s" +
- "(\\S*)(\\s*.*)";
+ "(([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])"
+ + "([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z])([\\-]|[A-Z]))"
+ + "(\\S*)\\s*"
+ + "(\\S+)\\s*"
+ + "(\\S*)\\s*"
+ + "(\\d*)\\s*"
+ + "(\\d*)\\s*"
+ + MONTHS
+ + "\\s*"
+ + "((?:[012]\\d*)|(?:3[01]))\\s*"
+ + "((\\d\\d\\d\\d)|((?:[01]\\d)|(?:2[0123])):([012345]\\d))\\s"
+ + "(\\S*)(\\s*.*)";
/**
* The sole constructor for a EnterpriseUnixFTPEntryParser object.
1.3 +13 -10
jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/NTFTPEntryParser.java
Index: NTFTPEntryParser.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/NTFTPEntryParser.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- NTFTPEntryParser.java 2 Mar 2003 19:36:44 -0000 1.2
+++ NTFTPEntryParser.java 6 Mar 2003 03:28:36 -0000 1.3
@@ -104,16 +104,19 @@
*/
public class NTFTPEntryParser extends FTPFileListParserImpl
{
+ /**
+ * this is the regular expression used by this parser.
+ */
private static final String REGEX =
- "((?:0[1-9])|(?:1[0-2]))-" +
- "((?:0[1-9])|(?:[1-2]\\d)|(?:3[0-1]))-" +
- "(\\d\\d)\\s*" +
- "((?:0[1-9])|(?:1[012])):" +
- "([0-5]\\d)\\s*" +
- "([AP])M\\s*" +
- "(<DIR>)?\\s*" +
- "([0-9]+)?\\s*" +
- "(\\S.*)";
+ "((?:0[1-9])|(?:1[0-2]))-"
+ + "((?:0[1-9])|(?:[1-2]\\d)|(?:3[0-1]))-"
+ + "(\\d\\d)\\s*"
+ + "((?:0[1-9])|(?:1[012])):"
+ + "([0-5]\\d)\\s*"
+ + "([AP])M\\s*"
+ + "(<DIR>)?\\s*"
+ + "([0-9]+)?\\s*"
+ + "(\\S.*)";
/**
* The sole constructor for an NTFTPEntryParser object.
1.3 +13 -10
jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/OS2FTPEntryParser.java
Index: OS2FTPEntryParser.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/OS2FTPEntryParser.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- OS2FTPEntryParser.java 2 Mar 2003 19:36:44 -0000 1.2
+++ OS2FTPEntryParser.java 6 Mar 2003 03:28:36 -0000 1.3
@@ -104,16 +104,19 @@
public class OS2FTPEntryParser extends FTPFileListParserImpl
{
+ /**
+ * this is the regular expression used by this parser.
+ */
private static final String REGEX =
- "(\\s+|[0-9]+)\\s*" +
- "(\\s+|[A-Z]+)\\s*" +
- "(DIR|\\s+)\\s*" +
- "((?:0[1-9])|(?:1[0-2]))-" +
- "((?:0[1-9])|(?:[1-2]\\d)|(?:3[0-1]))-" +
- "(\\d\\d)\\s*" +
- "(?:([0-1]\\d)|(?:2[0-3])):" +
- "([0-5]\\d)\\s*" +
- "(\\S.*)";
+ "(\\s+|[0-9]+)\\s*"
+ + "(\\s+|[A-Z]+)\\s*"
+ + "(DIR|\\s+)\\s*"
+ + "((?:0[1-9])|(?:1[0-2]))-"
+ + "((?:0[1-9])|(?:[1-2]\\d)|(?:3[0-1]))-"
+ + "(\\d\\d)\\s*"
+ + "(?:([0-1]\\d)|(?:2[0-3])):"
+ + "([0-5]\\d)\\s*"
+ + "(\\S.*)";
/**
* The sole constructor for a OS2FTPEntryParser object.
1.2 +9 -1
jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java
Index: UnixFTPEntryParser.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- UnixFTPEntryParser.java 2 Mar 2003 18:18:24 -0000 1.1
+++ UnixFTPEntryParser.java 6 Mar 2003 03:28:36 -0000 1.2
@@ -67,8 +67,16 @@
*/
public class UnixFTPEntryParser extends FTPFileListParserImpl
{
+ /**
+ * months abbreviations looked for by this parser. Also used
+ * to determine which month is matched by the parser
+ */
private static final String MONTHS =
"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)";
+
+ /**
+ * this is the regular expression used by this parser.
+ */
private static final String REGEX =
"([bcdlf-])"
+ "(((r|-)(w|-)(x|-))((r|-)(w|-)(x|-))((r|-)(w|-)(x|-)))\\s+"
1.4 +41 -17
jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/VMSFTPEntryParser.java
Index: VMSFTPEntryParser.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/net/src/java/org/apache/commons/net/ftp/parser/VMSFTPEntryParser.java,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- VMSFTPEntryParser.java 3 Mar 2003 15:25:56 -0000 1.3
+++ VMSFTPEntryParser.java 6 Mar 2003 03:28:36 -0000 1.4
@@ -103,33 +103,44 @@
* files from the directory it is in. This becomes crucial specialy if your
* goal is to delete the output of the parser.
* <P>
+ * This is a sample of VMS LIST output
+ *
+ * "1-JUN.LIS;1 9/9 2-JUN-1998 07:32:04 [GROUP,OWNER]
(RWED,RWED,RWED,RE)",
+ * "1-JUN.LIS;2 9/9 2-JUN-1998 07:32:04 [GROUP,OWNER]
(RWED,RWED,RWED,RE)",
+ * "DATA.DIR;1 1/9 2-JUN-1998 07:32:04 [GROUP,OWNER]
(RWED,RWED,RWED,RE)",
+ * <P>
+ *
* @author <a href="[EMAIL PROTECTED]">Winston Ojeda</a>
* @author <a href="mailto:[EMAIL PROTECTED]">Steve Cohen</a>
* @version $Id$
*/
public class VMSFTPEntryParser extends FTPFileListParserImpl
{
- private String prefix = "[" + getClass().getName() + "] ";
+ /**
+ * settable option of whether or not to include versioning information
+ * with the file list.
+ */
private boolean versioning;
- /* This is how a VMS LIST output really looks
-
- "1-JUN.LIS;1 9/9 2-JUN-1998 07:32:04
[GROUP,OWNER] (RWED,RWED,RWED,RE)",
- "1-JUN.LIS;2 9/9 2-JUN-1998 07:32:04
[GROUP,OWNER] (RWED,RWED,RWED,RE)",
- "DATA.DIR;1 1/9 2-JUN-1998 07:32:04
[GROUP,OWNER] (RWED,RWED,RWED,RE)",
- */
+ /**
+ * months abbreviations looked for by this parser. Also used
+ * to determine <b>which</b> month has been matched by the parser.
+ */
private static final String MONTHS =
"(JAN|FEB|MAR|APR|MAY|JUN|JUL|AUG|SEP|OCT|NOV|DEC)";
+ /**
+ * this is the regular expression used by this parser.
+ */
private static final String REGEX =
- "(.*;[0-9]+)\\s*" +
- "(\\d+)/\\d+\\s*" +
- "(\\d{1,2})-" +
- MONTHS +
- "-([0-9]{4})\\s*" +
- "((?:[01]\\d)|(?:2[0-3])):([012345]\\d):([012345]\\d)\\s*" +
- "\\[([0-9$A-Za-z_]+),([0-9$a-zA-Z_]+)\\]\\s*" +
- "(\\([a-zA-Z]*,[a-zA-Z]*,[a-zA-Z]*,[a-zA-Z]*\\))";
+ "(.*;[0-9]+)\\s*"
+ + "(\\d+)/\\d+\\s*"
+ + "(\\d{1,2})-"
+ + MONTHS
+ + "-([0-9]{4})\\s*"
+ + "((?:[01]\\d)|(?:2[0-3])):([012345]\\d):([012345]\\d)\\s*"
+ + "\\[([0-9$A-Za-z_]+),([0-9$a-zA-Z_]+)\\]\\s*"
+ + "(\\([a-zA-Z]*,[a-zA-Z]*,[a-zA-Z]*,[a-zA-Z]*\\))";
/**
@@ -245,6 +256,19 @@
return null;
}
+ /**
+ * Reads the next entry using the supplied BufferedReader object up to
+ * whatever delemits one entry from the next. This parser cannot use
+ * the default implementation of simply calling BufferedReader.readLine(),
+ * because one entry may span multiple lines.
+ *
+ * @param reader The BufferedReader object from which entries are to be
+ * read.
+ *
+ * @return A string representing the next ftp entry or null if none found.
+ * @exception IOException thrown on any IO Error reading from the reader.
+ */
+
public String readNextEntry(BufferedReader reader) throws IOException
{
String line = reader.readLine();
@@ -258,6 +282,6 @@
}
line = reader.readLine();
}
- return (entry.length()==0 ? null : entry.toString());
+ return (entry.length() == 0 ? null : entry.toString());
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]