Skip to content

Commit

Permalink
Corrected NPE caused by TweetProcessor
Browse files Browse the repository at this point in the history
  • Loading branch information
brmeyer committed Nov 13, 2012
1 parent 8f41d34 commit 2076bc4
Showing 1 changed file with 4 additions and 3 deletions.
Expand Up @@ -32,6 +32,8 @@ public class TweetProcessor {
public void process(Exchange exchange) {
Status tweet = exchange.getIn().getBody(Status.class);

List<String> tokens = new ArrayList<String>();

GeoLocation location = tweet.getGeoLocation();
// The tweet must be geotagged.
// Skip any accounts flagged with non-English languages.
Expand All @@ -51,7 +53,6 @@ public void process(Exchange exchange) {
// remove non-alphanumeric characters
text = P_NON_ALPHANUMERIC.matcher(text).replaceAll("");

List<String> tokens = new ArrayList<String>();

// Lucene StandardAnalyzer
TokenStream ts = analyzer.tokenStream("contents", new StringReader(text));
Expand All @@ -66,8 +67,8 @@ public void process(Exchange exchange) {
} catch (Exception e) {
e.printStackTrace();
}

exchange.getIn().setBody(new ProcessedTweet(tweet, tokens));
}

exchange.getIn().setBody(new ProcessedTweet(tweet, tokens));
}
}

0 comments on commit 2076bc4

Please sign in to comment.