Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Accessing Java Stack to inspect errors

    Recently encountered this error code:

    Code:
     error . . . . . . . . . . . . . . . . . . . . . . . . Return code 5100
            a Java runtime exception occurred;
            This indicates a Java runtime exception occurred inside a
            Java program.  Typically exceptions should be caught by the
            Java program and handled in a graceful way.  This error
            indicates the exception was not handled by the program and
            therefore it is handle by the system.
    Has anyone else figured out how to get the stack trace instead of only getting the return code? None of the code analysis/debugging tools I use seem to find any problems with the code, so it'd be helpful if there were a way to inspect this a bit more easily. I've tried to
    Code:
     set debug on
    and
    Code:
     set trace on
    but neither option returns any more information than the error code itself.

  • #2
    It is left up to the Java programmer to trap exceptions and to do something reasonable. Failing that you will get the message that you received, but usually with a stack trace if it is available. The Java code would typically look something like the following...

    Code:
              
    try {
        ...
    }
    catch(IOException e) {
        SFIToolkit.error("unable to open " + fname + " for writing\n") ;
        SFIToolkit.errorDebug(SFIToolkit.stackTraceToString(e)) ;
    }
    This would always print a reasonable error message when an IOException occurs, and if debug is on, a stack trace will also be shown.

    Comment

    Working...
    X