Help needed with FileTransfer

Hi all,

i’am trying to implement a file transfer with Smack. Unfortunately i am struggling with it, since i am new to Smack i can’t figure out, what the problem could be.

I used the following code (like that one found in the docs):

try {
                                      IncomingFileTransfer transfer = request.accept();
                                      File file = new File("test.txt");
                                      transfer.recieveFile();
                                      transfer.recieveFile(file);                                 } catch (Exception e) {
                                    // TODO Auto-generated catch block
                                    e.printStackTrace();
                                }

I got the following exception when i itiate a file transfer:

java.lang.NullPointerException
at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer.negotiateStream(Incom ingFileTransfer.java:179)
at org.jivesoftware.smackx.filetransfer.IncomingFileTransfer.recieveFile(IncomingF ileTransfer.java:73)
at edu.hm.ccism.dynascale.manager.ScaleManager$1.fileTransferRequest(ScaleManager. java:58)
at org.jivesoftware.smackx.filetransfer.FileTransferManager.fireNewRequest(FileTra nsferManager.java:104)
at org.jivesoftware.smackx.filetransfer.FileTransferManager$1.processPacket(FileTr ansferManager.java:90)
at org.jivesoftware.smack.PacketReader$ListenerWrapper.notifyListener(PacketReader .java:819)
at org.jivesoftware.smack.PacketReader$ListenerNotification.run(PacketReader.java: 799)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:636)

Is there anybody who can help? Any response is appreciated, because i am quite helpless with that issue.

Thanks in advance!

GLA

I debugged the with the Smack sources and the member “negotiator” of the IncomingFileTransfer instance is null. Probably this is of help…

Solved it myself. It’s simple (and embarrassing): I instantiated the FileTransferManager before i invoked XMPPConnection#connect.