Skip to content

Commit

Permalink
Merge branch 'master' into fix_ci_failing_tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jkbkupczyk authored Sep 16, 2023
2 parents 2d0e6ec + cd0aa01 commit e3013d7
Show file tree
Hide file tree
Showing 74 changed files with 343 additions and 566 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
persist-credentials: false
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
Expand All @@ -57,7 +57,7 @@ jobs:
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@5b6282e01c62d02e720b81eb8a51204f527c3624 # v2.21.3
uses: github/codeql-action/init@04daf014b50eaf774287bf3f0f1869d4b4c4b913 # v2.21.7
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -68,7 +68,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@5b6282e01c62d02e720b81eb8a51204f527c3624 # v2.21.3
uses: github/codeql-action/autobuild@04daf014b50eaf774287bf3f0f1869d4b4c4b913 # v2.21.7

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -82,4 +82,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@5b6282e01c62d02e720b81eb8a51204f527c3624 # v2.21.3
uses: github/codeql-action/analyze@04daf014b50eaf774287bf3f0f1869d4b4c4b913 # v2.21.7
4 changes: 2 additions & 2 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ jobs:
java: [ 8 ]

steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
persist-credentials: false
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ jobs:

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
persist-credentials: false
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
- uses: actions/cache@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/maven_adhoc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
timeout-minutes: 7
runs-on: windows-latest
steps:
- uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
- uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
persist-credentials: false
- name: Set up JDK
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/scorecards-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ jobs:
steps:

- name: "Checkout code"
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
uses: actions/checkout@3df4ab11eba7bda6032a0b82a6bb43b11571feac # v4.0.0
with:
persist-credentials: false

Expand All @@ -57,13 +57,13 @@ jobs:
publish_results: true

- name: "Upload artifact"
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # 3.1.0
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # 3.1.0
with:
name: SARIF file
path: results.sarif
retention-days: 5

- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@5b6282e01c62d02e720b81eb8a51204f527c3624 # 2.21.3
uses: github/codeql-action/upload-sarif@04daf014b50eaf774287bf3f0f1869d4b4c4b913 # 2.21.7
with:
sarif_file: results.sarif
4 changes: 2 additions & 2 deletions checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ limitations under the License.
-->

<!DOCTYPE module PUBLIC
"-//Checkstyle//DTD Checkstyle Configuration 1.1//EN"
"https://checkstyle.org/dtds/configuration_1_1.dtd">
"-//Checkstyle//DTD Checkstyle Configuration 1.3//EN"
"https://checkstyle.org/dtds/configuration_1_3.dtd">

<!-- Commons Net customization of default Checkstyle behavior -->
<module name="Checker">
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<parent>
<groupId>org.apache.commons</groupId>
<artifactId>commons-parent</artifactId>
<version>59</version>
<version>62</version>
</parent>

