Mahesh_Mori
Mahesh_Mori

Reputation: 3

Asmack getting NullPointerException while creating Privacy List

I am try to create/retrive Privacy List but I am getting NullPointerException. I am using ejabberd xmpp server.

Here id my code.

String listName = "newList";

            // Create the list of PrivacyItem that will allow or deny some privacy aspect
            String user = "[email protected]";
            String groupName = "enemies";
            ArrayList privacyItems = new ArrayList();

            PrivacyItem item = new PrivacyItem(PrivacyItem.Type.jid.toString(), true, 1);
            item.setValue(user);
            privacyItems.add(item);


            // Get the privacy manager for the current connection.
            PrivacyListManager privacyManager = PrivacyListManager.getInstanceFor(connection);
            // Create the new list.

            privacyManager.createPrivacyList(listName, privacyItems);

Upvotes: 0

Views: 209

Answers (0)

Related Questions