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 dc2feb91b7081780877ae6decc62795c726f72e4 Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sat Feb 24 13:41:08 2024 -0500 Internal refactoring --- src/main/java/org/apache/commons/net/ftp/FTP.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/apache/commons/net/ftp/FTP.java b/src/main/java/org/apache/commons/net/ftp/FTP.java index a8556b0e..ae4c72c4 100644 --- a/src/main/java/org/apache/commons/net/ftp/FTP.java +++ b/src/main/java/org/apache/commons/net/ftp/FTP.java @@ -904,13 +904,17 @@ public class FTP extends SocketClient { */ public int mode(final int mode) throws IOException { - return sendCommand(FTPCmd.MODE, MODES.substring(mode, mode + 1)); + return sendCommand(FTPCmd.MODE, modeStringAt(mode)); } private char modeCharAt(final int fileType) { return MODES.charAt(fileType); } + private String modeStringAt(final int mode) { + return MODES.substring(mode, mode + 1); + } + /** * A convenience method to send the FTP NLST command to the server, receive the reply, and return the reply code. Remember, it is up to you to manage the * data connection. If you don't need this low level of access, use {@link org.apache.commons.net.ftp.FTPClient} , which will handle all low level details @@ -1405,7 +1409,7 @@ public class FTP extends SocketClient { * @throws IOException If an I/O error occurs while either sending the command or receiving the server reply. */ public int stru(final int structure) throws IOException { - return sendCommand(FTPCmd.STRU, MODES.substring(structure, structure + 1)); + return sendCommand(FTPCmd.STRU, modeStringAt(structure)); } /** @@ -1432,7 +1436,7 @@ public class FTP extends SocketClient { * @throws IOException If an I/O error occurs while either sending the command or receiving the server reply. */ public int type(final int fileType) throws IOException { - return sendCommand(FTPCmd.TYPE, MODES.substring(fileType, fileType + 1)); + return sendCommand(FTPCmd.TYPE, modeStringAt(fileType)); } /**