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

Unexpected FileNotFoundException while upgrading from 2.0.2 to 2.0.3 #45

Open
rzo1 opened this issue Oct 3, 2022 · 5 comments
Open

Comments

@rzo1
Copy link

rzo1 commented Oct 3, 2022

If no sdk.properties is present, the following stacktrace is printed:

java.io.FileNotFoundException: sdk.properties (No such file or directory)
        at java.base/java.io.FileInputStream.open0(Native Method)
        at java.base/java.io.FileInputStream.open(FileInputStream.java:216)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)
        at java.base/java.io.FileInputStream.<init>(FileInputStream.java:111)
        at com.twitter.clientlib.SDKConfig.<clinit>(SDKConfig.java:38)
        at com.twitter.clientlib.api.TwitterApi.init(TwitterApi.java:75)
        at com.twitter.clientlib.api.TwitterApi.<init>(TwitterApi.java:50)

The change was introduced with #32.

Can we simply ignore the exception in https://github.com/twitterdev/twitter-api-java-sdk/blob/main/src/main/java/com/twitter/clientlib/SDKConfig.java#L40 instead of printing the stacktrace, which might confuse users?

AFAIK the sdk.properties aren't mandatory, so perhaps it would be best to just ignore the exception instead of printing the stacktrace?

In addition, I am wondering, if this snippet shouldn't use the classloader in order to load the properties file?

@nn81
Copy link

nn81 commented Oct 15, 2022

Same thing here. That error has no reason to exist and should ignore whenever not finding an sdk.properties file.

As quick fix, I've just created an empty file at the root of the project and no more unnecessary error messages on startup.

mhoshi-vm added a commit to mhoshi-vm/twitter-wordcloud that referenced this issue Dec 16, 2022
@janikdotzel
Copy link

Experiencing the same here. It is indeed confusing.
Thanks @nn81 for the suggestion. Will do the same to keep my log clean.

@0xacx
Copy link

0xacx commented Mar 3, 2023

I get the same error in 2.0.3 version. This, combined with the fact that twitter api was not working properly yesterday, led me to wonder what went wrong and if additional configuration was needed. Good to know the sdk.properties file is not necessary.

@drveresh
Copy link

drveresh commented Jul 9, 2023

I am also facing the same issue.

@kosuodhmwa
Copy link

self-cite: <i've just created an empty file sdk.properties in project's root folder then that message was gone>

#75

adequate solution?

thx for feedback.

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

6 participants