File tree Expand file tree Collapse file tree 2 files changed +8
-7
lines changed
src/main/java/com/rabbitmq/client/amqp/impl Expand file tree Collapse file tree 2 files changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -499,6 +499,7 @@ public Object annotation(String key) {
499499
500500 @ Override
501501 public Message annotation (String key , Object value ) {
502+ Utils .validateMessageAnnotationKey (key );
502503 callOnDelegate (m -> m .annotation (key , value ));
503504 return this ;
504505 }
Original file line number Diff line number Diff line change @@ -100,13 +100,13 @@ private static boolean isJava21OrMore() {
100100 }
101101
102102 static void checkMessageAnnotations (Map <String , Object > annotations ) {
103- annotations .forEach (
104- ( k , v ) -> {
105- if (! k . startsWith ( "x-" )) {
106- throw new IllegalArgumentException (
107- "Message annotation keys must start with 'x-': " + k );
108- }
109- });
103+ annotations .forEach (( k , v ) -> validateMessageAnnotationKey ( k ));
104+ }
105+
106+ static void validateMessageAnnotationKey ( String key ) {
107+ if (! key . startsWith ( "x-" )) {
108+ throw new IllegalArgumentException ( "Message annotation keys must start with 'x-': " + key );
109+ }
110110 }
111111
112112 private static class NamedThreadFactory implements ThreadFactory {
You can’t perform that action at this time.
0 commit comments