db-derby-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kahat...@apache.org
Subject svn commit: r1070677 - in /db/derby/code/trunk/java: client/org/apache/derby/client/am/ drda/org/apache/derby/impl/drda/ engine/org/apache/derby/iapi/sql/dictionary/ engine/org/apache/derby/impl/jdbc/
Date Mon, 14 Feb 2011 21:40:29 GMT
Author: kahatlen
Date: Mon Feb 14 21:40:28 2011
New Revision: 1070677

URL: http://svn.apache.org/viewvc?rev=1070677&view=rev
Log:
DERBY-5033: System.arraycopy, being native, is more performant

Fix based on patch contributed by Dave Brosius <dbrosius@apache.org>.

Modified:
    db/derby/code/trunk/java/client/org/apache/derby/client/am/EncryptionManager.java
    db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DecryptionManager.java
    db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConglomerateDescriptorList.java
    db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java

Modified: db/derby/code/trunk/java/client/org/apache/derby/client/am/EncryptionManager.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/client/org/apache/derby/client/am/EncryptionManager.java?rev=1070677&r1=1070676&r2=1070677&view=diff
==============================================================================
--- db/derby/code/trunk/java/client/org/apache/derby/client/am/EncryptionManager.java (original)
+++ db/derby/code/trunk/java/client/org/apache/derby/client/am/EncryptionManager.java Mon
Feb 14 21:40:28 2011
@@ -223,16 +223,12 @@ public class EncryptionManager {
         //USRENCPWD, the userid is used as token
         if (securityMechanism == 7) {
             if (initVector.length < 8) { //shorter than 8 bytes, zero padded to 8 bytes
-                for (int i = 0; i < initVector.length; i++) {
-                    token[i] = initVector[i];
-                }
+                System.arraycopy(initVector, 0, token, 0, initVector.length);
                 for (int i = initVector.length; i < 8; i++) {
                     token[i] = 0;
                 }
             } else {  //longer than 8 bytes, truncated to 8 bytes
-                for (int i = 0; i < 8; i++) {
-                    token[i] = initVector[i];
-                }
+                System.arraycopy(initVector, 0, token, 0, 8);
             }
         }
         //EUSRIDPWD - The middle 8 bytes of the server's connection key is used as

Modified: db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DecryptionManager.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DecryptionManager.java?rev=1070677&r1=1070676&r2=1070677&view=diff
==============================================================================
--- db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DecryptionManager.java (original)
+++ db/derby/code/trunk/java/drda/org/apache/derby/impl/drda/DecryptionManager.java Mon Feb
14 21:40:28 2011
@@ -213,14 +213,12 @@ class DecryptionManager
     //USRENCPWD, the userid is used as token
     if (securityMechanism == 7) {
       if (initVector.length < 8) { //shorter than 8 bytes, zero padded to 8 bytes
-		for (int i=0; i<initVector.length; i++)
-		  token[i] = initVector[i];
+        System.arraycopy(initVector, 0, token, 0, initVector.length);
 		for (int i=initVector.length; i<8; i++)
 	 	 token[i] = 0;
       }
       else {  //longer than 8 bytes, truncated to 8 bytes
-		for (int i=0; i<8; i++)
-		  token[i] = initVector[i];
+        System.arraycopy(initVector, 0, token, 0, 8);
       }
     }
     //EUSRIDPWD - The middle 8 bytes of the server's connection key is used as

Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConglomerateDescriptorList.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConglomerateDescriptorList.java?rev=1070677&r1=1070676&r2=1070677&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConglomerateDescriptorList.java
(original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/sql/dictionary/ConglomerateDescriptorList.java
Mon Feb 14 21:40:28 2011
@@ -89,8 +89,7 @@ public class ConglomerateDescriptorList 
 		if (j == size)
 			return draft;
 		ConglomerateDescriptor[] returnValue = new ConglomerateDescriptor[j];
-		for (int i = 0; i < j; i++)
-			returnValue[i] = draft[i];
+        System.arraycopy(draft, 0, returnValue, 0, j);
 
 		return returnValue;
 	}
@@ -181,8 +180,7 @@ public class ConglomerateDescriptorList 
 		if (j == size)
 			return draft;
 		ConglomerateDescriptor[] returnValue = new ConglomerateDescriptor[j];
-		for (int i = 0; i < j; i++)
-			returnValue[i] = draft[i];
+        System.arraycopy(draft, 0, returnValue, 0, j);
 
 		return returnValue;
 	}

Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java?rev=1070677&r1=1070676&r2=1070677&view=diff
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/jdbc/EmbedStatement.java Mon Feb
14 21:40:28 2011
@@ -1003,10 +1003,7 @@ public class EmbedStatement extends Conn
 			}
 
 			int successfulUpdateCount[] = new int[i];
-			for (int j=0; j<i; j++)
-			{
-				successfulUpdateCount[j] = returnUpdateCountForBatch[j];
-			}
+            System.arraycopy(returnUpdateCountForBatch, 0, successfulUpdateCount, 0, i);
 
 			SQLException batch =
 			new java.sql.BatchUpdateException(sqle.getMessage(), sqle.getSQLState(),



Mime
View raw message