I am guessing this solution will only work for application generated
runtimes.  I have a client that is causing errors in binding, for
example they are providing white space chars in numeric values, this
creates a NumberFormatEception but the client sees a 500 server error.
I want to catch this and return a sensible error.  

Forgive me if I missed something in your mail.

Gavin

___________________________________________

Gavin Hogan
Programmer/Analyst
The State University of New York
State University Plaza
Albany, NY 12246
Phone 518-443-5481
fax 518-443-5809
e-mail [EMAIL PROTECTED] 

-----Original Message-----
From: Werner Lehmann [mailto:[EMAIL PROTECTED] 
Sent: Friday, September 28, 2007 2:55 PM
To: [email protected]
Subject: Re: [xfire-user] Exception Handling


There is a solution if you use XFire in the client API sense (code 
first, identical domain classes on server and client). I created a 
generic exception class which wraps message and class name of any 
runtime exception, e.g.

... catch (RuntimeException r)
{
   throw new GenericRuntimeExceptionWrapper(r);
}

whereas GenericRuntimeExceptionWrapper is a checked exception and must 
extend XFireException. In this way the runtime exception's message and 
class name are transported to the client, and Java XFire clients can 
recreate and throw the runtime exception. Non Java clients see at least 
the runtime exception's message and class name.

I was able to hide all of this in autogenerated code (a layer on top of 
XFire), runtime exception handling is completely transparent on the 
server and the client.

Werner

On 28.09.2007 20:00, Hogan, Gavin wrote:
> I think this is a problem with runtime exceptions are not caught by
the
> handlers, exceptions such as NullPointer and NumberFormat.  I too am
> looking for a way to catch, and handle these exceptions.  Any ideas
> would be welcome.
> 
> Gavin


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email


---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply via email to