powered by Jive Software

PacketListener -- NullPointerException

Hi everyone-

I am writing my first noteworthy application, a simple googletalk (and as soon as I get it working I will make server selection possible) bot. It compiles fine, but when I try to run it, it says:

=======================

Welcone to the JeffBot.

Please Log in

Username:

Password:

Logging in…

Logged in

Monitoring…

java.lang.NullPointerException

at org.jivesoftware.smack.PacketReader$ListenerWrapper.notifyListener(PacketReader .java:739)

at org.jivesoftware.smack.PacketReader.processListeners(PacketReader.java:250)

at org.jivesoftware.smack.PacketReader.access$100(PacketReader.java:43)

at org.jivesoftware.smack.PacketReader$2.run(PacketReader.java:72)

And it keeps running; I can tell it to send a message, but It WILL NOT RECIEVE ONE. Here is the relevant code::

:[code]

try

{

firstbot_trans trans = new firstbot_trans(con, usrname);

con.addPacketListener(trans.getThePacketListener(),trans.getThePacketFilter());

System.out.print(“Monitoring…\n”);

}

catch(Exception e)

{

System.out.print("\nError Monitoring…\nAborting\n\nError was::\n"+e);

System.exit(1);

}[/code]

PacketListener listener = new PacketListener() {

public void processPacket(Packet packet) {

new firstbot_client(con, packet.getFrom()).run();

System.out.print("\nTalking to “packet.getFrom()”\n");

}

};

FromContainsFilter filter = new FromContainsFilter("");[/code]

:[code]

public PacketListener getThePacketListener()

{

return listener;

}

public FromContainsFilter getThePacketFilter()

{

return filter;

}[/code]

:[code]

GoogleTalkConnection con;

String ClientName;

public firstbot_client(GoogleTalkConnection pcon, String pClientName)

{

con=pcon;

ClientName=pClientName;

}

public void run()

{

try

{

Chat chat=con.createChat(ClientName);

chat.sendMessage(“HELLO”);

System.out.print("\n Said hi to “ClientName”!\n");

}

catch(Exception e)

{

System.out.print("\n\nERROR:: “e”\n");

}

}[/code]

Any help or explanations would be greatly appreciated.

Thanks,

–Jeff