Skip to content

HDDS-16248. Refactor PutBucketLifecycleConfigurationUnmarshaller to extend MessageUnmarshaller - #11075

Open
ChenSammi wants to merge 1 commit into
apache:masterfrom
ChenSammi:HDDS-16248
Open

HDDS-16248. Refactor PutBucketLifecycleConfigurationUnmarshaller to extend MessageUnmarshaller#11075
ChenSammi wants to merge 1 commit into
apache:masterfrom
ChenSammi:HDDS-16248

Conversation

@ChenSammi

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Refactor PutBucketLifecycleConfigurationUnmarshaller to extend MessageUnmarshaller, to leverage XMLUtils.newSecureSAXParserFactory().

What is the link to the Apache JIRA

https://issues.apache.org/jira/browse/HDDS-16248

How was this patch tested?

existing unit tests

Copilot AI lite review requested due to automatic review settings August 21, 2026 08:17

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request refactors the S3 Gateway’s lifecycle configuration XML parsing to reuse the shared MessageUnmarshaller infrastructure, specifically to ensure parsing uses XMLUtils.newSecureSAXParserFactory() for secure SAX configuration.

Changes:

  • Refactored PutBucketLifecycleConfigurationUnmarshaller to extend MessageUnmarshaller<S3LifecycleConfiguration> instead of implementing MessageBodyReader directly.
  • Simplified BucketLifecycleHandler to invoke the unmarshaller via the new convenience method readFrom(InputStream).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/PutBucketLifecycleConfigurationUnmarshaller.java Replaced custom JAXB/SAX setup with inheritance from MessageUnmarshaller to leverage secure SAX factory and shared namespace handling.
hadoop-ozone/s3gateway/src/main/java/org/apache/hadoop/ozone/s3/endpoint/BucketLifecycleHandler.java Updated lifecycle PUT path to use the unmarshaller’s simpler readFrom(body) entrypoint.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.


private final JAXBContext context;
private final XMLReader xmlReader;
extends MessageUnmarshaller<S3LifecycleConfiguration> {

@rich7420 rich7420 Aug 21, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: add a TestPutBucketLifecycleConfigurationUnmarshaller (with-/without-namespace round-trip) to match MultiDeleteRequestUnmarshaller and CompleteMultipartUploadRequestUnmarshaller; today it's only covered indirectly via TestS3LifecycleConfigurationPut. Also keep "namespace" in the class javadoc — the base still filters on S3_XML_NAMESPACE.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants