java.lang.NumberFormatException when trying to load a document

Hello Aspose Team,

When trying to load a document with Shapes, we are seeing a java.lang.NumberFormatException.

Please find attached document as a reference.
tmp.docx (31.2 KB)

tmpDoc = Document(“tmp.docx”)

Full Stack Trace:

om.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.

	at com.aspose.words.FileFormatUtil.zzgp(Unknown Source)
	at com.aspose.words.Document.zzX2D(Unknown Source)
	at com.aspose.words.Document.zzwE(Unknown Source)
	at com.aspose.words.Document.<init>(Unknown Source)
	at com.aspose.words.Document.<init>(Unknown Source)
	at AsposeTestProcessor.<init>(AsposeTestProcessor.kt:30)
	at AsposeTests.testSaveAsPDF2(DocProcessorTests.kt:184)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:235)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: java.lang.NumberFormatException: For input string: "0.0"
	at java.lang.NumberFormatException.forInputString(NumberFormatException.java:65)
	at java.lang.Integer.parseInt(Integer.java:580)
	at java.lang.Integer.parseInt(Integer.java:615)
	at com.aspose.words.internal.zzVWu.zzZAZ(Unknown Source)

Trying to confirm if there is some load options or a workaround to take care of this without getting an exception.

Thanks !

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

  Issue ID(s): WORDSNET-24848

You can obtain Paid Support services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Thank you for a quick revert, @alexey.noskov.

Is there a way to capture and bypass such exceptions so that the document continue loading and we are able to render it?

@kml2020 Unfortunately, no, there is no way to bypass the FileCorruptedException. This exception means there is a problem with the file and Aspose.Words cannot load it.

@alexey.noskov, could you please confirm the status for the bug logged for this issue, WORDSNET-24848

@kml2020 The issue is already resolved in the current codebase. the fix will be included into the next 23.2 version of Aspose.Words. We will be sure to let you know once it is resolved.

That is good to know, @alexey.noskov!

Would you have the details of the fix (if possible). It is likely relating to correctly handling the o:hrpct element for the shape?

@kml2020 Yes, the problem occurred because hrpct attribute value defined as double.

Thank you for quick response and resolution on this, @alexey.noskov!

1 Like

The issues you have found earlier (filed as WORDSNET-24848) have been fixed in this Aspose.Words for Java 23.2 update.