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
The following commit(s) were added to refs/heads/master by this push: new 6b29c0be Use constant instead of magic string 6b29c0be is described below commit 6b29c0bed619a34dad55a2dfb6a8b00582bce3ed Author: Gary Gregory <garydgreg...@gmail.com> AuthorDate: Sun Dec 10 12:59:19 2023 -0500 Use constant instead of magic string --- .../apache/commons/net/ftp/parser/NTFTPEntryParserTest.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/test/java/org/apache/commons/net/ftp/parser/NTFTPEntryParserTest.java b/src/test/java/org/apache/commons/net/ftp/parser/NTFTPEntryParserTest.java index ebafc204..02ceb8da 100644 --- a/src/test/java/org/apache/commons/net/ftp/parser/NTFTPEntryParserTest.java +++ b/src/test/java/org/apache/commons/net/ftp/parser/NTFTPEntryParserTest.java @@ -17,6 +17,8 @@ package org.apache.commons.net.ftp.parser; import java.io.ByteArrayInputStream; +import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.Calendar; import org.apache.commons.net.ftp.FTPFile; @@ -185,18 +187,18 @@ public class NTFTPEntryParserTest extends CompositeFTPParseTestFramework { } public void testNET516() throws Exception { // problem where part of a multi-byte char gets converted to 0x85 = line term - final int utf = testNET516("UTF-8"); + final int utf = testNET516(StandardCharsets.UTF_8); assertEquals(LISTFILE_COUNT, utf); - final int ascii = testNET516("ASCII"); + final int ascii = testNET516(StandardCharsets.US_ASCII); assertEquals(LISTFILE_COUNT, ascii); - final int iso8859_1 = testNET516("ISO-8859-1"); + final int iso8859_1 = testNET516(StandardCharsets.ISO_8859_1); assertEquals(LISTFILE_COUNT, iso8859_1); } - private int testNET516(final String charset) throws Exception { + private int testNET516(final Charset charset) throws Exception { final FTPFileEntryParser parser = new NTFTPEntryParser(); final FTPListParseEngine engine = new FTPListParseEngine(parser); - engine.readServerList(new ByteArrayInputStream(listFilesByteTrace), charset); + engine.readServerList(new ByteArrayInputStream(listFilesByteTrace), charset.name()); final FTPFile[] ftpfiles = engine.getFiles(); return ftpfiles.length; }