Skip to content

Conversation

@rjrudin
Copy link
Contributor

@rjrudin rjrudin commented Nov 5, 2025

Couldn't come up with a test for this, as this only fails on Windows. Added a comment instead. This is the only writer that was improperly doing String concatenation with File.separator. Each other writer was already using a Path object.

Copilot AI review requested due to automatic review settings November 5, 2025 19:14
@github-actions
Copy link

github-actions bot commented Nov 5, 2025

Copyright Validation Results
Total: 1 | Passed: 1 | Failed: 0 | Skipped: 0 | at: 2025-11-05 19:31:08 UTC | commit: 83ebfb3

✅ Valid Files

  • marklogic-spark-connector/src/main/java/com/marklogic/spark/writer/file/ZipFileWriter.java

✅ All files have valid copyright headers!

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a bug where writing zip files to S3 on Windows would fail due to incorrect path separator handling. The issue occurred because string concatenation with File.separator would insert Windows backslashes (\) into S3 URLs.

Key Changes:

  • Replaced string-based path construction with Hadoop Path objects to ensure platform-independent path handling
  • Changed zipFilePath field from String to Path type for type safety
  • Removed unused logger instance and consolidated logging to use Util.MAIN_LOGGER

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

final String timestamp = new SimpleDateFormat("yyyyMMddHHmmssZ").format(new Date());
return String.format("%s%s%s-%d.zip", path, File.separator, timestamp, partitionId);
final String zipFilename = String.format("%s-%d.zip", timestamp, partitionId);
// Fixed a bug in 2.0 by using a Path here instead of string concatenation with File.separator.
Copy link

Copilot AI Nov 5, 2025

Choose a reason for hiding this comment

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

The comment mentions fixing 'a bug in 2.0' but doesn't specify what version this fix is being introduced in. Consider clarifying the version context (e.g., 'Fixed a bug present in 2.0' or 'Fix for bug discovered in 2.0, resolved in 2.1').

Suggested change
// Fixed a bug in 2.0 by using a Path here instead of string concatenation with File.separator.
// Fixed a bug present in 2.0 (where string concatenation with File.separator was used); resolved in 2.1 by using a Path here instead.

Copilot uses AI. Check for mistakes.
Couldn't come up with a test for this, as this only fails on Windows. Added a comment instead. This is the only writer that was improperly doing String concatenation with File.separator. Each other writer was already using a Path object.
@rjrudin rjrudin force-pushed the feature/25073-zip-bug branch from b397be9 to 83ebfb3 Compare November 5, 2025 19:30
@rjrudin rjrudin merged commit 37e2724 into develop Nov 5, 2025
2 of 3 checks passed
@rjrudin rjrudin deleted the feature/25073-zip-bug branch November 5, 2025 19:37
@sonarqube-progress-marklogic
Copy link

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