Hi all,
I writing a client xmpp to transfer files.
I saw discussions in this forum but i couldn"t find the answer to my problem.
When I try to send a File, The transfer is never started
Here is the code:
FileTransferManager ftm = new FileTransferManager(connection.getConnection());
File f = new File(filePath);
System.out.println("Transfer File: " + filePath + " to : " + to);
OutgoingFileTransfer oft = ftm.createOutgoingFileTransfer(to );
oft.sendFile(f, " msg");
System.out.println("transfer negotiatiated "+FileTransferNegotiator.isServiceEnabled(connection.getConnection()));
while (!oft.isDone()) {
if (oft.getStatus().equals(Status.error)) {
System.out.println("ERROR!!! " + oft.getError());
oft.cancel();
}
System.out.println(oft.getStatus());
System.out.println(oft.getProgress());
System.out.println(“sleeping 4 sec”);
try {
Thread.sleep(4000);
} catch (InterruptedException e) {
System.err.println("Error sleeping during OFT : " + e.getMessage());
}
}
In the trace I Find this bug:
transfer negotiatiated true
Negotiating Transfer
0.0
sleeping 4 sec
Negotiating Stream
0.0
sleeping 4 sec
Negotiating Stream
0.0
sleeping 4 sec
Exception in thread “File Transfer jsi_1782245567159098896” java.lang.NullPointerException
at org.jivesoftware.smack.XMPPConnection.createPacketCollector(XMPPConnection.java :826)
at org.jivesoftware.smackx.filetransfer.IBBTransferNegotiator.createOutgoingStream (IBBTransferNegotiator.java:112)
at org.jivesoftware.smackx.filetransfer.FaultTolerantNegotiator.createOutgoingStre am(FaultTolerantNegotiator.java:146)
at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer.negotiateStream(Outgo ingFileTransfer.java:373)
at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer.access$100(OutgoingFi leTransfer.java:35)
at org.jivesoftware.smackx.filetransfer.OutgoingFileTransfer$2.run(OutgoingFileTra nsfer.java:214)
at java.lang.Thread.run(Thread.java:679)
Negotiating Stream
0.0
sleeping 4 sec
Negotiating Stream
0.0
sleeping 4 sec
Negotiating Stream …
Does someone have any idea about this bug.
Thanks in advance.