LUCENE-3990: revert broken refactoring AGAIN. charfilter does not delegate all read methods. I'm not wasting hours of my life debugging these test fails again to save 3 lines of code

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1326561 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Muir 2012-04-16 11:16:46 +00:00
parent 9f84903e50
commit 2ac01fc72e
1 changed files with 51 additions and 6 deletions

View File

@ -756,29 +756,74 @@ public class TestRandomChains extends BaseTokenStreamTestCase {
} }
} }
static final class CheckThatYouDidntReadAnythingReaderWrapper extends CharFilter { // wants charfilter to be a filterreader...
boolean readSomething = false; // do *NOT*, do *NOT* refactor me to be a charfilter: LUCENE-3990
static class CheckThatYouDidntReadAnythingReaderWrapper extends CharStream {
boolean readSomething;
CharStream in;
CheckThatYouDidntReadAnythingReaderWrapper(Reader in) { CheckThatYouDidntReadAnythingReaderWrapper(Reader in) {
super(CharReader.get(in)); this.in = CharReader.get(in);
}
@Override
public int correctOffset(int currentOff) {
return in.correctOffset(currentOff);
}
@Override
public void close() throws IOException {
in.close();
} }
@Override @Override
public int read(char[] cbuf, int off, int len) throws IOException { public int read(char[] cbuf, int off, int len) throws IOException {
readSomething = true; readSomething = true;
return input.read(cbuf, off, len); return in.read(cbuf, off, len);
} }
@Override @Override
public int read() throws IOException { public int read() throws IOException {
readSomething = true; readSomething = true;
return input.read(); return in.read();
}
@Override
public int read(CharBuffer target) throws IOException {
readSomething = true;
return in.read(target);
}
@Override
public void mark(int readAheadLimit) throws IOException {
in.mark(readAheadLimit);
}
@Override
public boolean markSupported() {
return in.markSupported();
}
@Override
public int read(char[] cbuf) throws IOException {
readSomething = true;
return in.read(cbuf);
}
@Override
public boolean ready() throws IOException {
return in.ready();
}
@Override
public void reset() throws IOException {
in.reset();
} }
@Override @Override
public long skip(long n) throws IOException { public long skip(long n) throws IOException {
readSomething = true; readSomething = true;
return input.skip(n); return in.skip(n);
} }
} }