redirecting errors

Discussion in 'Java' started by bitshit, Aug 17, 2005.

  1. bitshit

    bitshit Guest

    Hi,

    Is it possible to redirect java errors to post to a url? I have a generic
    library that some third party classes extend. When these third party classes
    generate errors/crash i'd like to post these errors to a script instead of
    the jvm printing it standard to the console... it concerns applets, the
    third party applets extend a super class form my library where I migth be
    able to set such a redirect?

    Thanks!
    bitshit, Aug 17, 2005
    #1
    1. Advertising

  2. bitshit

    jan V Guest

    > Is it possible to redirect java errors to post to a url?

    Check out System.setErr(PrintStream) and System.setOut(PrintStream), taking
    particular note that both methods are SecurityManager-restricted (I'm
    assuming this can be solved by signing the applets). If you create a fancy
    PrintStream subclass which does your URL post stuff, you'd be home and dry,
    no?
    jan V, Aug 17, 2005
    #2
    1. Advertising

  3. bitshit

    Oliver Wong Guest

    "bitshit" <bitshit_at_hot_mail_dot_com> wrote in message
    news:4303aab0$0$767$...
    > Hi,
    >
    > Is it possible to redirect java errors to post to a url? I have a generic
    > library that some third party classes extend. When these third party
    > classes generate errors/crash i'd like to post these errors to a script
    > instead of the jvm printing it standard to the console... it concerns
    > applets, the third party applets extend a super class form my library
    > where I migth be able to set such a redirect?


    I think this kind of stuff is usually done via exception handling,
    except it assumes that you are invoking the methods which are generating the
    exception, and not the other way around. (Obligatory Slashdot reference: In
    Soviet Russia, methods generating exceptions invokes you!)

    You could try inverting the call hiearchy, by forcing the third party
    code to pass you something like a method pointer or delegate (or something
    like the Command design pattern), and then your library code calls this
    delegate, and catch any exception it throws, and post to whatever URL you
    want.

    - Oliver
    Oliver Wong, Aug 17, 2005
    #3
  4. bitshit

    Roedy Green Guest

    On Wed, 17 Aug 2005 23:23:00 +0200, "bitshit"
    <bitshit_at_hot_mail_dot_com> wrote or quoted :

    >Is it possible to redirect java errors to post to a url? I have a generic
    >library that some third party classes extend. When these third party classes
    >generate errors/crash i'd like to post these errors to a script instead of
    >the jvm printing it standard to the console... it concerns applets, the
    >third party applets extend a super class form my library where I migth be
    >able to set such a redirect?


    Remote I/O is still in the stone age. It is not like writing to a
    file. There is nothing at the other end to receive it. You have to
    deal with the various exceptions that may occur. Likely the sandbox
    will clamp down on you unless your Applet is signed.
    Roedy Green, Aug 18, 2005
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Goldin

    Errors, errors, errors

    Mark Goldin, Jan 17, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    927
    Mark Goldin
    Jan 17, 2004
  2. =?Utf-8?B?Sm9yZ2UgTWF0b3M=?=

    Handling errors and not redirecting to a custom error page

    =?Utf-8?B?Sm9yZ2UgTWF0b3M=?=, Oct 29, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    490
    Matt Berther
    Oct 29, 2004
  3. SenthilVel
    Replies:
    0
    Views:
    931
    SenthilVel
    Jun 7, 2006
  4. George1776

    Out-of-memory errors and caching errors.

    George1776, Aug 28, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    1,273
    George1776
    Sep 14, 2006
  5. Lance Wynn
    Replies:
    1
    Views:
    1,814
    Lance Wynn
    Feb 3, 2008
Loading...

Share This Page