On Mon, 01 Oct 2007, Blair Zajac wrote:
> 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.
Yeah, I thought of that.  I didn't want to rely on the corresponding
constructor being defined -- as you mention below, it requires a
minimum JRE version (which is why I didn't go there).
> What is the oldest version of Java we support?
subversion/bindings/javahl/README says 1.3.
> 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.
Me too, though, I care a lot less for deprecated methods.
> Also, were do you see us using this static method?
See r26873, committed immediately after r26872.
- application/pgp-signature attachment: stored
 
 
Received on Mon Oct  1 20:24:13 2007