JasonWongYH / mytracks

Automatically exported from code.google.com/p/mytracks
0 stars 0 forks source link

Crash when save track to SD card #1185

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This crash happens in following situation:
(1)User save track to sd card;
(2)User play track in Google Earth;

java.lang.RuntimeException: An error occured while executing doInBackground()
    at android.os.AsyncTask$3.done(AsyncTask.java:200)
    at java.util.concurrent.FutureTask$Sync.innerSetException(FutureTask.java:274)
    at java.util.concurrent.FutureTask.setException(FutureTask.java:125)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:308)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1088)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:581)
    at java.lang.Thread.run(Thread.java:1027)
Caused by: java.lang.NullPointerException
    at com.google.android.apps.mytracks.io.file.TrackWriterImpl.java.lang.String getAbsolutePath()(MT:82)
    at com.google.android.apps.mytracks.io.file.SaveAsyncTask.java.lang.Boolean saveOneTrack(long,boolean)(MT:160)
    at com.google.android.apps.mytracks.io.file.SaveAsyncTask.java.lang.Boolean doInBackground$5f8445a4()(MT:120)
    at com.google.android.apps.mytracks.io.file.SaveAsyncTask.java.lang.Object doInBackground(java.lang.Object[])(MT:1)
    at android.os.AsyncTask$2.call(AsyncTask.java:185)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:306)

May the root cause of this crash is MyTracks missing a branch(doWriteTrack() 
method of TrackWriterImpl.java) when open file failed. 
As following shows:

line 104:
  private void doWriteTrack() {
    // Open the input and output
    success = false;
    errorMessage = R.string.external_storage_save_error;
    if (track != null) {
      if (openFile()) {
       ....
      }
      // Here need a else branch 
    }
  }

Original issue reported on code.google.com by youtaol@google.com on 1 Nov 2012 at 9:29

GoogleCodeExporter commented 9 years ago

Original comment by jshih@google.com on 2 Nov 2012 at 7:54