Doesn't your patch fail when the literal to search for is on the boundary of the buffer, i.e half ot it is in this, half of it in the next buffer. Anyway, do not worry too much for ComparableResourceImpl as it will only be used by the search method and likely to be replaced by code that does search on indexed content.

Oliver

Davide Savazzi wrote:

On Wednesday 12 May 2004 11:27, Oliver Zeigermann wrote:


I am still wondering why NodeRevisionContent should be changed as
getContentBytes() is only called to actually load the bytes of a
resource into memory for *caching*.


Ops, you're right. I've only removed the Logger and it works! :)

getContentBytes() is also used by org.apache.slide.search.basic.ComparableResourceImpl. I've attached a patch for it (not tested!).



------------------------------------------------------------------------

diff -r ./src/share/org/apache/slide/search/basic/ComparableResourceImpl.java ../jakarta-slide/src/share/org/apache/slide/search/basic/ComparableResourceImpl.java
26,27d25
< < import java.io.*;
504,518c502
< boolean found = false;
< InputStream stream = revisionContent.streamContent();
< try {
< Reader reader = new InputStreamReader(stream); < char buffer[] = new char[1024];
< int read = 0;
< while (!found && (read = reader.read(buffer)) > -1) {
< String content = new String(buffer, 0, read);
< if (content.indexOf(literal) > -1) {
< found = true;
< }
< }
< } finally {
< stream.close();
< }
---


String content = new String (revisionContent.getContentBytes());

520c504 < if (found) ---

if (content.indexOf (literal) > -1)

525,527d508 < catch (IOException ioe) { < // error handling ??? < }



------------------------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to