This is an automated email from the ASF dual-hosted git repository. ggregory pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/commons-net.git
commit 385ee4624e85c562a8f904232b65acd976293804 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Wed Jul 16 19:03:21 2025 -0400 Reduce vertical whitespace --- .../commons/net/ftp/parser/UnixFTPEntryParser.java | 23 ---------------------- 1 file changed, 23 deletions(-) diff --git a/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java b/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java index 1ee7cf38..c30e81ea 100644 --- a/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java +++ b/src/main/java/org/apache/commons/net/ftp/parser/UnixFTPEntryParser.java @@ -85,19 +85,13 @@ public class UnixFTPEntryParser extends ConfigurableFTPFileEntryParserImpl { */ private static final String REGEX = "([bcdelfmpSs-])" // file type + "(((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-]))((r|-)(w|-)([xsStTL-])))\\+?" // permissions - + "\\s*" // separator TODO why allow it to be omitted?? - + "(\\d+)" // link count - + "\\s+" // separator - + "(?:(\\S+(?:\\s\\S+)*?)\\s+)?" // owner name (optional spaces) + "(?:(\\S+(?:\\s\\S+)*)\\s+)?" // group name (optional spaces) + "(\\d+(?:,\\s*\\d+)?)" // size or n,m - + "\\s+" // separator - /* * numeric or standard format date: yyyy-mm-dd (expecting hh:mm to follow) MMM [d]d [d]d MMM Use non-space for MMM to allow for languages such * as German which use diacritics (e.g. umlaut) in some abbreviations. Japanese uses numeric day and month with suffixes to distinguish them [d]dXX @@ -107,16 +101,12 @@ public class UnixFTPEntryParser extends ConfigurableFTPFileEntryParserImpl { "|(?:\\S{3}\\s+\\d{1,2})" + // MMM [d]d "|(?:\\d{1,2}\\s+\\S{3})" + // [d]d MMM "|(?:\\d{1,2}" + JA_MONTH + "\\s+\\d{1,2}" + JA_DAY + ")" + ")" - + "\\s+" // separator - /* * year (for non-recent standard format) - yyyy or time (for numeric or recent standard format) [h]h:mm or Japanese year - yyyyXX */ + "((?:\\d+(?::\\d+)?)|(?:\\d{4}" + JA_YEAR + "))" // (20) - + "\\s" // separator - + "(.*)"; // the rest (21) // if true, leading spaces are trimmed from file names @@ -184,7 +174,6 @@ public class UnixFTPEntryParser extends ConfigurableFTPFileEntryParserImpl { file.setRawListing(entry); final int type; boolean isDevice = false; - if (matches(entry)) { final String typeStr = group(1); final String hardLinkCount = group(15); @@ -196,7 +185,6 @@ public class UnixFTPEntryParser extends ConfigurableFTPFileEntryParserImpl { if (trimLeadingSpaces) { name = name.replaceFirst("^\\s+", ""); } - try { if (group(19).contains(JA_MONTH)) { // special processing for Japanese format final FTPTimestampParserImpl jaParser = new FTPTimestampParserImpl(); @@ -208,10 +196,8 @@ public class UnixFTPEntryParser extends ConfigurableFTPFileEntryParserImpl { } catch (final ParseException e) { // intentionally do nothing } - // A 'whiteout' file is an ARTIFICIAL entry in any of several types of // 'translucent' filesystems, of which a 'union' filesystem is one. - // bcdelfmpSs- switch (typeStr.charAt(0)) { case 'd': @@ -235,19 +221,15 @@ public class UnixFTPEntryParser extends ConfigurableFTPFileEntryParserImpl { default: // e.g. ? and w = whiteout type = FTPFile.UNKNOWN_TYPE; } - file.setType(type); - int g = 4; for (int access = 0; access < 3; access++, g += 4) { // Use != '-' to avoid having to check for suid and sticky bits file.setPermission(access, FTPFile.READ_PERMISSION, !group(g).equals("-")); file.setPermission(access, FTPFile.WRITE_PERMISSION, !group(g + 1).equals("-")); - final String execPerm = group(g + 2); file.setPermission(access, FTPFile.EXECUTE_PERMISSION, !execPerm.equals("-") && !Character.isUpperCase(execPerm.charAt(0))); } - if (!isDevice) { try { file.setHardLinkCount(Integer.parseInt(hardLinkCount)); @@ -255,20 +237,16 @@ public class UnixFTPEntryParser extends ConfigurableFTPFileEntryParserImpl { // intentionally do nothing } } - file.setUser(usr); file.setGroup(grp); - try { file.setSize(Long.parseLong(fileSize)); } catch (final NumberFormatException e) { // intentionally do nothing } - // oddball cases like symbolic links, file names // with spaces in them. if (type == FTPFile.SYMBOLIC_LINK_TYPE) { - final int end = name.indexOf(" -> "); // Give up if no link indicator is present if (end == -1) { @@ -277,7 +255,6 @@ public class UnixFTPEntryParser extends ConfigurableFTPFileEntryParserImpl { file.setName(name.substring(0, end)); file.setLink(name.substring(end + 4)); } - } else { file.setName(name); }