java-mammoth
java-mammoth copied to clipboard
Error when multiple numbering levels reference the same paragraph style
Exception in thread "main" java.lang.IllegalStateException: Duplicate key org.zwobble.mammoth.internal.docx.Numbering$AbstractNumLevel@72bef795
at java.util.stream.Collectors.lambda$throwingMerger$0(Collectors.java:133)
at java.util.HashMap.merge(HashMap.java:1254)
at java.util.stream.Collectors.lambda$toMap$58(Collectors.java:1320)
at java.util.stream.ReduceOps$3ReducingSink.accept(ReduceOps.java:169)
at java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:175)
at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1625)
at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270)
at java.util.HashMap$ValueSpliterator.forEachRemaining(HashMap.java:1625)
at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
at org.zwobble.mammoth.internal.docx.Numbering.
Is there a way to resolve the error, Can you please give some inputs to resolve this.
Could you provide a minimal example document that causes the error?
SU_v1.docx All other doc files are getting converted correctly. I am using a Java project. with the mammoth version of 1.4.2
Hmm, it looks like two w:lvl
elements in numbering.xml
have the same w:pStyle
element. Specifically, they're in the same w:abstractNum
but have different levels, so it's not entirely clear how to reconcile that with the spec (17.9.23 in ECMA-376, 4th Edition):
When a paragraph style is defined to include a numbering definition, any numbering level defined by the numPr element (§17.3.1.19) shall be ignored, and instead this element shall specify the numbering level associated with that paragraph style.