New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix Java failure when chunking is combined with uplevels #3077
Conversation
This is somewhat related to #2728, which had the same failure, but not related to uplevels. |
src/main/java/org/dita/dost/writer/AbstractChunkTopicParser.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Robert D Anderson <robander@us.ibm.com>
fb03ec2
to
ed8f548
Compare
Reworked after discussion with Jarno about how the file name generation was working. Current version is changed to:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small clean-up request, otherwise LGTM now.
</topic> | ||
</dita> | ||
|
||
<!-- |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe remove this comment because the log shown here is not what the final modifications will output.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't have been in there either way, leftover from my debugging of the test file itself. Thanks...
Signed-off-by: Robert D Anderson <robander@us.ibm.com>
Description
Fixes a bug with maps that use
by-topic
chunking but also have content outside of the map directory.The update ensures that when a file is split into multiple chunks, the new chunked topics are created in the same directory as the original topic. Currently, this works correctly when the map is in the root of the temp directory, but fails when the map is not in the root of the temp directory due to
uplevels
processing.The fix changes how the temporary file name for the new chunk is created. Currently, the build properly determines what the result file would be in the original source context. However, when it creates the file name used to generate the fragment, it includes the full path from the root of temp, and then appends that to the path of the current topic.
For example, assume I have this construct in the temp dir:
When
topic.dita
is split into multiple chunks, file names are created based on the IDs of each topic. For any but the first-in-file, those file names result in a relative path from temp such asmain/id.dita
. This is then evaluated against the topic document itself, resulting in an attempt to openmain/main/id.dita
. This fails, which means variables are not initialized, which results in a build failure later in the chunking step:Error: java.util.NoSuchElementException
The update ensures we use only the base file name of the new chunk, relative to the document that is splitting.
Motivation and Context
Encountered in customer document that uses the same organization as the new sample integration test doc.
How Has This Been Tested?
Passes unit / integration tests; new integration test added that is fixed with the update.
Type of Changes
Checklist