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) {
499
499
500
500
@ Override
501
501
public Message annotation (String key , Object value ) {
502
+ Utils .validateMessageAnnotationKey (key );
502
503
callOnDelegate (m -> m .annotation (key , value ));
503
504
return this ;
504
505
}
Original file line number Diff line number Diff line change @@ -100,13 +100,13 @@ private static boolean isJava21OrMore() {
100
100
}
101
101
102
102
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
+ }
110
110
}
111
111
112
112
private static class NamedThreadFactory implements ThreadFactory {
You can’t perform that action at this time.
0 commit comments