Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NullPointerException Exception - TweetCreateRequest #62

Open
drveresh opened this issue Jul 9, 2023 · 0 comments
Open

NullPointerException Exception - TweetCreateRequest #62

drveresh opened this issue Jul 9, 2023 · 0 comments

Comments

@drveresh
Copy link

drveresh commented Jul 9, 2023

As per this code to post a tweet https://github.com/twitterdev/twitter-api-java-sdk/blob/main/docs/TweetsApi.md#createTweet, it is throwing a NullPointer error.

Expected behavior

A given text should be created or posted.

Actual behavior

With all latest jar files and JDK, getting below error, that has no clue to fix:

Exception in thread "main" java.lang.NullPointerException
	at com.twitter.clientlib.model.TweetCreateRequest$ReplySettingsEnum$Adapter.write(TweetCreateRequest.java:129)
	at com.twitter.clientlib.model.TweetCreateRequest$ReplySettingsEnum$Adapter.write(TweetCreateRequest.java:126)
	at com.google.gson.internal.bind.TypeAdapterRuntimeTypeWrapper.write(TypeAdapterRuntimeTypeWrapper.java:68)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$1.write(ReflectiveTypeAdapterFactory.java:99)
	at com.google.gson.internal.bind.ReflectiveTypeAdapterFactory$Adapter.write(ReflectiveTypeAdapterFactory.java:219)
	at com.google.gson.TypeAdapter.toJsonTree(TypeAdapter.java:230)
	at com.twitter.clientlib.model.TweetCreateRequest$CustomTypeAdapterFactory$1.write(TweetCreateRequest.java:492)
	at com.twitter.clientlib.model.TweetCreateRequest$CustomTypeAdapterFactory$1.write(TweetCreateRequest.java:489)
	at com.google.gson.TypeAdapter$1.write(TypeAdapter.java:191)
	at com.google.gson.Gson.toJson(Gson.java:600)
	at com.google.gson.Gson.toJson(Gson.java:579)
	at com.google.gson.Gson.toJson(Gson.java:534)
	at com.google.gson.Gson.toJson(Gson.java:514)
	at com.twitter.clientlib.JSON.serialize(JSON.java:958)
	at com.twitter.clientlib.ApiClient.serialize(ApiClient.java:993)
	at com.twitter.clientlib.ApiClient.buildRequest(ApiClient.java:1269)
	at com.twitter.clientlib.ApiClient.buildCall(ApiClient.java:1222)
	at com.twitter.clientlib.api.TweetsApi.createTweetCall(TweetsApi.java:308)
	at com.twitter.clientlib.api.TweetsApi.createTweetValidateBeforeCall(TweetsApi.java:320)
	at com.twitter.clientlib.api.TweetsApi.createTweetWithHttpInfo(TweetsApi.java:327)
	at com.twitter.clientlib.api.TweetsApi.access$500(TweetsApi.java:89)
	at com.twitter.clientlib.api.TweetsApi$APIcreateTweetRequest.execute(TweetsApi.java:383)
	at com.veer.social.twitter.test.TwitterTestPost1.main(TwitterTestPost1.java:42)
	

Steps to reproduce the behavior

Just run that code and it gives the above error.

Please help me out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@drveresh and others