Allow changing blob attributes when full/custom validation is enabled#1064
Merged
stevedlawrence merged 1 commit intoAug 4, 2023
Merged
Conversation
8d2249b to
b0706bf
Compare
mbeckerle
approved these changes
Aug 4, 2023
| assertTrue(blobPaths.get(0).toString().contains("pre-")); | ||
| assertTrue(blobPaths.get(0).toString().contains(".suf")); | ||
| Files.delete(blobPaths.get(0)); | ||
| Files.delete(blobDir); |
Contributor
There was a problem hiding this comment.
If this test fails it will leave files/dirs around? Do you want a try-finally here to ensure they are cleaned up?
It doesn't much matter since the test should not fail.
It's just a matter of "what if someone copies this code to model their blob usage?". Then it would be better if the code had the try-finally.
(Same comment for the Scala API test file.)
Member
Author
There was a problem hiding this comment.
Makes sense, will add.
When full or custom validation is enabled, Daffodil creates a new TeeInfosetOutputter which proxies infoset events to the user provided InfosetOutputter and another one used for validation. This means that calls to getBlobDirectory, getBlobSuffix, setBlobPath, etc. go to the TeeInfosetOutputter, and ignore any values that a user may have set on their provided InfosetOutputter. This essentially means you cannot change the directory, suffix, or prefix of blobs if full or custom validation is enabled. It also means that if calling getBlobPaths on the user provided InfosetOutputter never returns anything, even if blobs were created. To fix this, if full or custom validation is enabled, we copy the blob attributes to the TeeInfosetOutputter used for parsing. We also ensure that at the end of parsing, we call setBlobPaths on the InfosetOutputter the user passed in instead of the TeeInfosetOutputter. DAFFODIL-2837
b0706bf to
28b1a0d
Compare
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.
When full or custom validation is enabled, Daffodil creates a new TeeInfosetOutputter which proxies infoset events to the user provided InfosetOutputter and another one used for validation. This means that calls to getBlobDirectory, getBlobSuffix, setBlobPath, etc. go to the TeeInfosetOutputter, and ignore any values that a user may have set on their provided InfosetOutputter. This essentially means you cannot change the directory, suffix, or prefix of blobs if full or custom validation is enabled. It also means that if calling getBlobPaths on the user provided InfosetOutputter never returns anything, even if blobs were created.
To fix this, if full or custom validation is enabled, we copy the blob attributes to the TeeInfosetOutputter used for parsing. We also ensure that at the end of parsing, we call setBlobPaths on the InfosetOutputter the user passed in instead of the TeeInfosetOutputter.
DAFFODIL-2837