<groupId>commons-net</groupId>
Expand All @@ -44,7 +44,7 @@ Supported protocols include: Echo, Finger, FTP, NNTP, NTP, POP3(S), SMTP(S), Tel
<!-- Environment -->
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<commons.javadoc.java.link>${commons.javadoc7.java.link}</commons.javadoc.java.link>
<commons.javadoc.java.link>${commons.javadoc8.java.link}</commons.javadoc.java.link>
<commons.componentid>net</commons.componentid>
<commons.module.name>org.apache.commons.net</commons.module.name>
<commons.jira.id>NET</commons.jira.id>
Expand Down
5 changes: 4 additions & 1 deletion src/changes/changes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,12 @@ The <action> type attribute can be add,update,fix,remove.
<action type="fix" dev="ggregory" due-to="David Costanzo, Gary Gregory" issue="NET-722">
Javadoc for FtpClient.setControlKeepAliveReplyTimeout(Duration) says timeout is in milliseconds.
</action>
<action type="fix" dev="ggregory" due-to="haegar9766, Gary Gregory">
Change class org.apache.commons.net.ftp.parser.MVSFTPEntryParser to support more datasets #182.
</action>
<!-- UPDATE -->
<action type="update" dev="ggregory" due-to="Dependabot">
Bump commons-parent from 54 to 59 #132, #137, #153.
Bump commons-parent from 54 to 62 #132, #137, #153.
</action>
<action type="update" dev="ggregory" due-to="Gary Gregory">
Bump commons-io from 2.11.0 to 2.13.0.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public static void main(final String[] args) throws UnknownHostException {
displayTimeZoneId = args[++base];
} else if (args[base].equals("-PrH")) {
proxyHost = args[++base];
final String parts[] = proxyHost.split(":");
final String[] parts = proxyHost.split(":");
if (parts.length == 2) {
proxyHost = parts[0];
proxyPort = Integer.parseInt(parts[1]);
Expand Down Expand Up @@ -213,7 +213,7 @@ public static void main(final String[] args) throws UnknownHostException {

String server = args[base++];
int port = 0;
final String parts[] = server.split(":");
final String[] parts = server.split(":");
if (parts.length == 2) {
server = parts[0];
port = Integer.parseInt(parts[1]);
Expand Down Expand Up @@ -248,7 +248,7 @@ public static void main(final String[] args) throws UnknownHostException {
} else if (protocol.equals("false")) {
ftps = new FTPSClient(false);
} else {
final String prot[] = protocol.split(",");
final String[] prot = protocol.split(",");
if (prot.length == 1) { // Just protocol
ftps = new FTPSClient(protocol);
} else { // protocol,true|false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ public static void main(final String[] args) {
System.err.println("Couldn't initiate transfer. Check that file names are valid.");
break __main;
}
// if(ftp1.remoteRetrieve(file1) && ftp2.remoteStore(file2)) {
// if (ftp1.remoteRetrieve(file1) && ftp2.remoteStore(file2)) {
// We have to fetch the positive completion reply.
ftp1.completePendingCommand();
ftp2.completePendingCommand();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ public void protocolReplyReceived(final ProtocolCommandEvent event) {
while (true) {
final boolean ok = imap.fetch(sequenceSet, itemNames);
// If the fetch failed, can we retry?
if (ok || (retryWaitSecs <= 0) || (mboxListener == null) || !checkSequence) {
if (ok || retryWaitSecs <= 0 || mboxListener == null || !checkSequence) {
break;
}
final String replyString = imap.getReplyString(); // includes EOL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ private static boolean startsWith(final String input, final Pattern pat) {
* @return true if the message is wanted
*/
private static boolean wanted(final int msgNum, final String line, final BitSet msgNums, final List<String> contains) {
return (msgNums.isEmpty() && contains.isEmpty()) // no selectors
return msgNums.isEmpty() && contains.isEmpty() // no selectors
|| msgNums.get(msgNum) // matches message number
|| listContains(contains, line); // contains string
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public static void main(final String[] args) {
System.exit(1);
}

final String arg0[] = args[argIdx++].split(":");
final String[] arg0 = args[argIdx++].split(":");
final String server = arg0[0];
final String username = args[argIdx++];
String password = args[argIdx++];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static void main(final String[] args) {
System.exit(1);
}

final String arg0[] = args[0].split(":");
final String[] arg0 = args[0].split(":");
final String server = arg0[0];
final String username = args[1];
String password = args[2];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public static void main(final String[] args) throws SocketException, IOException
}
}

final String fmt[] = client.listOverviewFmt();
final String[] fmt = client.listOverviewFmt();
if (fmt != null) {
System.out.println("LIST OVERVIEW.FMT:");
for (final String s : fmt) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public boolean isStarted() {
@Override
public void run() {
running = true;
final byte buffer[] = new byte[48];
final byte[] buffer = new byte[48];
final DatagramPacket request = new DatagramPacket(buffer, buffer.length);
do {
try {
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/org/apache/commons/net/ftp/FTPClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
* // success.
* reply = ftp.getReplyCode();
*
* if(!FTPReply.isPositiveCompletion(reply)) {
* if (!FTPReply.isPositiveCompletion(reply)) {
* ftp.disconnect();
* System.err.println("FTP server refused connection.");
* System.exit(1);
Expand All @@ -96,7 +96,7 @@
* error = true;
* e.printStackTrace();
* } finally {
* if(ftp.isConnected()) {
* if (ftp.isConnected()) {
* try {
* ftp.disconnect();
* } catch (IOException ioe) {
Expand Down Expand Up @@ -697,7 +697,7 @@ protected Socket _openDataConnection_(final String command, final String arg) th
return null;
}

if ((restartOffset > 0) && !restart(restartOffset)) {
if (restartOffset > 0 && !restart(restartOffset)) {
return null;
}

Expand Down Expand Up @@ -768,7 +768,7 @@ protected Socket _openDataConnection_(final String command, final String arg) th
}

socket.connect(new InetSocketAddress(passiveHost, passivePort), connectTimeout);
if ((restartOffset > 0) && !restart(restartOffset)) {
if (restartOffset > 0 && !restart(restartOffset)) {
socket.close();
return null;
}
Expand Down Expand Up @@ -800,7 +800,7 @@ protected void _parseExtendedPassiveModeReply(String reply) throws MalformedServ
final char delim3 = reply.charAt(2);
final char delim4 = reply.charAt(reply.length() - 1);

if ((delim1 != delim2) || (delim2 != delim3) || (delim3 != delim4)) {
if (delim1 != delim2 || delim2 != delim3 || delim3 != delim4) {
throw new MalformedServerReplyException("Could not parse extended passive host information.\nServer Reply: " + reply);
}

Expand Down Expand Up @@ -834,7 +834,7 @@ protected void _parsePassiveModeReply(final String reply) throws MalformedServer
try {
final int oct1 = Integer.parseInt(m.group(2));
final int oct2 = Integer.parseInt(m.group(3));
pasvPort = (oct1 << 8) | oct2;
pasvPort = oct1 << 8 | oct2;
} catch (final NumberFormatException e) {
throw new MalformedServerReplyException("Could not parse passive port information.\nServer Reply: " + reply);
}
Expand Down Expand Up @@ -1164,7 +1164,7 @@ public boolean changeWorkingDirectory(final String pathname) throws IOException
* OutputStream output;
* input = new FileInputStream("foobaz.txt");
* output = ftp.storeFileStream("foobar.txt")
* if(!FTPReply.isPositiveIntermediate(ftp.getReplyCode())) {
* if (!FTPReply.isPositiveIntermediate(ftp.getReplyCode())) {
* input.close();
* output.close();
* ftp.logout();
Expand All @@ -1176,7 +1176,7 @@ public boolean changeWorkingDirectory(final String pathname) throws IOException
* input.close();
* output.close();
* // Must call completePendingCommand() to finish command.
* if(!ftp.completePendingCommand()) {
* if (!ftp.completePendingCommand()) {
* ftp.logout();
* ftp.disconnect();
* System.err.println("File transfer failed.");
Expand Down Expand Up @@ -1211,7 +1211,7 @@ void createParser(final String parserKey) throws IOException {
// We cache the value to avoid creation of a new object every
// time a file listing is generated.
// Note: we don't check against a null parserKey (NET-544)
if (entryParser == null || (parserKey != null && !entryParserKey.equals(parserKey))) {
if (entryParser == null || parserKey != null && !entryParserKey.equals(parserKey)) {
if (null != parserKey) {
// if a parser key was supplied in the parameters,
// use that to create the parser
Expand Down Expand Up @@ -2646,7 +2646,7 @@ public String printWorkingDirectory() throws IOException {
public boolean reinitialize() throws IOException {
rein();

if (FTPReply.isPositiveCompletion(_replyCode) || (FTPReply.isPositivePreliminary(_replyCode) && FTPReply.isPositiveCompletion(getReply()))) {
if (FTPReply.isPositiveCompletion(_replyCode) || FTPReply.isPositivePreliminary(_replyCode) && FTPReply.isPositiveCompletion(getReply())) {

initDefaults();

Expand Down Expand Up @@ -3137,7 +3137,7 @@ public void setListHiddenFiles(final boolean listHiddenFiles) {
* @see <a href="http://tools.ietf.org/html/draft-somers-ftp-mfxx-04">http://tools.ietf.org/html/draft-somers-ftp-mfxx-04</a>
*/
public boolean setModificationTime(final String pathname, final String timeval) throws IOException {
return (FTPReply.isPositiveCompletion(mfmt(pathname, timeval)));
return FTPReply.isPositiveCompletion(mfmt(pathname, timeval));
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ private BufferedReader tunnelHandshake(final String host, final int port, final

String code;
final String resp = response.get(0);
if (!resp.startsWith("HTTP/") || (resp.length() < 12)) {
if (!resp.startsWith("HTTP/") || resp.length() < 12) {
throw new IOException("Invalid response from proxy: " + resp);
}
code = resp.substring(9, 12);
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/org/apache/commons/net/ftp/FTPSClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -714,7 +714,7 @@ private Socket openDataSecureConnection(final String command, final String arg)
return null;
}

if ((getRestartOffset() > 0) && !restart(getRestartOffset())) {
if (getRestartOffset() > 0 && !restart(getRestartOffset())) {
return null;
}

Expand Down Expand Up @@ -795,7 +795,7 @@ private Socket openDataSecureConnection(final String command, final String arg)
sslSocket = context.getSocketFactory().createSocket(socket, getPassiveHost(), getPassivePort(), true);
}

if ((getRestartOffset() > 0) && !restart(getRestartOffset())) {
if (getRestartOffset() > 0 && !restart(getRestartOffset())) {
closeSockets(socket, sslSocket);
return null;
}
Expand Down Expand Up @@ -1025,7 +1025,7 @@ protected void sslNegotiation() throws IOException {
_controlInput_ = new BufferedReader(new InputStreamReader(socket.getInputStream(), getControlEncoding()));
_controlOutput_ = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream(), getControlEncoding()));

if (isClientMode && (hostnameVerifier != null && !hostnameVerifier.verify(_hostname_, socket.getSession()))) {
if (isClientMode && hostnameVerifier != null && !hostnameVerifier.verify(_hostname_, socket.getSession())) {
throw new SSLHandshakeException("Hostname doesn't match certificate");
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ public Calendar parseTimestamp(final String timestampStr, final Calendar serverT
// a valid year (e.g. 22:04 will parse as 22 A.D.)
// so could mistakenly confuse an hour with a year,
// if we don't insist on full length parsing.
if ((parsed == null) || (pp.getIndex() != timestampStr.length())) {
if (parsed == null || pp.getIndex() != timestampStr.length()) {
throw new ParseException("Timestamp '" + timestampStr + "' could not be parsed using a server time of " + serverTime.getTime().toString(),
pp.getErrorIndex());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public FTPFile parseFTPEntry(final String entry) {
return null; // Invalid - no pathname

}
final String parts[] = entry.split(" ", 2); // Path may contain space
final String[] parts = entry.split(" ", 2); // Path may contain space
if (parts.length != 2 || parts[1].isEmpty()) {
return null; // no space found or no file name
}
Expand Down
Loading

0 comments on commit e3013d7

Please sign in to comment.