Exceptions in embedded env.

  • Thread starter thelazydogsback
  • Start date
T

thelazydogsback

I'm trying to catch exceptions that are happening on some J2ME (MIDP1)
phones. I notice that j.l.Exception does not have a LineNumber field.
There is no stdout or stderr that I have access to.
If I could capture the exception information, I could do something else
with it like draw the string locally or send it to my server to display
there.

There is a PrintStackTrace method - but no equally easy to call but
more powerful GetStackTrace - why would anyone design-in a side-effect
only function like this?
And why the hell is System.err "final" - otherwise I'd reassign it to
an output stream that I could capture... (This is the problem with OOP
unless there's an escape mechanism...)

Is there a way to do this that I'm missing?

thanks,
mike
 
T

Thomas Fritsch

I'm trying to catch exceptions that are happening on some J2ME (MIDP1)
phones. I notice that j.l.Exception does not have a LineNumber field.
There is no stdout or stderr that I have access to.
If I could capture the exception information, I could do something else
with it like draw the string locally or send it to my server to display
there.

There is a PrintStackTrace method - but no equally easy to call but
more powerful GetStackTrace - why would anyone design-in a side-effect
only function like this?
And why the hell is System.err "final" - otherwise I'd reassign it to
an output stream that I could capture... (This is the problem with OOP
unless there's an escape mechanism...)
You can reassign System.err to whatever you want with
System.setErr(yourPrintStream);
 
T

Thomas Hawtin

As far as I can see, the only way to capture where the exception was
thrown is to instrument the code. I don't know any software to do that.

Failing that, I'd suggest a complete set of unit tests...
You can reassign System.err to whatever you want with
System.setErr(yourPrintStream);

Not in MIDP (1.0 or 2.0) you can't.

Tom Hawtin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top