This is an automated email from the ASF dual-hosted git repository.

xqhu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/beam.git


The following commit(s) were added to refs/heads/master by this push:
     new 914e425b26d Fix #21317: Replace colons with underscores in window 
filenames for Windows compatibility (#37821)
914e425b26d is described below

commit 914e425b26daf26603bd5d0b5020b1c0ecd7a50c
Author: liferoad <[email protected]>
AuthorDate: Sun Mar 15 14:20:57 2026 -0400

    Fix #21317: Replace colons with underscores in window filenames for Windows 
compatibility (#37821)
---
 .../java/org/apache/beam/sdk/io/DefaultFilenamePolicy.java    | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git 
a/sdks/java/core/src/main/java/org/apache/beam/sdk/io/DefaultFilenamePolicy.java
 
b/sdks/java/core/src/main/java/org/apache/beam/sdk/io/DefaultFilenamePolicy.java
index 77e667e88ee..1573a34c884 100644
--- 
a/sdks/java/core/src/main/java/org/apache/beam/sdk/io/DefaultFilenamePolicy.java
+++ 
b/sdks/java/core/src/main/java/org/apache/beam/sdk/io/DefaultFilenamePolicy.java
@@ -353,7 +353,16 @@ public final class DefaultFilenamePolicy extends 
FilenamePolicy {
     }
     if (window instanceof IntervalWindow) {
       IntervalWindow iw = (IntervalWindow) window;
-      return String.format("%s-%s", iw.start().toString(), 
iw.end().toString());
+      // Use ISO-8601 format but replace colons with underscores for Windows 
compatibility
+      // since colons are illegal characters in Windows file paths.
+      String startStr = iw.start().toString();
+      String endStr = iw.end().toString();
+      String osName = System.getProperty("os.name");
+      if (osName != null && osName.startsWith("Windows")) {
+        startStr = startStr.replace(':', '_');
+        endStr = endStr.replace(':', '_');
+      }
+      return String.format("%s-%s", startStr, endStr);
     }
     return window.toString();
   }

Reply via email to