Repository navigation
Conversation
- ApplicationManifestUtils and ApplicationManifestUtilsV3 now write manifests as UTF-8 instead of the platform default charset. - pushManifestV3 serializes the manifest inside the Mono, so failures go through the reactive error channel instead of being thrown when the method is called. - The manifest tests use @tempdir instead of leaving files in the system temp directory. Fixes cloudfoundry#1411
ZPascal
force-pushed
the
fix-manifest-charset-and-errors
branch
from
November 23, 2026 12:29
c86796c to
cab275e
Compare
- Open manifest files with TRUNCATE_EXISTING so overwriting a longer file no longer leaves trailing bytes behind (V2 and V3) - Flush instead of closing the caller-supplied OutputStream in write(OutputStream, ...) and document the UTF-8 output - Serialize the V3 manifest before resolving the space and add OperationsLogging and a checkpoint to pushManifestV3 - Add tests for truncation, stream handling, V2 UTF-8 output and lazy pushManifestV3 assembly
Lokowandtg
approved these changes
Nov 25, 2026
|
|
||
| @Test | ||
| void testWriteDoesNotCloseStream() { | ||
| boolean[] closed = {false}; |
Contributor
There was a problem hiding this comment.
Why are you using an array here?
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1411.
This fixes the three manifest handling problems from the issue.
1. Manifests are written as UTF-8
ApplicationManifestUtils.write(OutputStream, ...)andApplicationManifestUtilsV3.write(OutputStream, ...)now usenew OutputStreamWriter(out, StandardCharsets.UTF_8)instead of the platform default charset. I addedtestWriteUsesUtf8for this. I checked that it fails on the old code when the JVM runs with-Dfile.encoding=ISO-8859-1and passes with the fix.2.
pushManifestV3serializes the manifest lazilySerialization now happens in a small
serializeManifesthelper that returnsMono.fromCallable(...). That Mono is zipped together with the client and space ID. If writing the manifest fails, the caller gets the error through the returned Mono instead of an exception thrown when the method is called. Everything else in the chain is unchanged.3. Tests no longer leave files in /tmp
ApplicationManifestUtilsTestandApplicationManifestUtilsV3Testnow use JUnit's@TempDirinstead ofFiles.createTempFile.Testing
ApplicationManifestUtilsTest,ApplicationManifestUtilsV3TestandDefaultApplicationsTestpass locally on JDK 11 (150 tests, 2 skipped; those two were already skipped before this change)../mvnw spotless:check -Pintegration-testpasses.Note: #1410 also changes
pushManifestV3, so whichever PR goes in second will need a small rebase.