Skip to content

Conversation

@osadchuk-andrii
Copy link

Summary

Enable parsing of additional date formats (including nanosecond precision) in CopyObjectResult.
This makes the minio-java client compatible with SeaweedFS responses.

Problem

Currently, ResponseDate parses only two formats:

"yyyy-MM-dd'T'HH':'mm':'ss'.'SSS'Z'" 
"yyyy-MM-dd'T'HH':'mm':'ss'Z'"

If the date contains nanoseconds, parsing fails with a DateTimeParseException:

io.minio.errors.XmlParserException: java.time.format.DateTimeParseException: Text '2025-08-23T12:22:54.239913137Z' could not be parsed at index 19
	at io.minio.Xml.unmarshal(Xml.java:55)

Example

SeaweedFS response (nanoseconds):

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<CopyObjectResult>
    <LastModified>2025-08-23T11:26:27.109253154Z</LastModified>
    <ETag>03da054f179eed855c27d7d6b2041e2a</ETag>
</CopyObjectResult>

MinIO response (milliseconds):

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<CopyObjectResult xmlns="http://s3.amazonaws.com/doc/2006-03-01/">
    <LastModified>2025-08-23T11:27:44.684Z</LastModified>
    <ETag>"03da054f179eed855c27d7d6b2041e2a"</ETag>
</CopyObjectResult>

Both are valid according to the S3 API spec (LastModified is any string DateTime parsable by strtotime).

Solution

Use ZonedDateTime.parse without a custom formatter.
It falls back to ISO_ZONED_DATE_TIME and supports all previously accepted formats as well as those with nanoseconds.
Additionally, it simplifies the code.

Compatibility

No breaking changes - existing formats continue to be parsed correctly.

@osadchuk-andrii osadchuk-andrii force-pushed the improve-response-date-parsing branch from 75e1eb8 to b2469bf Compare August 23, 2025 14:47
@harshavardhana
Copy link
Member

Please fix the CI issues @osadchuk-andrii Thank you.

@osadchuk-andrii osadchuk-andrii force-pushed the improve-response-date-parsing branch from b2469bf to 494e216 Compare August 24, 2025 19:42
@osadchuk-andrii
Copy link
Author

@harshavardhana I’ve run the checks twice in the forked repo, and they all passed: osadchuk-andrii#1
Could we just rerun the checks again?

Copy link
Member

@balamurugana balamurugana left a comment

Choose a reason for hiding this comment

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

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