You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by gg...@apache.org on 2022/12/29 19:20:06 UTC

[commons-vfs] branch master updated: Use Arrays.copyOf()

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-vfs.git


The following commit(s) were added to refs/heads/master by this push:
     new 454f7d7e Use Arrays.copyOf()
454f7d7e is described below

commit 454f7d7e81eff6cf20614f8631ee625e165816eb
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Thu Dec 29 14:20:01 2022 -0500

    Use Arrays.copyOf()
---
 .../apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java   | 3 +--
 .../org/apache/commons/vfs2/provider/ram/CustomRamProviderTest.java    | 3 +--
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java
index 01e5474c..61c7efd1 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/ftp/FtpFileSystemConfigBuilder.java
@@ -616,8 +616,7 @@ public class FtpFileSystemConfigBuilder extends FileSystemConfigBuilder {
     public void setShortMonthNames(final FileSystemOptions options, final String[] shortMonthNames) {
         String[] clone = null;
         if (shortMonthNames != null) {
-            clone = new String[shortMonthNames.length];
-            System.arraycopy(shortMonthNames, 0, clone, 0, shortMonthNames.length);
+            clone = Arrays.copyOf(shortMonthNames, shortMonthNames.length);
         }
 
         setParam(options, SHORT_MONTH_NAMES, clone);
diff --git a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/CustomRamProviderTest.java b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/CustomRamProviderTest.java
index fbfb17e5..bd16cd0e 100644
--- a/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/CustomRamProviderTest.java
+++ b/commons-vfs2/src/test/java/org/apache/commons/vfs2/provider/ram/CustomRamProviderTest.java
@@ -208,8 +208,7 @@ public class CustomRamProviderTest {
         final byte[] buffer = new byte[100];
         assertEquals("Filling buffer failed when file is not empty", NON_EMPTY_FILE_CONTENT.length, input.read(buffer));
 
-        final byte[] expectedBuffer = new byte[100];
-        System.arraycopy(NON_EMPTY_FILE_CONTENT, 0, expectedBuffer, 0, NON_EMPTY_FILE_CONTENT.length);
+        final byte[] expectedBuffer = Arrays.copyOf(NON_EMPTY_FILE_CONTENT, 100);
         assertArrayEquals("Buffer not filled", expectedBuffer, buffer);
 
         Arrays.fill(buffer, (byte) 0);