Note that there are some explanatory texts on larger screens.

plurals
  1. POSmack getPrivacyList method throws classCastException
    primarykey
    data
    text
    <p>I am using Smack in an Android app for XMPP based communication. I am trying to create a privacy list using PrivacyManager. I have created a PrivacyList successfully, but when I try to access that list it returns ClassCastException. Here is the code:</p> <pre><code>PrivacyListManager privacyManager; privacyManager = PrivacyListManager.getInstanceFor(connection); PrivacyList privacyList = privacyManager.getPrivacyList("msg_block_list"); </code></pre> <p>Investigating a bit more, I have found that the exception occurs in getRequest method in PrivacyListManager.java class on following line:</p> <pre><code>Privacy privacyAnswer = (Privacy) response.nextResult(SmackConfiguration.getPacketReplyTimeout()); </code></pre> <p>Here is the getRequest method:</p> <pre><code>private Privacy getRequest(Privacy requestPrivacy) throws XMPPException { // The request is a get iq type requestPrivacy.setType(Privacy.Type.GET); requestPrivacy.setFrom(this.getUser()); // Filter packets looking for an answer from the server. PacketFilter responseFilter = new PacketIDFilter(requestPrivacy.getPacketID()); PacketCollector response = connection.createPacketCollector(responseFilter); // Send create &amp; join packet. connection.sendPacket(requestPrivacy); // Wait up to a certain number of seconds for a reply. Privacy privacyAnswer = (Privacy) response.nextResult(SmackConfiguration.getPacketReplyTimeout()); // Stop queuing results response.cancel(); // Interprete the result and answer the privacy only if it is valid if (privacyAnswer == null) { throw new XMPPException("No response from server."); } else if (privacyAnswer.getError() != null) { throw new XMPPException(privacyAnswer.getError()); } return privacyAnswer; } </code></pre> <p>I have followed <a href="http://www.igniterealtime.org/builds/smack/docs/latest/documentation/privacy.html" rel="nofollow">this</a> tutorial for implementing PrivacyList. Anyone can help?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload