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/11/25 15:02:35 UTC

[commons-weaver] branch master updated: Use toArray() with 0 size array pattern

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


The following commit(s) were added to refs/heads/master by this push:
     new f94da6f  Use toArray() with 0 size array pattern
f94da6f is described below

commit f94da6f69c31708864587a033fab62cd99fe21e1
Author: Gary Gregory <ga...@gmail.com>
AuthorDate: Fri Nov 25 10:02:32 2022 -0500

    Use toArray() with 0 size array pattern
---
 .../org/apache/commons/weaver/privilizer/example/StaticUsingArgs.java  | 3 ++-
 .../java/org/apache/commons/weaver/privilizer/example/UsingArgs.java   | 3 ++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/privilizer/weaver/src/it/sample/src/main/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgs.java b/modules/privilizer/weaver/src/it/sample/src/main/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgs.java
index c9aa778..0e48f70 100644
--- a/modules/privilizer/weaver/src/it/sample/src/main/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgs.java
+++ b/modules/privilizer/weaver/src/it/sample/src/main/java/org/apache/commons/weaver/privilizer/example/StaticUsingArgs.java
@@ -20,6 +20,7 @@ package org.apache.commons.weaver.privilizer.example;
 
 import java.util.ArrayList;
 
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.weaver.privilizer.Privileged;
 
 
@@ -45,7 +46,7 @@ public abstract class StaticUsingArgs {
         for (String name : names) {
             result.add(System.getProperty(name));
         }
-        return result.toArray(new String[result.size()]);
+        return result.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
     }
 
     @Privileged
diff --git a/modules/privilizer/weaver/src/it/sample/src/main/java/org/apache/commons/weaver/privilizer/example/UsingArgs.java b/modules/privilizer/weaver/src/it/sample/src/main/java/org/apache/commons/weaver/privilizer/example/UsingArgs.java
index 582267e..8e79a1a 100644
--- a/modules/privilizer/weaver/src/it/sample/src/main/java/org/apache/commons/weaver/privilizer/example/UsingArgs.java
+++ b/modules/privilizer/weaver/src/it/sample/src/main/java/org/apache/commons/weaver/privilizer/example/UsingArgs.java
@@ -20,6 +20,7 @@ package org.apache.commons.weaver.privilizer.example;
 
 import java.util.ArrayList;
 
+import org.apache.commons.lang3.ArrayUtils;
 import org.apache.commons.weaver.privilizer.Privileged;
 
 public class UsingArgs {
@@ -40,7 +41,7 @@ public class UsingArgs {
         for (String name : names) {
             result.add(System.getProperty(name));
         }
-        return result.toArray(new String[result.size()]);
+        return result.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
     }
 
     @Privileged