Mikkey-f opened a new pull request, #1034:
URL: https://github.com/apache/fesod/pull/1034
### What and why
Fixes the `Copy template failure` errors that the fill examples
(`FillBasicExample`, `FillComplexExample`) hit on Windows. Two root causes:
**1. `WriteWorkbookHolder` leaks the output stream it opens when
initialization fails**
The constructor opens a `FileOutputStream` for the target file before copying
the template. When the copy fails (or any later initialization step throws),
the stream was never closed — the file stays locked on Windows. Unix lets you
delete an open file, which is why CI stayed green. This is a cross-platform
resource leak; Windows just surfaces it first.
Fix: wrap `initHandler` + `copyTemplate` so the stream opened by the holder
is
closed before the exception propagates. Caller-provided streams are
untouched —
ownership stays with the caller.
**2. `ExampleFileUtil` returns the percent-encoded URL path**
`URL.getPath()` does not decode. On Windows, template file names built with
`File.separator` (`\`) are encoded as `%5C` in the resource URL, so the
returned
path pointed at a file literally named `templates%5Clist.xlsx` — which does
not
exist → `Copy template failure`. On Unix the separator `/` needs no encoding,
which is why CI passed.
Fix: decode via `URL.toURI()` in a shared `toFilePath` helper. This also
fixes
paths containing spaces or other reserved characters (`%20` etc.).
### Tests
- New `WriteWorkbookHolderOutputStreamTest` (2 cases): the stream opened by
the
holder is closed on init failure (on Windows an open stream locks the
file, so
deletion fails without the fix); caller-provided streams are not closed.
- The fill ITCases (`FillBasicExampleITCase`, `FillComplexExampleITCase`) now
pass on Windows; they previously failed with `Copy template failure`.
- Full module suite green: 846 tests, 0 failures (fesod-common /
fesod-shaded /
fesod-sheet / fesod-sheet-examples), `spotless:check` and
`javadoc:javadoc` pass.
---
Closes #1021
--
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]