if (catch Throwable) catches the Exception but (catch Exception) does
not, then the underlying fault is an Error not an Exception.
This should only have been thrown if the subsystem believes the whole
system is unstable and the world should halt.

See http://java.sun.com/javase/6/docs/api/index.html

Its worthwhile understanding the Java Exception mechanism.
Its one of the things I think really make Java strong as a development
language.

On Jul 29, 8:06 am, Leigh McRae <leigh.mc...@lonedwarfgames.com>
wrote:
> Thank you for taking the time to respond.  The only reason I catch
> Throwable is that the code is shared with BlackBerry and catching
> Throwable will generate a stack trace where Exception won't  It's some
> kind of optimization.
>
> I just tried wrapping the exception in RuntimeException and it works.  
> Cool bananas!  Thank you.
>
> Leigh
>
> On 7/28/2010 5:53 PM, William Ferguson wrote:
>
>
>
> > The stacktrace you are seeing is that raised by executing Assert#fail.
> > It is not your original Exception.
>
> > 1) You should probably not be catching Throwable. Catch the explicit
> > checked exception thrown by m_TheGame#load()
>
> > 2) If you want your original Exception to get propagated wrap it in a
> > RuntimeException, ie
> >    throw new RuntimeException(caughtExcetion);
>
> > 3) You shouldn't be using junit.framework.Assert#fail in production
> > code. It should only be using from a test harness.
>
> > William
>
> > On Jul 29, 12:14 am, Leigh McRae<leigh.mc...@lonedwarfgames.com>
> > wrote:
>
> >> Hello,
>
> >> I am finding the Android Market crash reports to be an unbelievably
> >> useful tool!  Unfortunately I am having issues with exceptions that
> >> happen off the main thread.  Since I am a C programmer, I dropped an
> >> assert down to get the game to stop.  Clearly I am not a Java expert.
> >> Is there some way I can get the stack trace of the offending thread?
>
> >> m_LoadThread = new Thread( new Runnable()
> >> {
> >>      public void run()
> >>      {
> >>          try
> >>          {
> >>              m_TheGame.load();
> >>          }
> >>          catch( Throwable t )
> >>          {
> >>              t.printStackTrace();
> >>              junit.framework.Assert.fail( "LoadingMode.LoadThread: " +
> >> t.toString() );
> >>          }
> >>      }
>
> >> } );
>
> >> m_LoadThread.start();
>
> >> This is what I get in the report.  It's better than nothing but more
> >> would be good.
>
> >> junit.framework.AssertionFailedError: LoadingMode.LoadThread:
> >> java.lang.NullPointerException
> >>    at junit.framework.Assert.fail(Assert.java:47)
> >>    at com.lonedwarfgames.tanks.utils.Assert.RIP(Assert.java:82)
> >>    at com.lonedwarfgames.tanks.modes.LoadingMode$1.run(LoadingMode.java:
> >> 93)
> >>    at java.lang.Thread.run(Thread.java:1096)
>
> --
> Leigh McRaewww.lonedwarfgames.com

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to