Uploading file using dropbox causing null pointer exception in android
<p>can any one finds the cause for null pointer exception during uploading file using dropbox in android.. Here is my code below.. The "uFilePath" value i have given is "/mnt/sdcard/Download/myImg.jpg" where myImg.jpg is my file to upload...</p>

<pre><code>           @Override
           protected Boolean doInBackground(Void... params) {
           // TODO Auto-generated method stub
            FileInputStream fis=null;
           File file= new File(uFilePath, "myImg.jpg");
           uFileLen=file.length();
            try {
            fis = new FileInputStream(file);
            System.out.println("file="+file.getName()+" "+fis.toString()+" "+file.getPath());
            DropboxAPI.Entry newEntry = uDBApi.putFileOverwrite("myImg.jpg", fis, uFileLen, null);


            } catch (FileNotFoundException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
             } catch (DropboxException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
         }finally {
          if (fis != null) {
            try {
                fis.close();
            } catch (IOException e) {}
        }
    }
    return null;

}
</code></pre>

<p>here is the logcat message----</p>

<pre><code>09-22 03:27:17.335: E/AndroidRuntime(10331): FATAL EXCEPTION:   AsyncTask #1
09-22 03:27:17.335: E/AndroidRuntime(10331): java.lang.RuntimeException: An error occured while executing doInBackground()
09-22 03:27:17.335: E/AndroidRuntime(10331):    at android.os.AsyncTask$3.done(AsyncTask.java:278)
09-22 03:27:17.335: E/AndroidRuntime(10331):    at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:273)
09-22 03:27:17.335: E/AndroidRuntime(10331):    at java.util.concurrent.FutureTask.setException(FutureTask.java:124)
09-22 03:27:17.335: E/AndroidRuntime(10331):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:307)
09-22 03:27:17.335: E/AndroidRuntime(10331):    at java.util.concurrent.FutureTask.run(FutureTask.java:137)
09-22 03:27:17.335: E/AndroidRuntime(10331):    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076)
09-22 03:27:17.335: E/AndroidRuntime(10331):    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569)
09-22 03:27:17.335: E/AndroidRuntime(10331):    at java.lang.Thread.run(Thread.java:856)
09-22 03:27:17.335: E/AndroidRuntime(10331): Caused by: java.lang.NullPointerException
09-22 03:27:17.335: E/AndroidRuntime(10331):    at com.example.downloadupload.UploadPicture.doInBackground(UploadPicture.java:63)
09-22 03:27:17.335: E/AndroidRuntime(10331):    at com.example.downloadupload.UploadPicture.doInBackground(UploadPicture.java:1)
09-22 03:27:17.335: E/AndroidRuntime(10331):    at android.os.AsyncTask$2.call(AsyncTask.java:264)
09-22 03:27:17.335: E/AndroidRuntime(10331):    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305)
09-22 03:27:17.335: E/AndroidRuntime(10331):    ... 4 more
09-22 03:27:25.343: E/WindowManager(10331): Activity com.example.downloadupload.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41275178 that was originally added here
09-22 03:27:25.343: E/WindowManager(10331): android.view.WindowLeaked: Activity com.example.downloadupload.MainActivity has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView@41275178 that was originally added here
09-22 03:27:25.343: E/WindowManager(10331):     at android.view.ViewRootImpl.&lt;init&gt;(ViewRootImpl.java:383)
09-22 03:27:25.343: E/WindowManager(10331):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:279)
09-22 03:27:25.343: E/WindowManager(10331):     at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:215)
09-22 03:27:25.343: E/WindowManager(10331):     at android.view.WindowManagerImpl$CompatModeWrapper.addView(WindowManagerImpl.java:140)
09-22 03:27:25.343: E/WindowManager(10331):     at android.view.Window$LocalWindowManager.addView(Window.java:537)
09-22 03:27:25.343: E/WindowManager(10331):     at android.app.Dialog.show(Dialog.java:278)
09-22 03:27:25.343: E/WindowManager(10331):     at com.example.downloadupload.UploadPicture.&lt;init&gt;(UploadPicture.java:52)
09-22 03:27:25.343: E/WindowManager(10331):     at com.example.downloadupload.MainActivity.onClick(MainActivity.java:66)
09-22 03:27:25.343: E/WindowManager(10331):     at android.view.View.performClick(View.java:3558)
09-22 03:27:25.343: E/WindowManager(10331):     at android.view.View$PerformClick.run(View.java:14157)
09-22 03:27:25.343: E/WindowManager(10331):     at android.os.Handler.handleCallback(Handler.java:605)
09-22 03:27:25.343: E/WindowManager(10331):     at android.os.Handler.dispatchMessage(Handler.java:92)
09-22 03:27:25.343: E/WindowManager(10331):     at android.os.Looper.loop(Looper.java:137)
09-22 03:27:25.343: E/WindowManager(10331):     at android.app.ActivityThread.main(ActivityThread.java:4514)
09-22 03:27:25.343: E/WindowManager(10331):     at java.lang.reflect.Method.invokeNative(Native Method)
09-22 03:27:25.343: E/WindowManager(10331):     at java.lang.reflect.Method.invoke(Method.java:511)
09-22 03:27:25.343: E/WindowManager(10331):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
09-22 03:27:25.343: E/WindowManager(10331):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
09-22 03:27:25.343: E/WindowManager(10331):     at dalvik.system.NativeStart.main(Native Method)
</code></pre>
