SetEncoding error when opening twice HTML filter
Original [issue 117](https://code.google.com/p/okapi/issues/detail?id=117) created by @ysavourel on 2009-11-28T16:11:20.000Z:
When doing two open calls to the HTML filter, without re-creating the filter we get an exception that the encoding cannot be set twice.
See rev 3952 in SVN
@ Test public void testOpenTwice () throws URISyntaxException { File file = new File(root + "324.html"); RawDocument rawDoc = new RawDocument(file.toURI(), "windows-1252", locEN); htmlFilter.open(rawDoc); htmlFilter.close(); htmlFilter.open(rawDoc); htmlFilter.close(); }
Comments (4)
-
Account Deleted -
Account Deleted - changed status to open
Comment [2.](https://code.google.com/p/okapi/issues/detail?id=117#c2) originally posted by @ysavourel on 2009-11-30T18:59:23.000Z:
-
Account Deleted Comment [3.](https://code.google.com/p/okapi/issues/detail?id=117#c3) originally posted by @ysavourel on 2009-11-30T19:24:03.000Z:
RawDocument cannot be safely reused because it is impossible to reliably reset a stream. Since we don't know what is being used underneath (string or file or stream) we have to assume the lowest common denominator (=stream), which means no way to start over with the same RawDocument.
I think the best we can do is add a reset method and test for the type of input - in the case of string and file (URI) we are fine, resetting is no problem. But in the case of an InputStream we must throw an exception to say that the stream has been exhausted and to create a new RawDocument.
Not sure how the
-
Account Deleted - changed status to resolved
Comment [4.](https://code.google.com/p/okapi/issues/detail?id=117#c4) originally posted by @ysavourel on 2009-12-21T18:56:14.000Z:
- Log in to comment
Comment [1.](https://code.google.com/p/okapi/issues/detail?id=117#c1) originally posted by @ysavourel on 2009-11-28T16:15:35.000Z:
The same test passes ok with e.g. XML filter. The issue is related to RawDocument. We should be able to use one rawDoc and call open twice with it without changing anything.