[ 
https://issues.apache.org/jira/browse/STREAMS-448?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15843614#comment-15843614
 ] 

ASF GitHub Bot commented on STREAMS-448:
----------------------------------------

GitHub user steveblackmon opened a pull request:

    https://github.com/apache/incubator-streams/pull/354

    STREAMS-448: TwitterTimelineProvider bug fix

    resolves STREAMS-448

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/steveblackmon/incubator-streams STREAMS-448

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/incubator-streams/pull/354.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #354
    
----
commit 5649ff6ff0fe7253f9a3e7ffb076b6b3be51c1c1
Author: Steve Blackmon @steveblackmon <sblack...@apache.org>
Date:   2017-01-27T22:58:48Z

    STREAMS-448: TwitterTimelineProvider bug fix
    
    resolves STREAMS-448

----


> TwitterUserInformationConfiguration only accepts Twitter IDs not usernames
> --------------------------------------------------------------------------
>
>                 Key: STREAMS-448
>                 URL: https://issues.apache.org/jira/browse/STREAMS-448
>             Project: Streams
>          Issue Type: Bug
>            Reporter: Trevor Grant
>
> When attempting to create a stream with a Twitter provider, the `info` field 
> should contain numerical TwitterIDs or usernames, however when using twitter 
> usernames an error is generated
> ```
> java.lang.IllegalArgumentException
>       at 
> com.google.common.base.Preconditions.checkArgument(Preconditions.java:108)
>       at 
> org.apache.streams.twitter.provider.TwitterTimelineProvider.startStream(TwitterTimelineProvider.java:110)
> ```
> TO RECREATE:
> ```scala
> import com.typesafe.config._
> import org.apache.streams.config._
> import org.apache.streams.core._
> import java.util.Iterator
> import org.apache.streams.twitter.TwitterUserInformationConfiguration
> import org.apache.streams.twitter.pojo._
> import org.apache.streams.twitter.provider._
> val hocon = s"""
>     twitter {
>       oauth {
>        consumerKey = ""
>     consumerSecret = ""
>     accessToken = ""
>     accessTokenSecret = ""
>       }
>       retrySleepMs = 5000
>   retryMax = 250
>   info = [
>     rawkintrevo   <--- This will create an error
>     1566016094 <--- this will not
>   ]
>     }
> """
> val buf = scala.collection.mutable.ArrayBuffer.empty[Object]
> val typesafe = ConfigFactory.parseString(hocon)
> val config = new 
> ComponentConfigurator(classOf[TwitterUserInformationConfiguration]).detectConfiguration(typesafe,
>  "twitter");
> val provider = new TwitterTimelineProvider(config);
> provider.prepare(null)
> provider.startStream()
> while(provider.isRunning()) {
>     val resultSet = provider.readCurrent()
>     resultSet.size()
>     val iterator = resultSet.iterator();
>     while(iterator.hasNext()) {
>         val datum = iterator.next();
>         println(datum.getDocument)
>         buf += datum.getDocument
>     }   
> }
> ```



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to