Device: HTC One mini
OS version: 4.3
Problem: AsyncTask XML reader crashes without triggering UncaughtExceptionHandler
.
I made a simple AsyncTask XML reader / parser that runs on most devices (OS 2.2 and older), but not on my HTC One mini (OS 4.3). When I try to run the AsyncTask, it always crashes at some point in code of doInBackground. Sometimes its on url.openConnection(), sometimes at httpurlconection.getInputStream(), sometimes at if(stream!=null)stream.close();, sometimes at some other random point in code. On very rare occasions the AsyncTask can finish itself, but crashes on the next request anyway.
The main loop is just waiting for the AsyncTask process to stop, by running a volatile boolean in while(XMLreaderAsyncTask.parsingnotComplete);
The kicker is that I use a DefaultUncaughtExceptionHandler to write a TXT file report on all crashes, but it doesn’t work/trigger for this type of crash. It works fine if I trigger it by going out of bounds of an array, but not for what is causing the crash of the AsyncTask XML reader.
public static Thread.UncaughtExceptionHandler androidDefaultUEH;
@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
...
androidDefaultUEH = Thread.getDefaultUncaughtExceptionHandler();
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler()
{
Write a TXT report file
androidDefaultUEH.uncaughtException(paramThread, paramThrowable);
}
...
}
I cant get eclipse to detect the phone as plugged in, so I cant get the LogCat report. At best, I put up checkpoint flags by writing into SharedPreferences
No comments:
Post a Comment