Skip to content

Commit d2b6fec

Browse files
committed
Merge branch '7.5.x'
2 parents 929452c + 8891fbc commit d2b6fec

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

client-encryption/src/test/java/io/confluent/kafka/schemaregistry/encryption/FieldEncryptionExecutorTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,8 @@ public void testKafkaAvroSerializerRuleWithSameTag() throws Exception {
490490
avroSchema = avroSchema.copy(metadata, ruleSet);
491491
schemaRegistry.register(topic + "-value", avroSchema);
492492

493-
int expectedEncryptionsRule1 = 0;
494-
int expectedEncryptionsRule2 = 1;
493+
int expectedEncryptionsRule1 = 1;
494+
int expectedEncryptionsRule2 = 0;
495495
RecordHeaders headers = new RecordHeaders();
496496
Cryptor cryptor = addSpyToCryptor(avroSerializer, "rule1");
497497
Cryptor cryptor2 = addSpyToCryptor(avroSerializer, "rule2");

client/src/main/java/io/confluent/kafka/schemaregistry/rules/FieldRuleExecutor.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -35,24 +35,24 @@ default Object transform(RuleContext ctx, Object message) throws RuleException {
3535
switch (ctx.ruleMode()) {
3636
case WRITE:
3737
case UPGRADE:
38-
for (int i = ctx.index() + 1; i < ctx.rules().size(); i++) {
38+
for (int i = 0; i < ctx.index(); i++) {
3939
Rule otherRule = ctx.rules().get(i);
4040
if (areTransformsWithSameTags(ctx.rule(), otherRule)) {
41-
// ignore this transform if a later one has the same tags
42-
log.debug("Ignoring rule '{}' during {} as rule '{}' has the same tag(s) and "
43-
+ "overrides it", ctx.rule().getName(), ctx.ruleMode(), otherRule.getName());
41+
// ignore this transform if an earlier one has the same tags
42+
log.debug("Ignoring rule '{}' during {} as rule '{}' has the same tag(s)",
43+
ctx.rule().getName(), ctx.ruleMode(), otherRule.getName());
4444
return message;
4545
}
4646
}
4747
break;
4848
case READ:
4949
case DOWNGRADE:
50-
for (int i = 0; i < ctx.index(); i++) {
50+
for (int i = ctx.index() + 1; i < ctx.rules().size(); i++) {
5151
Rule otherRule = ctx.rules().get(i);
5252
if (areTransformsWithSameTags(ctx.rule(), otherRule)) {
53-
// ignore this transform if an earlier one has the same tags
54-
log.debug("Ignoring rule '{}' during {} as rule '{}' has the same tag(s) and "
55-
+ "overrides it", ctx.rule().getName(), ctx.ruleMode(), otherRule.getName());
53+
// ignore this transform if a later one has the same tags
54+
log.debug("Ignoring rule '{}' during {} as rule '{}' has the same tag(s)",
55+
ctx.rule().getName(), ctx.ruleMode(), otherRule.getName());
5656
return message;
5757
}
5858
}

schema-rules/src/test/java/io/confluent/kafka/schemaregistry/rules/cel/CelExecutorTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -842,10 +842,10 @@ public void testKafkaAvroSerializerReflectionFieldTransformWithSameTag() throws
842842
Schema schema = createWidgetSchema();
843843
AvroSchema avroSchema = new AvroSchema(schema);
844844
Rule rule = new Rule("myRule", null, RuleKind.TRANSFORM, RuleMode.WRITE,
845-
CelFieldExecutor.TYPE, ImmutableSortedSet.of("PII"), null, "value + \"-suffix\"",
845+
CelFieldExecutor.TYPE, ImmutableSortedSet.of("PII"), null, "value + \"-suffix2\"",
846846
null, null, false);
847847
Rule rule2 = new Rule("myRule2", null, RuleKind.TRANSFORM, RuleMode.WRITE,
848-
CelFieldExecutor.TYPE, ImmutableSortedSet.of("PII"), null, "value + \"-suffix2\"",
848+
CelFieldExecutor.TYPE, ImmutableSortedSet.of("PII"), null, "value + \"-suffix\"",
849849
null, null, false);
850850
RuleSet ruleSet = new RuleSet(Collections.emptyList(), ImmutableList.of(rule, rule2));
851851
avroSchema = avroSchema.copy(null, ruleSet);

0 commit comments

Comments
 (0)