Skip to content
Permalink
Browse files
Merge pull request #105 from arturobernalg/feature/improvements
Minor improvements:
  • Loading branch information
garydgregory committed May 2, 2022
2 parents 79ce732 + 70c390b commit 9943c1b0e98ab839296632c1f744bb11aa0bb143
Showing 3 changed files with 14 additions and 14 deletions.
@@ -148,45 +148,45 @@ private FTPFileEntryParser createFileEntryParser(final String key, final FTPClie

if (parser == null) { // Now try for aliases
final String ukey = key.toUpperCase(java.util.Locale.ENGLISH);
if (ukey.indexOf(FTPClientConfig.SYST_UNIX_TRIM_LEADING) >= 0)
if (ukey.contains(FTPClientConfig.SYST_UNIX_TRIM_LEADING))
{
parser = new UnixFTPEntryParser(config, true);
}
// must check this after SYST_UNIX_TRIM_LEADING as it is a substring of it
else if (ukey.indexOf(FTPClientConfig.SYST_UNIX) >= 0)
else if (ukey.contains(FTPClientConfig.SYST_UNIX))
{
parser = new UnixFTPEntryParser(config, false);
}
else if (ukey.indexOf(FTPClientConfig.SYST_VMS) >= 0)
else if (ukey.contains(FTPClientConfig.SYST_VMS))
{
parser = new VMSVersioningFTPEntryParser(config);
}
else if (ukey.indexOf(FTPClientConfig.SYST_NT) >= 0)
else if (ukey.contains(FTPClientConfig.SYST_NT))
{
parser = createNTFTPEntryParser(config);
}
else if (ukey.indexOf(FTPClientConfig.SYST_OS2) >= 0)
else if (ukey.contains(FTPClientConfig.SYST_OS2))
{
parser = new OS2FTPEntryParser(config);
}
else if (ukey.indexOf(FTPClientConfig.SYST_OS400) >= 0 ||
ukey.indexOf(FTPClientConfig.SYST_AS400) >= 0)
else if (ukey.contains(FTPClientConfig.SYST_OS400) ||
ukey.contains(FTPClientConfig.SYST_AS400))
{
parser = createOS400FTPEntryParser(config);
}
else if (ukey.indexOf(FTPClientConfig.SYST_MVS) >= 0)
else if (ukey.contains(FTPClientConfig.SYST_MVS))
{
parser = new MVSFTPEntryParser(); // Does not currently support config parameter
}
else if (ukey.indexOf(FTPClientConfig.SYST_NETWARE) >= 0)
else if (ukey.contains(FTPClientConfig.SYST_NETWARE))
{
parser = new NetwareFTPEntryParser(config);
}
else if (ukey.indexOf(FTPClientConfig.SYST_MACOS_PETER) >= 0)
else if (ukey.contains(FTPClientConfig.SYST_MACOS_PETER))
{
parser = new MacOsPeterFTPEntryParser(config);
}
else if (ukey.indexOf(FTPClientConfig.SYST_L8) >= 0)
else if (ukey.contains(FTPClientConfig.SYST_L8))
{
// L8 normally means Unix, but move it to the end for some L8 systems that aren't.
// This check should be last!
@@ -486,10 +486,10 @@ public List<String> preParse(final List<String> orig) {
// list in short order.
if (orig != null && !orig.isEmpty()) {
final String header = orig.get(0);
if (header.indexOf("Volume") >= 0 && header.indexOf("Dsname") >= 0) {
if (header.contains("Volume") && header.contains("Dsname")) {
setType(FILE_LIST_TYPE);
super.setRegex(FILE_LIST_REGEX);
} else if (header.indexOf("Name") >= 0 && header.indexOf("Id") >= 0) {
} else if (header.contains("Name") && header.contains("Id")) {
setType(MEMBER_LIST_TYPE);
super.setRegex(MEMBER_LIST_REGEX);
} else if (header.indexOf("total") == 0) {
@@ -306,7 +306,7 @@ public int compareTo(final TimeStamp anotherTimeStamp)
{
final long thisVal = this.ntpTime;
final long anotherVal = anotherTimeStamp.ntpTime;
return (thisVal < anotherVal ? -1 : (thisVal == anotherVal ? 0 : 1));
return (Long.compare(thisVal, anotherVal));
}

/**

0 comments on commit 9943c1b

Please sign in to comment.