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

Free Support Forum - aspose.com

Problem instantiating Document instance in multi threaded environment

Hi,


I am getting those exceptions when run in multi threaded environment:
Exception in thread “third” java.lang.RuntimeException: com.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.
at org.gs4tr.projectdirector.service.MultyThreadTest$1.run(MultyThreadTest.java:44)
at java.lang.Thread.run(Unknown Source)
Caused by: com.aspose.words.FileCorruptedException: The document appears to be corrupted and cannot be loaded.
at com.aspose.words.Document.a(Document.java:1376)
at com.aspose.words.Document.b(Document.java:1363)
at com.aspose.words.Document.a(Document.java:1251)
at com.aspose.words.Document.(Document.java:248)
at com.aspose.words.Document.(Document.java:232)
at com.aspose.words.Document.(Document.java:227)
at org.gs4tr.projectdirector.service.MultyThreadTest$1.run(MultyThreadTest.java:40)
… 1 more
Caused by: java.lang.IllegalStateException: Current state = RESET, new state = FLUSHED
at java.nio.charset.CharsetDecoder.throwIllegalStateException(Unknown Source)
at java.nio.charset.CharsetDecoder.flush(Unknown Source)
at java.nio.charset.CharsetDecoder.decode(Unknown Source)
at asposewobfuscated.mg.U(Encoding.java:460)
at com.aspose.words.ze.a(DocUtil.java:43)
at com.aspose.words.ak.b(StyleFiler.java:439)
at com.aspose.words.ak.a(StyleFiler.java:214)
at com.aspose.words.ak.a(StyleFiler.java:115)
at com.aspose.words.ck.read(DocReader.java:63)
at com.aspose.words.Document.b(Document.java:1280)
… 6 more

Attached are test files and .java file with my test.

Thanks, Ivica.

Hi Ivica,

We can’t reproduce your problem on Aspose.Words for Java v.3.3. What version of Aspose.Words jar are you using?

But, if the last jar doesn’t help – recently we had fixed a similar problem with CharsetDecoder in multithread environment: Best Regards and sorry for inconvenience,

Hi,


I was using 3.3 version. Jar is: Aspose.Words.jdk15.jar. This is from manifest:
Manifest-Version: 1.0
Specification-Title: Aspose.Words for Java
Implementation-Title: Aspose.Words for Java
Specification-Version: 3.3.0.0
Implementation-Version: 3.3.0.0
Specification-Vendor: Aspose Pty Ltd
Implementation-Vendor: Aspose Pty Ltd
Copyright: Copyright 2003-2009 Aspose Pty Ltd

If you have 3.3 version with this fix please send it to me so we can test.

Thanks, Ivica.

Hi,

I just sent the jar to you, please check your email.

Regards,

Hi,


this fix helped. I will perform more testing.

Thanks.

Hi Ivica,

Thanks for the info.

Regards,