directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From plusplusjia...@apache.org
Subject directory-kerby git commit: Fix code analysis issue: System.arraycopy is more efficient.
Date Tue, 05 Jan 2016 08:13:13 GMT
Repository: directory-kerby
Updated Branches:
  refs/heads/trunk 14cb4d25e -> 2320695db


Fix code analysis issue: System.arraycopy is more efficient.


Project: http://git-wip-us.apache.org/repos/asf/directory-kerby/repo
Commit: http://git-wip-us.apache.org/repos/asf/directory-kerby/commit/2320695d
Tree: http://git-wip-us.apache.org/repos/asf/directory-kerby/tree/2320695d
Diff: http://git-wip-us.apache.org/repos/asf/directory-kerby/diff/2320695d

Branch: refs/heads/trunk
Commit: 2320695dbce7b48bce0e143042f3df26555c2edc
Parents: 14cb4d2
Author: plusplusjiajia <jiajia.li@intel.com>
Authored: Tue Jan 5 16:20:03 2016 +0800
Committer: plusplusjiajia <jiajia.li@intel.com>
Committed: Tue Jan 5 16:20:03 2016 +0800

----------------------------------------------------------------------
 .../java/org/apache/kerby/kerberos/kerb/crypto/dh/DhClient.java  | 4 +---
 .../java/org/apache/kerby/kerberos/kerb/crypto/dh/DhServer.java  | 4 +---
 2 files changed, 2 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/2320695d/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/dh/DhClient.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/dh/DhClient.java
b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/dh/DhClient.java
index f1ddc40..27eced2 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/dh/DhClient.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/dh/DhClient.java
@@ -115,9 +115,7 @@ public class DhClient {
     private byte[] concatenateBytes(byte[] array1, byte[] array2) {
         byte[] concatenatedBytes = new byte[array1.length + array2.length];
 
-        for (int i = 0; i < array1.length; i++) {
-            concatenatedBytes[i] = array1[i];
-        }
+        System.arraycopy(array1, 0, concatenatedBytes, 0, array1.length);
 
         for (int j = array1.length; j < concatenatedBytes.length; j++) {
             concatenatedBytes[j] = array2[j - array1.length];

http://git-wip-us.apache.org/repos/asf/directory-kerby/blob/2320695d/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/dh/DhServer.java
----------------------------------------------------------------------
diff --git a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/dh/DhServer.java
b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/dh/DhServer.java
index a876b5d..c2057a7 100644
--- a/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/dh/DhServer.java
+++ b/kerby-kerb/kerb-crypto/src/main/java/org/apache/kerby/kerberos/kerb/crypto/dh/DhServer.java
@@ -113,9 +113,7 @@ public class DhServer {
     private byte[] concatenateBytes(byte[] array1, byte[] array2) {
         byte[] concatenatedBytes = new byte[array1.length + array2.length];
 
-        for (int i = 0; i < array1.length; i++) {
-            concatenatedBytes[i] = array1[i];
-        }
+        System.arraycopy(array1, 0, concatenatedBytes, 0, array1.length);
 
         for (int j = array1.length; j < concatenatedBytes.length; j++) {
             concatenatedBytes[j] = array2[j - array1.length];


Mime
View raw message