Quantcast
Channel: Ignite Realtime : Discussion List - All Communities
Viewing all articles
Browse latest Browse all 10742

NullPointerException is asmack file incoming file transfer

$
0
0

I've been having serious issues trying to send a file to my android client  from a preexisting windows client. The Windows client works fine with incoming/outgoing to other Windows Client. The android client can only send to the Windows client, it can't recieve.

 

My code is

FileTransferManager manager = newFileTransferManager(connection);

manager.addFileTransferListener(newFileTransferListener() {

   publicvoidfileTransferRequest(finalFileTransferRequest request) {

      newThread(){

         @Override

         publicvoidrun() {

            IncomingFileTransfer transfer = request.accept();

            File mf = Environment.getExternalStorageDirectory();

            File file = newFile(mf.getAbsoluteFile()+"/DCIM/Camera/"+ transfer.getFileName());

            try{

                transfer.recieveFile(file);

                while(!transfer.isDone()) {

                   try{

                      Thread.sleep(1000L);

                   }catch(Exception e) {

                      Log.e("", e.getMessage());

                   }

                   if(transfer.getStatus().equals(Status.error)) {

                      Log.e("ERROR!!! ", transfer.getError() + "");

                   }

                   if(transfer.getException() != null) {

                      transfer.getException().printStackTrace();

                   }

                }

             }catch(Exception e) {

                Log.e("", e.getMessage());

            }

         };

       }.start();

    }

});

 

The code works fine in that I know the listener fires, I can use transfer.getFileName() and get FileSize to get that information, also, on my client a 0kb file is made when the file is sent from a different client (a windows client using the normal smack library)

 

In my android log, I get this

E/AndroidRuntime(21814): FATAL EXCEPTION: File Transfer jsi_8313049596512102350

E/AndroidRuntime(21814): java.lang.NullPointerException

E/AndroidRuntime(21814):        at org.jivesoftware.smackx.filetransfer.Incoming

FileTransfer.negotiateStream(IncomingFileTransfer.java:179)

E/AndroidRuntime(21814):        at org.jivesoftware.smackx.filetransfer.Incoming

FileTransfer$1.run(IncomingFileTransfer.java:124)

E/AndroidRuntime(21814):        at java.lang.Thread.run(Thread.java:856)


Viewing all articles
Browse latest Browse all 10742

Trending Articles