Skip to content
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

Merged
merged 2 commits into from Sep 27, 2018

Conversation

robander
Copy link
Member

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:

common/reuse.dita
main/input.ditamap
main/topic.dita

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 as main/id.dita. This is then evaluated against the topic document itself, resulting in an attempt to open main/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

  • Bug fix (non-breaking change which fixes an issue)

Checklist

@robander robander added bug priority/medium Medium (or unknown) priority issue preprocess/chunking labels Sep 21, 2018
@robander robander added this to In progress in 3.1.3 via automation Sep 21, 2018
@robander
Copy link
Member Author

This is somewhat related to #2728, which had the same failure, but not related to uplevels.

Signed-off-by: Robert D Anderson <robander@us.ibm.com>
@robander
Copy link
Member Author

Reworked after discussion with Jarno about how the file name generation was working.

Current version is changed to:

  • Generate the file name relative to the file that's being chunked (rather than relative to the map). This means that when file/directory names are relevant, splitting up a document results in new chunks within the same directory
  • The temporary chunk name is created relative to the temp directory, as before. To fix the original bug that prompted this, that value is now made absolute by evaluating it relative to the same temp directory, rather than relative to the chunked document.

3.1.3 automation moved this from In progress to Needs review Sep 27, 2018
Copy link
Member

@jelovirt jelovirt left a 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>

<!--
Copy link
Member

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.

Copy link
Member Author

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>
3.1.3 automation moved this from Needs review to Reviewer approved Sep 27, 2018
@robander robander merged commit 209c846 into dita-ot:hotfix/3.1.3 Sep 27, 2018
3.1.3 automation moved this from Reviewer approved to Done Sep 27, 2018
@robander robander deleted the hotfix/chunkUplevel branch September 27, 2018 19:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug preprocess/chunking priority/medium Medium (or unknown) priority issue
Projects
No open projects
3.1.3
  
Done
Development

Successfully merging this pull request may close these issues.

None yet

2 participants