Mikkey-f opened a new issue, #1021:
URL: https://github.com/apache/fesod/issues/1021

   ### Search before asking
   
   - [x] I searched in the issues and found nothing similar.
   
   ### Fesod version
   
   main (latest)
   
   ### JDK version
   
   17 (Temurin)
   
   ### Operating system
   
   Windows 11
   
   ### Steps To Reproduce
   
   Run `mvn test -Dmaven.test.skip=false` and `mvn verify` on Windows:
   - `fesod-sheet` module: `FillDataTest.simpleFill(ExcelFormat)[3]` (CSV 
variant) fails — JUnit reports `Failed to close extension context`: the temp 
CSV file cannot be deleted because it is still locked
   - `fesod-examples/fesod-sheet-examples`: `FillBasicExampleITCase` and 
`FillComplexExampleITCase` fail with `ExcelGenerateException: Copy template 
failure`
   
   CI (Ubuntu) is green, so these are Windows-specific failures.
   
   ### Current Behavior
   
   **1. Output stream leak on the CSV+template exception path (product bug, not 
limited to Windows):**
   `WriteWorkbookHolder`'s constructor opens the output stream first (`new 
FileOutputStream(file)`, 
[WriteWorkbookHolder.java#L197](https://github.com/apache/fesod/blob/main/fesod-sheet/src/main/java/org/apache/fesod/sheet/write/metadata/holder/WriteWorkbookHolder.java#L197))
 and then calls `copyTemplate()`, which throws `ExcelGenerateException("csv 
cannot use template.")` for CSV + template combinations 
([WriteWorkbookHolder.java#L278](https://github.com/apache/fesod/blob/main/fesod-sheet/src/main/java/org/apache/fesod/sheet/write/metadata/holder/WriteWorkbookHolder.java#L278)).
 The exception aborts the constructor and the stream is never closed. The file 
handle is leaked on every platform; on Windows the file stays locked, which 
surfaces as the `FillDataTest` failure when JUnit's @TempDir cleanup cannot 
delete the file.
   
   **2. `URL.getPath()` returns a URL-encoded path on Windows (example 
infrastructure bug):**
   `ExampleFileUtil.getExamplePath(...)` resolves classpath resources via 
`getResource(...).getPath()`. On Windows the resource URL encodes the path 
separator as `%5c` (e.g. `.../example/templates%5csimple.xlsx`), so the 
returned path is never decoded and `new File(...)` throws 
`FileNotFoundException`. Example fill templates cannot be loaded on Windows at 
all.
   
   ### Expected Behavior
   
   - The output stream should be closed when the constructor aborts 
(exception-safe resource handling), so no file handle is leaked and Windows 
tests pass.
   - `ExampleFileUtil` should return a properly decoded path (e.g. via 
`URL.toURI()`), so examples work on Windows.
   
   ### Anything else?
   
   Both are reproducible on a clean checkout on Windows 11. The stream leak in 
(1) is a cross-platform resource leak that CI currently masks.
   
   ### Are you willing to submit a PR?
   
   - [ ] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to