1 | /** |
---|
2 | * @copyright |
---|
3 | * ==================================================================== |
---|
4 | * Copyright (c) 2003-2007 CollabNet. All rights reserved. |
---|
5 | * |
---|
6 | * This software is licensed as described in the file COPYING, which |
---|
7 | * you should have received as part of this distribution. The terms |
---|
8 | * are also available at http://subversion.tigris.org/license-1.html. |
---|
9 | * If newer versions of this license are posted there, you may use a |
---|
10 | * newer version instead, at your option. |
---|
11 | * |
---|
12 | * This software consists of voluntary contributions made by many |
---|
13 | * individuals. For exact contribution history, see the revision |
---|
14 | * history and logs, available at http://subversion.tigris.org/. |
---|
15 | * ==================================================================== |
---|
16 | * @endcopyright |
---|
17 | */ |
---|
18 | |
---|
19 | package org.tigris.subversion.javahl; |
---|
20 | |
---|
21 | /** |
---|
22 | * This exception is thrown whenever something goes wrong in the |
---|
23 | * Subversion JavaHL binding's JNI interface. |
---|
24 | */ |
---|
25 | public class ClientException extends NativeException |
---|
26 | { |
---|
27 | // Update the serialVersionUID when there is a incompatible change |
---|
28 | // made to this class. See any of the following, depending upon |
---|
29 | // the Java release. |
---|
30 | // http://java.sun.com/j2se/1.3/docs/guide/serialization/spec/version.doc7.html |
---|
31 | // http://java.sun.com/j2se/1.4/pdf/serial-spec.pdf |
---|
32 | // http://java.sun.com/j2se/1.5.0/docs/guide/serialization/spec/version.html#6678 |
---|
33 | // http://java.sun.com/javase/6/docs/platform/serialization/spec/version.html#6678 |
---|
34 | private static final long serialVersionUID = 1L; |
---|
35 | |
---|
36 | /** |
---|
37 | * This constructor is only used by the native library. |
---|
38 | * |
---|
39 | * @param message A description of the problem. |
---|
40 | * @param source The error's source. |
---|
41 | * @param aprError Any associated APR error code for a wrapped |
---|
42 | * <code>svn_error_t</code>. |
---|
43 | */ |
---|
44 | ClientException(String message, String source, int aprError) |
---|
45 | { |
---|
46 | super(message, source, aprError); |
---|
47 | } |
---|
48 | |
---|
49 | /** |
---|
50 | * A conversion routine for maintaining backwards compatibility. |
---|
51 | * @param t The exception to (potentially) convert. |
---|
52 | * @return <code>t</code> coerced or converted into a |
---|
53 | * <code>ClientException</code>. |
---|
54 | */ |
---|
55 | static ClientException fromException(Throwable t) |
---|
56 | { |
---|
57 | if (t instanceof ClientException) |
---|
58 | { |
---|
59 | return (ClientException) t; |
---|
60 | } |
---|
61 | else |
---|
62 | { |
---|
63 | return new ClientException(t.getMessage(), null, -1); |
---|
64 | } |
---|
65 | } |
---|
66 | } |
---|