[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r26872 - trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl

From: Blair Zajac <blair_at_orcaware.com>
Date: 2007-10-01 20:15:10 CEST

dlr@tigris.org wrote:
> Author: dlr
> Date: Mon Oct 1 11:01:43 2007
> New Revision: 26872
>
> Log:
> JavaHL: Add new data type conversion routine for maintaining backwards
> compat while moving to newer APIs.
>
> [ in subversion/bindings/javahl/ ]
>
> * src/org/tigris/subversion/javahl/ClientException.java
> (fromException): Add new static method which coerces or converts a
> generic Throwable into a ClientException.
>
>
> Modified:
> trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ClientException.java
>
> Modified: trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ClientException.java
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ClientException.java?pathrev=26872&r1=26871&r2=26872
> ==============================================================================
> --- trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ClientException.java (original)
> +++ trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/ClientException.java Mon Oct 1 11:01:43 2007
> @@ -45,4 +45,21 @@
> {
> super(message, source, aprError);
> }
> +
> + /**
> + * A conversion routine for maintaining backwards compatibility.
> + * @return <code>e</code> coerced or converted into a
> + * <code>ClientException</code>.
> + */
> + static ClientException fromException(Throwable t)
> + {
> + if (t instanceof ClientException)
> + {
> + return (ClientException) t;
> + }
> + else
> + {
> + return new ClientException(t.getMessage(), null, -1);
> + }
> + }

If would be great if we could support exception chaining here instead of just
passing the Throwable's message.

What is the oldest version of Java we support? If we require 1.4, then we could
change that to:

     else
     {
         ClientException e = new ClientException(t.getMessage(), null, -1);
         e.initCause(t);
         return e;
     }

I hate to see exception information lost like this, which would loose the stack
trace of the original exception.

Also, were do you see us using this static method?

Regards,
Blair

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Mon Oct 1 20:15:45 2007

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.