lucene-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From uschind...@apache.org
Subject svn commit: r806986 - in /lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/sinks: DateRecognizerSinkFilter.java TokenTypeSinkFilter.java
Date Sun, 23 Aug 2009 16:17:08 GMT
Author: uschindler
Date: Sun Aug 23 16:17:08 2009
New Revision: 806986

URL: http://svn.apache.org/viewvc?rev=806986&view=rev
Log:
LUCENE-1825: Additional incorrect getAttribute usage

Modified:
    lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/sinks/DateRecognizerSinkFilter.java
    lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/sinks/TokenTypeSinkFilter.java

Modified: lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/sinks/DateRecognizerSinkFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/sinks/DateRecognizerSinkFilter.java?rev=806986&r1=806985&r2=806986&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/sinks/DateRecognizerSinkFilter.java
(original)
+++ lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/sinks/DateRecognizerSinkFilter.java
Sun Aug 23 16:17:08 2009
@@ -51,17 +51,15 @@
 
   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) {
-          return true;
-        }
-      } catch (ParseException e) {
-    
+    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) {
+        return true;
       }
+    } catch (ParseException e) {
+  
     }
     
     return false;

Modified: lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/sinks/TokenTypeSinkFilter.java
URL: http://svn.apache.org/viewvc/lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/sinks/TokenTypeSinkFilter.java?rev=806986&r1=806985&r2=806986&view=diff
==============================================================================
--- lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/sinks/TokenTypeSinkFilter.java
(original)
+++ lucene/java/trunk/contrib/analyzers/common/src/java/org/apache/lucene/analysis/sinks/TokenTypeSinkFilter.java
Sun Aug 23 16:17:08 2009
@@ -31,15 +31,11 @@
 
   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()));
   }
 
 }



Mime
View raw message