streams-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sblackmon <sblack...@apache.org>
Subject Re: provider.prepare(null) kicks NullPointerException
Date Thu, 03 Nov 2016 15:40:32 GMT
 
Trevor,

klass is a paradigm we used to use to allow the stream builder to tell the provider what type
of (JVM) Object document to produce.  

In this case, the provider always produces documents of org.apache.streams.facebook.Post
Yet the klass option hasn’t been fully removed.  

You’re probably fine to give it classOf[String] or classOf[org.apache.streams.facebook.Post]
or literally anything aside from null  

However, this provider doesn’t have any integration tests, so there’s no way to be sure
whether or not it still works.  

The place to start with facebook is https://developers.facebook.com/tools/explorer/ - create
app/credentials for yourself and confirm these endpoints return data:  

GET /v2.8/me  
GET /v2.8/me/friends
GET /v2.8/me/feed

That last one is what org.apache.streams.facebook.provider.FacebookFriendFeedProvider uses. 

Good luck  

P.S. App tokens generated in graph explorer time out really fast.  You’ll have to do a
real oauth handshake to create tokens that last more than a day.

On November 3, 2016 at 8:33:49 AM, Trevor Grant (trevor.d.grant@gmail.com(mailto:trevor.d.grant@gmail.com))
wrote:

> Sorry,
>  
> would normally put this on user@ but we don't seem to have one yet.
>  
> creating a facebook provider.
>  
> The following code give a NullPointerException
>  
> ```scala
> import org.apache.streams.facebook.FacebookUserstreamConfiguration
> import org.apache.streams.facebook.provider.FacebookFriendFeedProvider
>  
> val typesafe = ConfigFactory.parseString(credentials)
> val config = new
> ComponentConfigurator(classOf[FacebookUserstreamConfiguration]).detectConfiguration(typesafe,
> "facebook");
> val provider = new FacebookFriendFeedProvider(config);
>  
> provider.prepare(null)
> ```
>  
> java.lang.NullPointerException
> at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:191)
> at
> org.apache.streams.facebook.provider.FacebookFriendFeedProvider.prepare(FacebookFriendFeedProvider.java:200)
>  
> Upon examining the source:
> https://github.com/apache/incubator-streams/blob/d1022dceed6020f37d6f78bffe403f51be8a10d5/streams-contrib/streams-provider-facebook/src/main/java/org/apache/streams/facebook/provider/FacebookFriendFeedProvider.java#L200
>  
> It seems we have some Class klass
>  
> So after groking the code for a while this morning- I can't for the life of
> me figure out what Class klass is even supposed to do (other than jam me
> up).
>  
> Can someone please help / explain what and where I have gone wrong?
>  
> tg
>  
>  
> Trevor Grant
> Data Scientist
> https://github.com/rawkintrevo
> http://stackexchange.com/users/3002022/rawkintrevo
> http://trevorgrant.org
>  
> *"Fortunate is he, who is able to know the causes of things." -Virgil*


Mime
View raw message