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


The following commit(s) were added to refs/heads/master by this push:
     new 29fd5da  Simplify array cloning.
29fd5da is described below

commit 29fd5da340c91dfb78f5903ec70935d6ab1f644a
Author: Gary Gregory <[email protected]>
AuthorDate: Sat Jan 2 18:27:12 2021 -0500

    Simplify array cloning.
---
 .../apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java  | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
 
b/src/main/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
index ba9af9a..bbf1947 100644
--- 
a/src/main/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
+++ 
b/src/main/java/org/apache/commons/dbutils/wrappers/SqlNullCheckedResultSet.java
@@ -220,9 +220,7 @@ public class SqlNullCheckedResultSet implements 
InvocationHandler {
         if (this.nullBytes == null) {
             return null;
         }
-        final byte[] copy = new byte[this.nullBytes.length];
-        System.arraycopy(this.nullBytes, 0, copy, 0, this.nullBytes.length);
-        return copy;
+        return this.nullBytes.clone();
     }
 
     /**
@@ -466,9 +464,7 @@ public class SqlNullCheckedResultSet implements 
InvocationHandler {
      */
     public void setNullBytes(final byte[] nullBytes) {
         if (nullBytes != null) {
-            final byte[] copy = new byte[nullBytes.length];
-            System.arraycopy(nullBytes, 0, copy, 0, nullBytes.length);
-            this.nullBytes = copy;
+            this.nullBytes = nullBytes.clone();
         } else {
             this.nullBytes = null;
         }

Reply via email to