Fixes accoridng upgrades

This commit is contained in:
Artem Bilan
2019-03-20 17:57:25 -04:00
parent 6e1de98d81
commit eca784de00
4 changed files with 15 additions and 12 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -69,7 +69,7 @@ abstract class AbstractTwitterMessageSource<T> extends IntegrationObjectSupport
private final String metadataKey;
private final Queue<T> tweets = new LinkedBlockingQueue<T>();
private final Queue<T> tweets = new LinkedBlockingQueue<>();
private volatile MetadataStore metadataStore;
@@ -120,7 +120,7 @@ abstract class AbstractTwitterMessageSource<T> extends IntegrationObjectSupport
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (this.metadataStore == null) {
// first try to look for a 'metadataStore' in the context

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,6 +28,7 @@ import org.springframework.util.Assert;
* @author Josh Long
* @author Oleg Zhurakousky
* @author Mark Fisher
* @author Artem Bilan
*/
public class DirectMessageSendingMessageHandler extends AbstractMessageHandler {
@@ -45,7 +46,7 @@ public class DirectMessageSendingMessageHandler extends AbstractMessageHandler {
}
@Override
protected void handleMessageInternal(Message<?> message) throws Exception {
protected void handleMessageInternal(Message<?> message) {
Assert.isTrue(message.getPayload() instanceof String, "Only payload of type String is supported. " +
"Consider adding a transformer to the message flow in front of this adapter.");
Object toUser = message.getHeaders().get(TwitterHeaders.DM_TARGET_USER_ID);
@@ -56,7 +57,7 @@ public class DirectMessageSendingMessageHandler extends AbstractMessageHandler {
if (toUser instanceof Number) {
this.twitter.directMessageOperations().sendDirectMessage(((Number) toUser).longValue(), payload);
}
else if (toUser instanceof String) {
else {
this.twitter.directMessageOperations().sendDirectMessage((String) toUser, payload);
}
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -72,7 +72,7 @@ public class StatusUpdatingMessageHandler extends AbstractMessageHandler {
}
@Override
protected void onInit() throws Exception {
protected void onInit() {
super.onInit();
if (this.evaluationContext == null) {
@@ -89,7 +89,7 @@ public class StatusUpdatingMessageHandler extends AbstractMessageHandler {
}
@Override
protected void handleMessageInternal(Message<?> message) throws Exception {
protected void handleMessageInternal(Message<?> message) {
Object value;
if (this.tweetDataExpression != null) {
value = this.tweetDataExpression.getValue(this.evaluationContext, message);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2018 the original author or authors.
* Copyright 2018-2019 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,6 +39,7 @@ import org.springframework.util.Assert;
* expression evaluation.
*
* @author Gary Russell
* @author Artem Bilan
*/
public class TwitterSearchOutboundGateway extends AbstractReplyProducingMessageHandler {
@@ -147,8 +148,9 @@ public class TwitterSearchOutboundGateway extends AbstractReplyProducingMessageH
}
SearchResults results = this.getTwitter().searchOperations().search(searchParameters);
if (results != null) {
List<Tweet> tweets = (results.getTweets() != null ? results.getTweets() : Collections.<Tweet>emptyList());
return this.getMessageBuilderFactory().withPayload(tweets)
List<Tweet> tweets = results.getTweets() != null ? results.getTweets() : Collections.emptyList();
return getMessageBuilderFactory()
.withPayload(tweets)
.setHeader(TwitterHeaders.SEARCH_METADATA, results.getSearchMetadata());
}
else {