You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by cl...@apache.org on 2016/04/11 22:52:17 UTC

[1/2] activemq-artemis git commit: This closes #450

Repository: activemq-artemis
Updated Branches:
  refs/heads/master fbff5e7dd -> 39125546e


This closes #450


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/39125546
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/39125546
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/39125546

Branch: refs/heads/master
Commit: 39125546e9efb25a9a4d16b1264710c33173e9d5
Parents: fbff5e7 487b09f
Author: Clebert Suconic <cl...@apache.org>
Authored: Mon Apr 11 16:52:10 2016 -0400
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Apr 11 16:52:10 2016 -0400

----------------------------------------------------------------------
 .../artemis/utils/DefaultSensitiveStringCodec.java      |  4 +---
 .../apache/activemq/artemis/utils/UUIDGenerator.java    |  4 +---
 .../artemis/core/replication/ReplicationEndpoint.java   |  4 +---
 .../artemis/jms/tests/message/SimpleJMSMapMessage.java  |  4 +---
 .../jms/tests/message/SimpleJMSStreamMessage.java       | 12 +++---------
 5 files changed, 7 insertions(+), 21 deletions(-)
----------------------------------------------------------------------



[2/2] activemq-artemis git commit: Replace some manual array copies with System.arraycopy

Posted by cl...@apache.org.
Replace some manual array copies with System.arraycopy


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/487b09fc
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/487b09fc
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/487b09fc

Branch: refs/heads/master
Commit: 487b09fccc031af239e688bcdd2d874282c8cdb3
Parents: fbff5e7
Author: Ville Skyttä <vi...@iki.fi>
Authored: Sun Apr 10 12:34:56 2016 +0300
Committer: Clebert Suconic <cl...@apache.org>
Committed: Mon Apr 11 16:52:10 2016 -0400

----------------------------------------------------------------------
 .../artemis/utils/DefaultSensitiveStringCodec.java      |  4 +---
 .../apache/activemq/artemis/utils/UUIDGenerator.java    |  4 +---
 .../artemis/core/replication/ReplicationEndpoint.java   |  4 +---
 .../artemis/jms/tests/message/SimpleJMSMapMessage.java  |  4 +---
 .../jms/tests/message/SimpleJMSStreamMessage.java       | 12 +++---------
 5 files changed, 7 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/487b09fc/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DefaultSensitiveStringCodec.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DefaultSensitiveStringCodec.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DefaultSensitiveStringCodec.java
index 9fd5c5b..9234136 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DefaultSensitiveStringCodec.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DefaultSensitiveStringCodec.java
@@ -56,9 +56,7 @@ public class DefaultSensitiveStringCodec implements SensitiveDataCodec<String> {
          int pad = newLength - length; // number of leading zeros
          byte[] old = encoding;
          encoding = new byte[newLength];
-         for (int i = old.length - 1; i >= 0; i--) {
-            encoding[i + pad] = old[i];
-         }
+         System.arraycopy(old, 0, encoding, pad, old.length);
       }
 
       Cipher cipher = Cipher.getInstance("Blowfish");

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/487b09fc/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UUIDGenerator.java
----------------------------------------------------------------------
diff --git a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UUIDGenerator.java b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UUIDGenerator.java
index 116a648..ea426db 100644
--- a/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UUIDGenerator.java
+++ b/artemis-commons/src/main/java/org/apache/activemq/artemis/utils/UUIDGenerator.java
@@ -96,9 +96,7 @@ public final class UUIDGenerator {
    public UUID generateTimeBasedUUID(final byte[] byteAddr) {
       byte[] contents = new byte[16];
       int pos = 10;
-      for (int i = 0; i < 6; ++i) {
-         contents[pos + i] = byteAddr[i];
-      }
+      System.arraycopy(byteAddr, 0, contents, pos, 6);
 
       synchronized (mTimerLock) {
          if (mTimer == null) {

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/487b09fc/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java
----------------------------------------------------------------------
diff --git a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java
index 4cc937c..dabe9fd 100644
--- a/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java
+++ b/artemis-server/src/main/java/org/apache/activemq/artemis/core/replication/ReplicationEndpoint.java
@@ -144,9 +144,7 @@ public final class ReplicationEndpoint implements ChannelHandler, ActiveMQCompon
          journals = new Journal[id + 1];
 
          if (oldJournals != null) {
-            for (int i = 0; i < oldJournals.length; i++) {
-               journals[i] = oldJournals[i];
-            }
+            System.arraycopy(oldJournals, 0, journals, 0, oldJournals.length);
          }
       }
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/487b09fc/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSMapMessage.java
----------------------------------------------------------------------
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSMapMessage.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSMapMessage.java
index 5176d0a..1d02f61 100644
--- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSMapMessage.java
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSMapMessage.java
@@ -166,9 +166,7 @@ public class SimpleJMSMapMessage extends SimpleJMSMessage implements MapMessage
          throw new JMSException("Array is too small");
       }
       byte[] temp = new byte[length];
-      for (int i = 0; i < length; i++) {
-         temp[i] = value[i + offset];
-      }
+      System.arraycopy(value, offset, temp, 0, length);
 
       content.put(name, temp);
 

http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/487b09fc/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSStreamMessage.java
----------------------------------------------------------------------
diff --git a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSStreamMessage.java b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSStreamMessage.java
index 4d86fdf..8edf307 100644
--- a/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSStreamMessage.java
+++ b/tests/jms-tests/src/test/java/org/apache/activemq/artemis/jms/tests/message/SimpleJMSStreamMessage.java
@@ -409,9 +409,7 @@ public class SimpleJMSStreamMessage extends SimpleJMSMessage implements StreamMe
          }
 
          if (obj.length - offset < value.length) {
-            for (int i = 0; i < obj.length; i++) {
-               value[i] = obj[i + offset];
-            }
+            System.arraycopy(obj, offset, value, 0, obj.length);
 
             position++;
             offset = 0;
@@ -419,9 +417,7 @@ public class SimpleJMSStreamMessage extends SimpleJMSMessage implements StreamMe
             return obj.length - offset;
          }
          else {
-            for (int i = 0; i < value.length; i++) {
-               value[i] = obj[i + offset];
-            }
+            System.arraycopy(obj, offset, value, 0, value.length);
             offset += value.length;
 
             return value.length;
@@ -545,9 +541,7 @@ public class SimpleJMSStreamMessage extends SimpleJMSMessage implements StreamMe
          throw new JMSException("Array is too small");
       }
       byte[] temp = new byte[length];
-      for (int i = 0; i < length; i++) {
-         temp[i] = value[i + offset];
-      }
+      System.arraycopy(value, offset, temp, 0, length);
 
       content.add(temp);
    }