mirror of https://github.com/apache/lucene.git
this ctor doesn't throw IOE anymore
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1459441 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
6385447660
commit
26b6e88533
|
@ -65,12 +65,12 @@ public final class PatternTokenizer extends Tokenizer {
|
|||
private final Matcher matcher;
|
||||
|
||||
/** creates a new PatternTokenizer returning tokens from group (-1 for split functionality) */
|
||||
public PatternTokenizer(Reader input, Pattern pattern, int group) throws IOException {
|
||||
public PatternTokenizer(Reader input, Pattern pattern, int group) {
|
||||
this(AttributeFactory.DEFAULT_ATTRIBUTE_FACTORY, input, pattern, group);
|
||||
}
|
||||
|
||||
/** creates a new PatternTokenizer returning tokens from group (-1 for split functionality) */
|
||||
public PatternTokenizer(AttributeFactory factory, Reader input, Pattern pattern, int group) throws IOException {
|
||||
public PatternTokenizer(AttributeFactory factory, Reader input, Pattern pattern, int group) {
|
||||
super(factory, input);
|
||||
this.pattern = pattern;
|
||||
this.group = group;
|
||||
|
|
|
@ -91,10 +91,6 @@ public class PatternTokenizerFactory extends TokenizerFactory
|
|||
*/
|
||||
@Override
|
||||
public PatternTokenizer create(final AttributeFactory factory, final Reader in) {
|
||||
try {
|
||||
return new PatternTokenizer(factory, in, pattern, group);
|
||||
} catch( IOException ex ) {
|
||||
throw new RuntimeException("IOException thrown creating PatternTokenizer instance", ex);
|
||||
}
|
||||
return new PatternTokenizer(factory, in, pattern, group);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,13 +129,8 @@ public class TestPatternTokenizer extends BaseTokenStreamTestCase
|
|||
Analyzer a = new Analyzer() {
|
||||
@Override
|
||||
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
|
||||
Tokenizer tokenizer = null;
|
||||
try {
|
||||
tokenizer = new PatternTokenizer(reader, Pattern.compile("a"), -1);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return new TokenStreamComponents(tokenizer, tokenizer);
|
||||
Tokenizer tokenizer = new PatternTokenizer(reader, Pattern.compile("a"), -1);
|
||||
return new TokenStreamComponents(tokenizer);
|
||||
}
|
||||
};
|
||||
checkRandomData(random(), a, 1000*RANDOM_MULTIPLIER);
|
||||
|
@ -143,13 +138,8 @@ public class TestPatternTokenizer extends BaseTokenStreamTestCase
|
|||
Analyzer b = new Analyzer() {
|
||||
@Override
|
||||
protected TokenStreamComponents createComponents(String fieldName, Reader reader) {
|
||||
Tokenizer tokenizer = null;
|
||||
try {
|
||||
tokenizer = new PatternTokenizer(reader, Pattern.compile("a"), 0);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return new TokenStreamComponents(tokenizer, tokenizer);
|
||||
Tokenizer tokenizer = new PatternTokenizer(reader, Pattern.compile("a"), 0);
|
||||
return new TokenStreamComponents(tokenizer);
|
||||
}
|
||||
};
|
||||
checkRandomData(random(), b, 1000*RANDOM_MULTIPLIER);
|
||||
|
|
Loading…
Reference in New Issue