Wen I load a document with a BufferedInputStream an exception is thrown:
Caused by: java.io.IOException: Resetting to invalid mark
at java.io.BufferedInputStream.reset(BufferedInputStream.java:448)
at com.aspose.words.internal.zz14.zzm(Unknown Source)
at com.aspose.words.internal.zzUU.zzTc(Unknown Source)
at com.aspose.words.zz0F.zzY(Unknown Source)
at com.aspose.words.Document.zzY(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
There are two attachment to this topic: a simple word document and a junit5 test with which the behaviour can be reproduced with Aspose.words 19.11.
Unfortunately the Class.getRessourceAsStream() method return a BufferedInputStream, so we cant load any word resource anymore. input.doc.zip (6.5 KB) @Test
public void testSimpleLoadDocumentWithBufferedStream() throws Exception {
File file = new File(“input.doc”);
try (BufferedInputStream is = new BufferedInputStream(new FileInputStream(file))) {
Document document = new Document(is);
Assertions.fail(“Document can be read?”);
} catch (IOException e) {
Assertions.assertEquals(“Resetting to invalid mark”, e.getMessage());
e.printStackTrace();
}
try (FileInputStream is = new FileInputStream(file)) {
Document document = new Document(is);
Assertions.assertFalse(document.getText().isEmpty());
}
}
Thanks for reporting this problem to us. We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSJAVA-2253. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.
I am afraid, there are currently no estimates available at the moment. But, we have logged your concerns in our issue tracking system and will keep you posted on further updates.
I wish you a great new year 2020.
Unfortunately there is still another case of BufferedInputStreams with is not longer readable with Aspose 19.12. I would say that this is the case if the size of buffer is equals to the remaining bytes of the stream. This is the case because your class calls BufferedInputStream.mark with the available() result. The implementations of InputStream.available() is not verified to return the correct count of available bytes (see JavaDoc). In our case, the available() return any pseudo value due the original stream is compressed.
Caused by: java.io.IOException: Resetting to invalid mark
at java.io.BufferedInputStream.reset(BufferedInputStream.java:448)
at com.aspose.words.internal.zz12.zzm(Unknown Source)
at com.aspose.words.internal.zzUU.zzTc(Unknown Source)
at com.aspose.words.zz0F.zzY(Unknown Source)
at com.aspose.words.Document.zzY(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
at com.aspose.words.Document.(Unknown Source)
In case the problem still remains, please ZIP and upload your input Word document you are getting this problem with here for testing. We will then investigate the scenario on our end and provide you more information.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.