我设法通过 asmack 连接到我的 XMPP 服务器,但连接后我看到 NullPointerException 警告。我将 carcets.bks 文件放在 raw 文件夹中。这个警告重要吗?
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();