Java modernization with Claude#128
Conversation
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>
…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.
xiaoxin-ren
left a comment
There was a problem hiding this comment.
I don't get chance to review all the changes. Conditional approve as the issue raised by my comment #128 (comment) has been addressed.
…-fixes Java modernization - Implement review comments and fix testcases
|
Hi @xiaoxin-ren @twincitiesguy, Test result for IAM user
Test result for non-IAM user
|
…-review-fix Fix review comments of source and test
|
|
||
| Boolean verifyWrite = (Boolean) requestContext.getProperty(RestUtil.PROPERTY_VERIFY_WRITE_CHECKSUM); | ||
| if (verifyWrite != null && verifyWrite && md5Header != null) { | ||
| RunningChecksum checksum = (RunningChecksum) requestContext.getProperty(PROP_WRITE_CHECKSUM); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
We have added new testcases in ChecksumFilterTest
…-review-fix Fix code review comment
| if (entity instanceof InputStream) { | ||
| int bufSize = getRetryBufferSize(); | ||
| InputStream is = (InputStream) entity; | ||
| InputStream buffered = is.markSupported() ? is : new BufferedInputStream(is, bufSize); |
There was a problem hiding this comment.
- the original RetryFilter logic does not wrap the stream, it calls mark directly on the entity stream
- 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(); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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() { |
There was a problem hiding this comment.
isRetryEnabled() itself is likely unnecessary if retry logic is moved to this class from AbstractJerseyClient



No description provided.