gemmellr commented on a change in pull request #3851:
URL: https://github.com/apache/activemq-artemis/pull/3851#discussion_r749482106



##########
File path: 
artemis-commons/src/main/java/org/apache/activemq/artemis/utils/DefaultSensitiveStringCodec.java
##########
@@ -79,6 +79,21 @@ public void init(Map<String, String> params) throws 
Exception {
       }
    }
 
+   @Override
+   public boolean compare(Object value, Object encodedValue) {
+      if (encodedValue instanceof String) {
+         if (value instanceof String) {
+            return verify(((String)value).toCharArray(), (String)encodedValue);
+         } else if (value instanceof char[]) {
+            return verify((char[])value, (String)encodedValue);
+         } else {
+            throw new IllegalArgumentException("Unsupported value type: " + 
value.getClass().getName());
+         }
+      } else {
+         throw new IllegalArgumentException("Unsupported encodedValue type: " 
+ encodedValue.getClass().getName());
+      }

Review comment:
       This seems like its missing a bunch of unit tests. Its unclear why it 
should be allowed to pass a char[] given it is implementing 
"SensitiveDataCodec<String>" and assumes its given and returns String when 
encoding and decoding. But if its going to then it should be tested explicitly.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to