Hello Team,
We use Docx4j in our application to add/remove new paragraphs and to replace some placeholders. Sometimes while replacing placeholders we encounter the NumberFormatException when we invoke Variables.prepare method on Docx4j. A sample exception trace is given below. In the below trace it has happened while saving the signature part, but other times this has happened with some other part. Not sure why this happens exactly. Our customers upload and manipulate the documents in our portal and it becomes very difficult to debug what the actual issue is. Please let us know if there is a solution to this.
Problem saving part /word/ink/ink1.xml
java.lang.NumberFormatException: For input string: "541.22"
at java.base/java.lang.NumberFormatException.forInputString(NumberFormatException.java:67)
at java.base/java.lang.Integer.parseInt(Integer.java:668)
at java.base/java.math.BigInteger.<init>(BigInteger.java:536)
at java.base/java.math.BigInteger.<init>(BigInteger.java:674)
at org.glassfish.jaxb.runtime.DatatypeConverterImpl._parseInteger(DatatypeConverterImpl.java:57)
at org.glassfish.jaxb.runtime.v2.model.impl.RuntimeBuiltinLeafInfoImpl$22.parse(RuntimeBuiltinLeafInfoImpl.java:823)
at org.glassfish.jaxb.runtime.v2.model.impl.RuntimeBuiltinLeafInfoImpl$22.parse(RuntimeBuiltinLeafInfoImpl.java:819)
at org.glassfish.jaxb.runtime.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.parse(TransducedAccessor.java:214)
at org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:180)
at org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:530)
at org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:509)
at org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.StAXStreamConnector.handleStartElement(StAXStreamConnector.java:217)
at org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.StAXStreamConnector.bridge(StAXStreamConnector.java:149)
at org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:376)
at org.glassfish.jaxb.runtime.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:347)
at org.docx4j.openpackaging.parts.JaxbXmlPart.unmarshal(JaxbXmlPart.java:1078)
at org.docx4j.openpackaging.parts.JaxbXmlPart.getContents(JaxbXmlPart.java:201)
at org.docx4j.openpackaging.parts.JaxbXmlPart.getJaxbElement(JaxbXmlPart.java:221)
Thanks,
Lakshmi