Skip to content

Java modernization with Claude#128

Open
dunedodo wants to merge 36 commits into
masterfrom
feature-java-modernization-claude
Open

Java modernization with Claude#128
dunedodo wants to merge 36 commits into
masterfrom
feature-java-modernization-claude

Conversation

@dunedodo

@dunedodo dunedodo commented May 6, 2026

Copy link
Copy Markdown
Contributor

No description provided.

dunedodo and others added 14 commits February 25, 2026 19:12
Added deleteObjectTolerateRetention retry logic in AbstractS3ClientTest to handle ECS "under retention" errors during test cleanup. Moved D@RE license probe to top of testCopyRangeAPI to prevent cleanup failures when test is skipped due to missing D@RE license.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Comment thread src/main/java/com/emc/object/s3/jersey/S3JerseyClient.java
dunedodo added 2 commits May 8, 2026 10:35
…ents

Changes:
- S3JerseyClient: new constructor accepting ConnectorProvider; sets
  sun.net.http.allowRestrictedHeaders=true when HttpUrlConnectorProvider
  is used (required for V4 Host header pass-through); added response.close()
  in executeRequest() finally block to prevent connection reuse corruption.
- S3EncryptionClient: new constructor accepting ConnectorProvider, delegating
  to S3JerseyClient for connector-aware client creation.
- S3SignerV4: whitelist signed headers (host, content-type, content-md5,
  x-amz-*, x-emc-*) instead of signing all headers except authorization.
  HTTP connectors may modify standard headers after signing.
- CodecFilter: removed premature x-amz-meta-* header addition that caused
  V2/V4 signature mismatch with HttpUrlConnector's lazy commit; added
  FilterOutputStream wrapper to strip Content-Length before commit to
  prevent invalid chunked+content-length header combination.
- Test classes updated to use HttpUrlConnectorProvider via new constructor.
- log4j2.xml: enable debug logging for S3Signer and ErrorFilter.
@dunedodo dunedodo requested a review from xiaoxin-ren June 12, 2026 14:40

@xiaoxin-ren xiaoxin-ren 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.

I don't get chance to review all the changes. Conditional approve as the issue raised by my comment #128 (comment) has been addressed.

@sweetymahale

sweetymahale commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Hi @xiaoxin-ren @twincitiesguy,
We have updated the code to fix failing test cases and updated the smart-client dependency version
to com.emc.ecs:smart-client-ecs:4.0.0

Test result for IAM user

Screenshot 2026-06-26 192506

Test result for non-IAM user

Screenshot 2026-06-26 192712 image (1)

CC: @sushilpawar999 @adityakansa

Comment thread src/main/java/com/emc/object/s3/jersey/ChecksumFilter.java Outdated
Comment thread src/test/java/com/emc/object/s3/ExtendedConfigTest.java Outdated
Comment thread src/test/java/com/emc/object/s3/GeoPinningTest.java Outdated
Comment thread src/test/java/com/emc/object/s3/GeoPinningV4Test.java
Comment thread src/test/java/com/emc/object/s3/WriteTruncationTest.java Outdated
Comment thread src/test/java/com/emc/object/s3/WriteTruncationV4Test.java Outdated
Comment thread src/test/resources/log4j2.xml
Comment thread .gitignore Outdated
Comment thread build.gradle Outdated
Comment thread src/test/java/com/emc/object/s3/S3JerseyClientTest.java Outdated
Comment thread src/main/java/com/emc/object/s3/jersey/ErrorFilter.java
Comment thread src/main/java/com/emc/object/s3/request/PutObjectRequest.java Outdated
Comment thread src/main/java/com/emc/object/s3/jersey/CodecFilter.java Outdated
Comment thread src/main/java/com/emc/object/s3/jersey/CodecFilter.java Outdated
Comment thread src/main/java/com/emc/object/s3/jersey/CodecFilter.java Outdated
Comment thread src/test/java/com/emc/object/s3/ChecksumFilterTest.java

Boolean verifyWrite = (Boolean) requestContext.getProperty(RestUtil.PROPERTY_VERIFY_WRITE_CHECKSUM);
if (verifyWrite != null && verifyWrite && md5Header != null) {
RunningChecksum checksum = (RunningChecksum) requestContext.getProperty(PROP_WRITE_CHECKSUM);

@twincitiesguy twincitiesguy Jun 28, 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.

This needs test coverage to ensure the checksum propagates contexts between WriterInterceptorContext and ClientRequestContext. I don't see any direct test coverage for failure cases in this filter - how do you know this filter works properly and throws an exception when the checksum doesn't match?

This is a critical SDK behavior to detect write-path corruption.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

We have added new testcases in ChecksumFilterTest

Comment thread src/main/java/com/emc/object/s3/jersey/CodecFilter.java
Comment thread src/test/java/com/emc/object/s3/GeoPinningTest.java Outdated
Comment thread src/test/java/com/emc/object/s3/S3JerseyClientTest.java Outdated
Comment thread src/test/java/com/emc/object/s3/S3JerseyClientTest.java
Comment thread src/test/java/com/emc/object/s3/S3JerseyClientTest.java Outdated
Comment thread src/main/java/com/emc/object/s3/jersey/RetryFilter.java Outdated
Comment thread src/main/java/com/emc/object/AbstractJerseyClient.java Outdated
Comment thread src/test/java/com/emc/object/s3/ErrorFilterTest.java
Comment thread src/test/java/com/emc/object/s3/S3V2AuthUtilTest.java Outdated
if (entity instanceof InputStream) {
int bufSize = getRetryBufferSize();
InputStream is = (InputStream) entity;
InputStream buffered = is.markSupported() ? is : new BufferedInputStream(is, bufSize);

@twincitiesguy twincitiesguy Jul 2, 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.

  1. the original RetryFilter logic does not wrap the stream, it calls mark directly on the entity stream
  2. this code does not replace the entity stream with the buffered stream anyway, so it essentially has no effect

@SuppressWarnings("unchecked")
protected ClientResponse executeRequest(Client client, ObjectRequest request) {
protected Response executeRequest(Client client, ObjectRequest request) {
boolean retryEnabled = isRetryEnabled();

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.

I made a mistake previously when suggesting to move the RetryFilter logic to this class. It is actually an S3-specific filter, so should go in S3JerseyClient instead. That will also make retry config variables (retryLimit, retryBufferSize, initialRetryDelay) all accessible from S3Config.

|| e.getMessage().startsWith("Connection reset by peer")
|| e.getMessage().startsWith("Software caused connection abort")))
continue;
// Java 25+ HttpURLConnection throws IOException instead of SocketException on abort

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.

i think this check is not needed now that we removed support for HttpURLConnectionProvider

@Override
public ListDataNode listDataNodes() {
return executeRequest(client, new ObjectRequest(Method.GET, "", "endpoint"), ListDataNode.class);
protected boolean isRetryEnabled() {

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.

isRetryEnabled() itself is likely unnecessary if retry logic is moved to this class from AbstractJerseyClient

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.

6 participants