Skip to content

Commit 04621bf

Browse files
committed
fix: switch MacOS to bytes
1 parent cc96ba1 commit 04621bf

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

src/main/java/org/apache/commons/io/FileSystem.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public enum FileSystem {
7373
'/',
7474
':'
7575
// @formatter:on
76-
}, new String[] {}, false, false, '/', NameLengthStrategy.UTF16_CODE_UNITS),
76+
}, new String[] {}, false, false, '/', NameLengthStrategy.BYTES),
7777

7878
/**
7979
* Windows file system.

src/test/java/org/apache/commons/io/FileSystemTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class FileSystemTest {
6262
private static final String FILE_NAME_255_UTF8_BYTES = StringUtils.repeat(UTF8_3BYTE_CHAR, 85);
6363

6464
/** File name of 255 UTF-16 chars, each 3 bytes in UTF-8: total 765 bytes. */
65-
private static final String FILE_NAME_255_UTF16_CHARS = StringUtils.repeat(UTF8_3BYTE_CHAR, 255);
65+
private static final String FILE_NAME_255_UTF16_CODE_UNITS = StringUtils.repeat(UTF8_3BYTE_CHAR, 255);
6666

6767
@Test
6868
void testGetBlockSize() {
@@ -114,9 +114,9 @@ static Stream<Arguments> testIsLegalName_Length() {
114114
Arguments.of(FileSystem.LINUX, FILE_NAME_255_ASCII, UTF_8),
115115
Arguments.of(FileSystem.LINUX, FILE_NAME_255_UTF8_BYTES, UTF_8),
116116
Arguments.of(FileSystem.MAC_OSX, FILE_NAME_255_ASCII, UTF_8),
117-
Arguments.of(FileSystem.MAC_OSX, FILE_NAME_255_UTF16_CHARS, UTF_8),
117+
Arguments.of(FileSystem.MAC_OSX, FILE_NAME_255_UTF8_BYTES, UTF_8),
118118
Arguments.of(FileSystem.WINDOWS, FILE_NAME_255_ASCII, UTF_8),
119-
Arguments.of(FileSystem.WINDOWS, FILE_NAME_255_UTF16_CHARS, UTF_8));
119+
Arguments.of(FileSystem.WINDOWS, FILE_NAME_255_UTF16_CODE_UNITS, UTF_8));
120120
}
121121

122122
@ParameterizedTest
@@ -200,7 +200,7 @@ void testMaxNameLength_MatchesRealSystem(@TempDir Path tempDir) {
200200
break;
201201
case MAC_OSX:
202202
case WINDOWS:
203-
validNames = new String[] { FILE_NAME_255_ASCII, FILE_NAME_255_UTF16_CHARS };
203+
validNames = new String[] { FILE_NAME_255_ASCII, FILE_NAME_255_UTF16_CODE_UNITS};
204204
break;
205205
default:
206206
throw new IllegalStateException("Unexpected value: " + fs);
@@ -282,9 +282,9 @@ static Stream<Arguments> testNameLengthStrategyTruncate() {
282282
Arguments.of(
283283
UTF16_CODE_UNITS,
284284
255,
285-
FILE_NAME_255_UTF16_CHARS + ".txt",
286-
FILE_NAME_255_UTF16_CHARS.substring(0, 251) + ".txt"),
287-
Arguments.of(UTF16_CODE_UNITS, 255, FILE_NAME_255_UTF16_CHARS + "aaaa", FILE_NAME_255_UTF16_CHARS),
285+
FILE_NAME_255_UTF16_CODE_UNITS + ".txt",
286+
FILE_NAME_255_UTF16_CODE_UNITS.substring(0, 251) + ".txt"),
287+
Arguments.of(UTF16_CODE_UNITS, 255, FILE_NAME_255_UTF16_CODE_UNITS + "aaaa", FILE_NAME_255_UTF16_CODE_UNITS),
288288
Arguments.of(
289289
UTF16_CODE_UNITS,
290290
7,

0 commit comments

Comments
 (0)