Frage

I managed to connect to my XMPP server through asmack but i see a NullPointerException warning after connecting . I put the carcets.bks file in the raw folder. Is this warning important?

the logcat show:

java.lang.NullPointerException
at java.io.File.fixSlashes(File.java:185)
at java.io.File.<init>(File.java:134)
at java.io.FileInputStream.<init>(FileInputStream.java:105)
at org.jivesoftware.smack.ServerTrustManager.<init>(ServerTrustManager.java:62)
at org.jivesoftware.smack.XMPPConnection.proceedTLSReceived(XMPPConnection.java:839)
at org.jivesoftware.smack.PacketReader.parsePackets(PacketReader.java:268)
at org.jivesoftware.smack.PacketReader.access$000(PacketReader.java:44)
at org.jivesoftware.smack.PacketReader$1.run(PacketReader.java:71)


   this is my connection :

    configure(ProviderManager.getInstance());
    config = new ConnectionConfiguration(server, port);
    config.setCompressionEnabled(true);
    config.setSecurityMode(SecurityMode.enabled);
    config.setSASLAuthenticationEnabled(true);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        config.setTruststoreType("AndroidCAStore");
        config.setTruststorePassword(null);
        config.setTruststorePath(null);
    } else {
        config.setTruststoreType("BKS");
        String path = System.getProperty("javax.net.ssl.trustStore");
        path = System.getProperty("java.home") + File.separator + "etc"
                + File.separator + "security" + File.separator
                + "cacerts.bks";
        config.setTruststorePath(path);
    }
    connection = new XMPPConnection(config);
    connection.connect();
War es hilfreich?

Lösung

Your problem is the trust store path. Your exception occurs when the path is being looked up.

Are you hitting the first condition for the build version? The path is set to null in that case.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top