powered by Jive Software

message.getProperty returns null

Hi,

Message.getProperty is returning null?

Here is my code

con=new XMPPConnection(HOST);

con.login(“user1”,“pwd”);

Chat c=_cn.createChat(“user2@…”);

Message m=c.createMessage();

m.setType(Message.Type.NORMAL);

m.setProperty(“prop”,true);

log.info(“prop=”+p.getProperty(“prop”)); //makin sure

c.sendMessage(m);

and here is my packetListener code

PacketFilter filter = new PacketTypeFilter(Message.class);

PacketListener listener = new PacketListener() {

public void processPacket(Packet packet) {

log.info(“packet =”+packet);

log.info(“prop=”+packet.getProperty(“prop”)); //returns null WHY?

}

};

con.addListener…

Im using jdk14

Dear Kris,

Have you checked the debug ouput to see what you are sending and receving ?

You are using a PacketTypeFilter for the PacketListener, this would filter all Message.class messages and would return null for those packets that do not have a “prop” attribute.

You could look at using an And filter to inspect the correct packet.

Hope this helps.

-Rajesh