You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@camel.apache.org by da...@apache.org on 2023/03/28 17:03:51 UTC

[camel] branch main updated: CAMEL-19194: camel-crypto: Remove not used method that was faulty.

This is an automated email from the ASF dual-hosted git repository.

davsclaus pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/camel.git


The following commit(s) were added to refs/heads/main by this push:
     new ecbb0f165b4 CAMEL-19194: camel-crypto: Remove not used method that was faulty.
ecbb0f165b4 is described below

commit ecbb0f165b441564ea1b7e5a3b97c5a7153c4650
Author: Claus Ibsen <cl...@gmail.com>
AuthorDate: Tue Mar 28 19:03:11 2023 +0200

    CAMEL-19194: camel-crypto: Remove not used method that was faulty.
---
 .../org/apache/camel/converter/crypto/HMACAccumulator.java  | 11 -----------
 .../apache/camel/converter/crypto/HMACAccumulatorTest.java  | 13 -------------
 2 files changed, 24 deletions(-)

diff --git a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/HMACAccumulator.java b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/HMACAccumulator.java
index 02e0cff4c1b..c8423626a11 100644
--- a/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/HMACAccumulator.java
+++ b/components/camel-crypto/src/main/java/org/apache/camel/converter/crypto/HMACAccumulator.java
@@ -160,17 +160,6 @@ public class HMACAccumulator {
             return 0;
         }
 
-        public boolean compareTo(byte[] compare, int pos, int len) {
-            boolean equal = false;
-            if (len <= availableForRead()) {
-                int x = 0;
-                while (equal && x < len) {
-                    equal = compare[pos + x] != buffer[read + x % buffer.length];
-                }
-            }
-            return equal;
-        }
-
         public int availableForRead() {
             return buffer.length - available;
         }
diff --git a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/HMACAccumulatorTest.java b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/HMACAccumulatorTest.java
index 54f93714c37..c0a8dec3995 100644
--- a/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/HMACAccumulatorTest.java
+++ b/components/camel-crypto/src/test/java/org/apache/camel/converter/crypto/HMACAccumulatorTest.java
@@ -27,7 +27,6 @@ import org.apache.camel.converter.crypto.HMACAccumulator.CircularBuffer;
 import org.junit.jupiter.api.BeforeEach;
 import org.junit.jupiter.api.Test;
 
-import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
 public class HMACAccumulatorTest {
@@ -162,18 +161,6 @@ public class HMACAccumulatorTest {
         assertEquals(0, buffer.read(data, 0, data.length));
     }
 
-    @Test
-    void testBufferCompare() {
-        assertDoesNotThrow(() -> doBufferCompare());
-    }
-
-    private void doBufferCompare() {
-        CircularBuffer buffer = new CircularBuffer(payload.length * 2);
-        buffer.write(new byte[payload.length >> 1], 0, payload.length >> 1);
-        buffer.write(payload, 0, payload.length);
-        buffer.compareTo(payload, 0, payload.length);
-    }
-
     private byte[] initializeBuffer(int buffersize) {
         byte[] buffer = new byte[buffersize];
         System.arraycopy(payload, 0, buffer, 0, payload.length);