Source:
<code>protected Object handleRequestMessage(Message<?> requestMessage) { Object query = this.queryExpression.getValue(this.evaluationContext, requestMessage); Assert.notNull(query, "The twitter search query cannot evaluate to 'null'."); SearchParameters searchParameters; if (query instanceof SearchParameters) { searchParameters = (SearchParameters) query; } else if (query instanceof String) { int count = this.limitExpression.getValue(this.evaluationContext, requestMessage, Integer.class); searchParameters = new SearchParameters((String) query).count(count); } else { throw new IllegalArgumentException("Query must evaluate to a 'SearchParamters' or 'String'."); } SearchResults results = this.getTwitter().searchOperations().search(searchParameters); List<Tweet> tweets = (results != null) ? results.getTweets() : Collections.<Tweet>emptyList(); if (this.isRequiresReply() && (tweets == null || tweets.size() == 0)) { return null; } else { return this.getMessageBuilderFactory().withPayload(tweets) .setHeader(TwitterHeaders.SEARCH_METADATA, results.getSearchMetadata()); } <START> } <END></code><technical_language>is reason check this.isRequiresReply(): java if (!CollectionUtils.isEmpty(tweets)) { return this.getMessageBuilderFactory().withPayload(tweets) .setHeader(TwitterHeaders.SEARCH_METADATA, results.getSearchMetadata()); } else { return null; } payload null anyway</technical_language>

Target:
protected Object handleRequestMessage(Message<?> requestMessage) { Object args = this.searchArgsExpression.getValue(this.evaluationContext, requestMessage); Assert.notNull(args, "The twitter search expression cannot evaluate to 'null'."); SearchParameters searchParameters; if (args instanceof SearchParameters) { searchParameters = (SearchParameters) args; } else if (args instanceof String) { searchParameters = new SearchParameters((String) args).count(DEFAULT_PAGE_SIZE); } else if (args instanceof List) { List<?> list = (List<?>) args; Assert.isTrue(list.size() > 0 && list.size() < 5, "Between 1 and 4 search arguments are required"); Assert.isInstanceOf(String.class, list.get(0), "The first search argument (query) must be a String"); searchParameters = new SearchParameters((String) list.get(0)); if (list.size() > 1) { Assert.isInstanceOf(Number.class, list.get(1), "The second search argument (pageSize) must be a Number"); searchParameters.count(((Number) list.get(1)).intValue()); if (list.size() > 2) { Assert.isInstanceOf(Number.class, list.get(2), "The third search argument (sinceId) must be a Number"); searchParameters.sinceId(((Number) list.get(2)).longValue()); } if (list.size() > 3) { Assert.isInstanceOf(Number.class, list.get(3), "The fourth search argument (maxId) must be a Number"); searchParameters.maxId(((Number) list.get(3)).longValue()); } } } else { throw new IllegalArgumentException( "Search Expression must evaluate to a 'SearchParameters', 'String' or 'List'."); } SearchResults results = this.getTwitter().searchOperations().search(searchParameters); List<Tweet> tweets = (results != null) ? results.getTweets() : null; if (tweets == null) { tweets = Collections.<Tweet>emptyList(); } return this.getMessageBuilderFactory().withPayload(tweets) .setHeader(TwitterHeaders.SEARCH_METADATA, results.getSearchMetadata()); }