question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: java.lang.IllegalStateException: Duplicate key topic-id-1.dita

See original GitHub issue

If in a *.ditamap file a *.dita file that contains <keyword keyref="..."/> is referenced more than twice then dita-ot-2.4.1 fails with following error: Error: java.lang.IllegalStateException: Duplicate key topic-id-1.dita

Steps to reproduce:

  1. Create following files:

map.ditamap:

<!DOCTYPE map PUBLIC "-//OASIS//DTD DITA Map//EN" "dtd/map.dtd">
<map title="Error: java.lang.IllegalStateException: Duplicate key topic-id-1.dita">
   <topicref href="topic.dita"/>
   <topicref href="topic.dita"/>
   <topicref href="topic.dita"/>
   <keydef keys="VAR">
      <topicmeta><keywords><keyword>value</keyword></keywords></topicmeta>
   </keydef>
</map>

topic.dita:

<!DOCTYPE concept PUBLIC "-//OASIS//DTD DITA Concept//EN" "dtd/concept.dtd">
<concept id="topic-id">
   <title>Topic</title>
   <shortdesc>Lorem ipsum</shortdesc>
   <conbody><p><keyword keyref="VAR"/></p></conbody>
</concept>
  1. Run dita-ot: dita -f html5 -i map.ditamap

Results:

  • Actual: no output is generated; processing fails with following error: Error: java.lang.IllegalStateException: Duplicate key topic-1.dita
  • Expected: in out/ at least the files index.html and topic.html should be created (see #2363 if the files topic-1.html and topic-2.html should also be created)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
jelovirtcommented, Apr 2, 2017

The fix proposed by @raducoravu would work around the null pointer, but would not fix the underlying issue. The duplicates need to be detected earlier on.

2reactions
raducoravucommented, Mar 31, 2017

The code in the adjustResourceRenames could be re-written to accept duplicates in the created map like:

        final Map<URI, URI> rewrites = 
        		tasks.stream().filter(t -> t.out != null).collect(toMap(
                        t -> t.in.uri,
                        t -> t.out.uri,
                        (v1, v2) -> {
                            return v1;
                        }
                ));
Read more comments on GitHub >

github_iconTop Results From Across the Web

Java 8 toMap IllegalStateException Duplicate Key
The pramodh's answer is good if you want to map your value to 1. But in case you don't want to always map...
Read more >
IllegalStateException: Duplicate key error Virtual Agent
It is present in a different model. - There are no duplicate script variables. - There are no duplicate Intents. Though the topic...
Read more >
"java.lang.IllegalStateException: Duplicate key [name=网店 ...
This issue is caused because the ENUM language that was used earlier is missing. Solution.
Read more >
Internal error: (java.lang.IllegalStateException) Duplicate key
Internal error: (java.lang.IllegalStateException) Duplicate key ... Update: The exception has disappeared after right click on parent pom.xml -> Maven -> Reimport ...
Read more >
Indexing failed for Entity - Caused by: java.lang ...
Summary. The reindex fails due to the following exception: java.lang.IllegalStateException: Duplicate key 3 ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found