Hi Support Team,
I am facing a strange issue while loading the word doc using the below code.
InputStream inputStream = new FileInputStream("/homes/document.doc");
the file location is in remote unix box.while iam passing the above inputStream in
the document constructor mentioned below.
Document asposeDoc = new Document(inputStream, null, LoadFormat.DOC, null);
Iam getting the following exception
com.aspose.words.FileCorruptedException : The document appears to be corrupted and cannot be loaded.
The same code works in the windows environment. I tried creating application in my desktop which is running in windows OS, which is running fine without any exception.
I am not sure why it only fails in unix environemt. Does Aspose support loading of word doc into unix box or it is the problem with the unix box which is corrupting only the word doc which iam trying to uplaod in to the loaction metioned above in code.
I tried loading the HTML file from unix env, it works,. why its only failing with word doc in unix environement?
Please provide me the solution at the earliest. Your help is higghly appreciated. Thanks in advance
Hi
Thanks for your request. Could you please attach the original .doc file here for testing?
Also which version of Aspose.Words for Java do you use? To check version of Aspose.Words for java, unzip Aspose.Words.jar, open META-INF\ MANIFEST.MF file in notepad, you will see the following:
Manifest-Version: 1.0
Specification - Title: Aspose.Words for Java
Implementation - Title: Aspose.Words for Java
Specification-Version: 4.0.2.0
Implementation-Version: 4.0.2.0
Specification-Vendor: Aspose Pty Ltd
Implementation-Vendor: Aspose Pty Ltd
Copyright: Copyright 2003-2009 Aspose Pty Ltd
You can download the latest version from here:
https://releases.aspose.com/words/java
Best regards,
Hi Support Team,
Thanks for ur quick reponse. The version of aspose iam using is 2.6.1. due to some restricitions in my organization i couldn’t attach the word doc iam using, but i can tell u it works fine on windows env, it only fails when iam trying to upload the word doc in to my application which is running remotely on unix server. We are using F-Secure SSH file transfer to proceed with development work to drop files in to the application. In the same way iam also uploading this word doc in to config folder and trying to access it in code. But it says file corrupted exception.
And iam sure it is not specific to that word doc iam using, any word doc i upload it fails while loading it in document constructor.
Please suggest what we can do.
Hi
Thank you for additional information. I cannot reproduce the problem on my side using the latest version of Aspose.Words for Java (4.0.2). You can download this version from here:
https://releases.aspose.com/words/java
Please try using the latest version of Aspose.Words for Java, and let me know how it goes on your side.
Best regards,
Hi Andrey,
I got the issue, actually we are using the class loader to get the resource, the API which we are using will return java.net.URL object and from that i am getting url.openStream(), which returns me inputstream, Some How this API is permanently corrupting the word doc in the config path. So if Iam using fileinputstream it is working fine.
Thanks for your support . Its higlhy appreciated.
Hi
It is perfect, that you already resolved the problem. Please let me know in case of any issues. I will be glad to help you.
Best regards,