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

Java.lang.IllegalStateException: TrustManagerFactory is not initialized. #402

Closed
MaciekMiszczak opened this issue Mar 16, 2016 · 5 comments

Comments

@MaciekMiszczak
Copy link

Android 5.0.2
ACRA 4.8.4, run from source (in app\src\main\java\org\acra etc.)

Config:
@ReportsCrashes(
formUri = "https://XXX.php",
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.str_acra_crash_report_info)
Init: just ACRA.init(this) in App.onCreate().

Getting an error:
java.lang.IllegalStateException: TrustManagerFactory is not initialized
at com.android.org.conscrypt.TrustManagerFactoryImpl.engineGetTrustManagers(TrustManagerFactoryImpl.java:77)
at javax.net.ssl.TrustManagerFactory.getTrustManagers(TrustManagerFactory.java:219)
at org.acra.util.HttpRequest.send(HttpRequest.java:100)
at org.acra.sender.HttpSender.send(HttpSender.java:233)
at org.acra.sender.ReportDistributor.sendCrashReport(ReportDistributor.java:102)
at org.acra.sender.ReportDistributor.distribute(ReportDistributor.java:70)
at org.acra.sender.SenderService.onHandleIntent(SenderService.java:69)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:65)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:135)
at android.os.HandlerThread.run(HandlerThread.java:61)

@william-ferguson-au
Copy link
Member

Do you want to supply a PR with the fix?

@MaciekMiszczak
Copy link
Author

Heh, I was just typing, that if I knew how to do it, I would do it with pleasure. :)
Checked, works:
if (config.keyStoreFactory() != null) {
tmf.init(config.keyStoreFactory().create(context));
} else {
tmf.init((KeyStore) null);
}

@MaciekMiszczak
Copy link
Author

I would be happy as hell now, if I didn't get a "Trust anchor for certification path not found." error. Damn.

@MaciekMiszczak
Copy link
Author

Hmm... Probably should be in an opposite order, just to stick to some good practices: (== null) first, then "else". :)

@F43nd1r
Copy link
Member

F43nd1r commented Mar 16, 2016

That's all kinda my fault, so I'm happy to fix it.

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

3 participants