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

Chunk=by-topic gives NPE on topicgroup #2805

Merged
merged 2 commits into from Oct 4, 2017

Conversation

Projects
None yet
2 participants
@robander
Member

robander commented Oct 3, 2017

Description

Fix for the following condition, which currently results in a null pointer error:

<map>
  <topicref chunk="by-topic">
    <topicref href="sample.dita"/>
  </topicref>
</map>

Motivation and Context

Actual use case where this came up was a <mapref> element where the nested map used chunk="by-topic". The resolved <submap> element has no @href but retains the chunk token. From that, I generalized the issue to any <topicref> that 1) has no @href and 2) has chunk="by-topic".

This comes from the chunking code, which checks for null href values for other chunk tokens but does not check for by-topic, and tries to generate chunks regardless. The fix skips the "generate chunks" step and continues to children.

This issue has existed for a long time for topicgroup style elements, but is likely to come up more now that chunk values from submaps are preserved (that was added not too long ago).

How Has This Been Tested?

Fixes the original test case, and the more general case. There is no failure, and child topicrefs are processed as expected.

Also added the following element to the existing ChunkMapReaderTest, which resulted in a NPE from gradlew test:
<topicref chunk="by-topic" class="- map/topicref "> </topicref>

This fix corrects the null pointer error.

Type of Changes

Bug fix

Checklist

X I have signed-off my commits per http://www.dita-ot.org/DCO.
X Builds & tests completed successfully (./gradlew test integrationTest).
X My code follows the code style of this project.
- https://github.com/dita-ot/dita-ot/wiki/Java-Coding-Conventions
- https://github.com/dita-ot/dita-ot/wiki/XSLT-Coding-Conventions
X I have updated the unit tests to reflect the changes in my code.

robander added some commits Oct 3, 2017

Add currently-failing condition to chunk map reader test
Signed-off-by: Robert D Anderson <robander@us.ibm.com>
Fix broken chunk by-topic on topicgroup
Signed-off-by: Robert D Anderson <robander@us.ibm.com>

@robander robander added this to the 2.5.4 milestone Oct 3, 2017

@robander robander requested a review from jelovirt Oct 3, 2017

@jelovirt jelovirt merged commit a10e168 into dita-ot:hotfix/2.5.4 Oct 4, 2017

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@robander robander deleted the robander:hotfix/nullchunk branch Oct 4, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment