LUCENE-1825: Additional incorrect getAttribute usage

git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@806986 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Uwe Schindler 2009-08-23 16:17:08 +00:00
parent 6847c0e2bd
commit c2f95d474b
2 changed files with 9 additions and 15 deletions

View File

@ -51,9 +51,8 @@ public class DateRecognizerSinkFilter extends SinkFilter {
public boolean accept(AttributeSource source) {
if (termAtt == null) {
termAtt = (TermAttribute) source.getAttribute(TermAttribute.class);
termAtt = (TermAttribute) source.addAttribute(TermAttribute.class);
}
if (termAtt != null) {
try {
Date date = dateFormat.parse(termAtt.term());//We don't care about the date, just that we can parse it as a date
if (date != null) {
@ -62,7 +61,6 @@ public class DateRecognizerSinkFilter extends SinkFilter {
} catch (ParseException e) {
}
}
return false;
}

View File

@ -31,15 +31,11 @@ public class TokenTypeSinkFilter extends SinkFilter {
public boolean accept(AttributeSource source) {
if (typeAtt == null) {
typeAtt = (TypeAttribute) source.getAttribute(TypeAttribute.class);
typeAtt = (TypeAttribute) source.addAttribute(TypeAttribute.class);
}
//check to see if this is a Category
if (typeAtt != null && typeToMatch.equals(typeAtt.type())){
return true;
}
return false;
return (typeToMatch.equals(typeAtt.type()));
}
}