SetEncoding error when opening twice HTML filter

Issue #117 resolved
Former user created an issue

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)

  1. Former user 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

  2. Log in to comment