We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Problems with Aspose.Words API

Hi Shelia,

Thank you for this information.

I am currently running a Proof of Concept using the evaluation version of Word Java version…

My technical team has found two bugs that would impact our solution, so before we buy, we need to understand if this a known evaluation bugs or the fix situation.

The bugs are bellow.

Looking forward to hearing from you.


Guil Scomparim
Solution Architect - Customer

>>> SIMON BRAINES 24/09/08 12:30 pm >>>

Hi Guil,

I’ve encountered 2 problems with the Aspose Words API.

  1. Document fails to save
    This occurs after opening a word doc in Aspose, manipulating the object tree and then saving to a different filename. The stack trace is shown below:
[24/09/08 12:06:52:351 EST] 0000002d SystemOut O 2008-09-24 12:06:52,351 ERROR [A.ApplicationExceptionReporter] java.lang.NullPointerException Error attempting to replace tokens in Word file: NOR Plan Stamp Dual Occupancy Unsubdivided Vert.dot 

at com.aspose.words.cq.visitParagraphEnd(Unknown Source) 
at com.aspose.words.Paragraph.accept(Unknown Source) 
at com.aspose.words.cq.b(Unknown Source) 
at com.aspose.words.cq.a(Unknown Source) 
at com.aspose.words.Document.save(Unknown Source) 
at com.aspose.words.Document.save(Unknown Source) 
at au.com.swc.common.worddocument.token.TokenReplacer.replace(TokenReplacer.java:112) 

This error always occurs when running in non-debug mode (in Eclipse). However, if I run in debug mode then the file saves successfully the first few times but then starts producing corrupt files that Word cannot read. I’ve attached corrupt and valid versions of this file to compare - there appears to be 3 bytes in the header that are different between the 2 files.

  1. Document fails to open

This problem used to occur using every time a file with more that 1000 characters was opened when using the 1.4 JDK version of Aspose Words (in non-debug mode). I never saw this error when running in debug mode though.

Since moving to the 1.5 JDK version, the problem only occurs in non-debug mode after the “document fails to save” error occurs. It then occurs for every file opened, regardless of size.

The stack trace is:

[24/09/08 12:08:31:245 EST] 0000002e SystemOut O 2008-09-24 12:08:31,245 ERROR [A.ApplicationExceptionReporter] java.lang.NullPointerException The document appears to be corrupted and cannot be loaded. 

at com.aspose.words.Paragraph.fY(Unknown Source) 
at com.aspose.words.g.a(Unknown Source) 
at com.aspose.words.eu.gc(Unknown Source) 
at com.aspose.words.dj.parse(Unknown Source) 
at com.aspose.words.bn.read(Unknown Source) 
at com.aspose.words.Document.a(Unknown Source) 
at com.aspose.words.Document.a(Unknown Source) 
at com.aspose.words.Document.(Unknown Source) 
at com.aspose.words.Document.(Unknown Source) 
at au.com.swc.common.worddocument.token.TokenReplacer.replace(TokenReplacer.java:97) 

Could you check with Aspose if this is a known issue with the evaluation API? If not, it’s likely that the way I’m manipulating the object tree via the API when replacing token is triggering these issues. However, I’d expect these problems to be consistent instead of producing different results over time.

This message was posted using Email2Forum by sheliah.

Thanks for your inquiry. Could you please provide me code and attach your documents for testing. I will try to reproduce the issues and provide you more information.
Best regards.

Hi Alexey,
Thanks for the reply, but yesterday I was having problems on posting on this forum.
Below if what I got from my technical guys.
Hi Guil,
I’ve created a very simple test case that demonstrates the issue which you can forward to Aspose.
I’ve also narrowed down the likely cause of the problem: It only occurs when using the IBM JRE (Java 1.5 - Websphere 6.1 in this case). When I run it in a Sun 1.5 JDK, all works fine.
To summarise the problem:
- When calling Document.save, a NullPointerException is thrown by the Aspose library.
- When running in Debug mode, no exception is thrown, but the resulting file cannot be opened in Word.
To reproduce the issue:
- Open the attached AsposeDemo project in Eclipse
- Go to Properties | Java Build Path | Libraries and add a Websphere 6.1 JRE library
- Locate the Class “au.com.swc.common.worddocument.SimpleTest”, right-click and select “Run as… Java Application”
The following stack trace is produced:

Exception in thread "main" java.lang.NullPointerException
at com.aspose.words.Paragraph.accept(Unknown Source)
at com.aspose.words.CompositeNode.acceptChildren(Unknown Source)
at com.aspose.words.Body.accept(Unknown Source)
at com.aspose.words.cq.a(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
at au.com.swc.common.worddocument.SimpleTest.execute(SimpleTest.java:18)
at au.com.swc.common.worddocument.SimpleTest.main(SimpleTest.java:9)

The input file is located in Test/Documents/Input/File1.doc
I can forward on the Websphere 6.1 JRE if required, but it is around 16MB, so we will perhaps have to transfer it via FTP.

Hi Simon,
Probably it is well-known issue: IBM’s JRE’s JIT conflicts with optimization of Aspose.Words jar – you can check it by disabling JIT in JRE.
This will be fixed in the next Aspose.Words for Java release (will be released within two weeks). As a temporary workaround I have emailed you non-optimized Aspose.Words jar that should work with IBM JIT. Please check your mail.
Best Regards,