#3835·floci

Duplicated S3 Filter grammar (Prefix/Tag/And) between IntelligentTiering and Metrics configuration

Author: pgermosenCreated Sep 18, 2026Updated Sep 18, 2026
Labelsenhancements3

Service

S3 (Intelligent-Tiering and Metrics configuration)

Problem

S3IntelligentTieringConfiguration.java and S3MetricsConfiguration.java each independently implement the same S3 Filter sub-resource grammar (Prefix/Tag/And conjuncts) and share an identical tagsXml helper, found via PMD's CPD as an 18-35 line overlapping block. MetricsConfiguration's version also accepts AccessPointArn as an extra conjunct, which IntelligentTieringConfiguration correctly does not support, so the two aren't 100% identical, but the shared filter-parsing skeleton (validate conjunct count, build And, serialize tags) is duplicated.

Suggested fix

Extract the shared filter-parsing/serialization skeleton into a common utility (e.g. under core.common) that both configuration types use, parameterized by which extra conjuncts a given config type supports.

Why is this needed?

Two independent hand-written implementations of the same AWS filter grammar mean a parsing bug fix, or a new conjunct type AWS adds, risks being applied to only one of the two. Found via a CPD pass over src/main.

Are you willing to contribute a PR?

  • Yes
  • No