Daniel Rall wrote:
> Will singleStatus() ever throw ArrayIndexOutOfBoundsException? If so,
> it might be more backwards compatible to wrap a try/catch block around
> the Java one-liner to re-throw the exception as ClientException.
I think the idea is valid, but I have a concern about the
implementation. ClientException is basically just a wrapper around
nativeException, with this constructor:
/**
* This constructor is only used by the native library.
*
* @param message A description of the problem.
* @param source The error's source.
* @param aprError Any associated APR error code for a wrapped
* <code>svn_error_t</code>.
*/
ClientException(String message, String source, int aprError)
{
super(message, source, aprError);
}
Should we allow ClientException to also be used for things outside of
the native library?
-Hyrum
> On Tue, 20 Mar 2007, hwright@tigris.org wrote:
> ...
>> JavaHL: Remove the C++ implementation of singleStatus(), in favor of a one-line
>> Java implementation.
>>
>> [ in subversion/bindings/java/javahl ]
>> * src/org/tigris/subversion/javahl/SVNClient.java
>> (singleStatus): Reimplement as a thin wrapper around the status() method. The
>> defaults used are taken from the SVNClient::singleStatus() function, which
>> is being removed.
>>
>> * native/SVNClient.h,
>> native/SVNClient.cpp
>> (singleStatus): Remove.
>>
>> * native/org_tigris_subversion_javahl_SVNClient.cpp
>> (Java_org_tigris_subversion_javahl_SVNClient_singleStatus): Remove.
> ...
>> --- trunk/subversion/bindings/java/javahl/native/SVNClient.cpp (original)
>> +++ trunk/subversion/bindings/java/javahl/native/SVNClient.cpp Tue Mar 20 07:57:28 2007
>> @@ -311,76 +311,6 @@
>> }
>> }
>>
>> -jobject SVNClient::singleStatus(const char *path, bool onServer)
>> -{
>> - status_baton statusBaton;
>> - Pool requestPool;
>> - svn_revnum_t youngest = SVN_INVALID_REVNUM;
>> - svn_opt_revision_t rev;
>> -
>> - if (path == NULL)
>> - {
>> - JNIUtil::throwNullPointerException("path");
>> - return NULL;
>> - }
>> -
>> - svn_client_ctx_t *ctx = getContext(NULL);
>> - if (ctx == NULL)
>> - {
>> - return NULL;
>> - }
>> -
>> -
>> - rev.kind = svn_opt_revision_unspecified;
>> - statusBaton.pool = requestPool.pool();
>> - Path intPath(path);
>> - svn_error_t *Err = intPath.error_occured();
>> - if (Err != NULL)
>> - {
>> - JNIUtil::handleSVNError(Err);
>> - return NULL;
>> - }
>> -
>> - Err = svn_client_status2(&youngest, intPath.c_str(), &rev,
>> - statusReceiver, &statusBaton,
>> - FALSE, // DESCEND
>> - TRUE, // get_All
>> - onServer ? TRUE : FALSE, //update
>> - FALSE, //no_ignore,
>> - FALSE, // ignore externals
>> - ctx,
>> - requestPool.pool());
>> - if (Err == NULL)
>> - {
>> - int size = statusBaton.statusVect.size();
>> - if (size == 0)
>> - return NULL;
>> -
>> - // when svn_client_status is used with a directory, the status of the
>> - // directory itself and the status of all its direct children are
>> - // returned
>> - // we just want the status of the directory (ie the status of the
>> - // element with the shortest path)
>> - int j = 0;
>> - for (int i = 0; i < size; i++)
>> - {
>> - if (strlen(statusBaton.statusVect[i].path) <
>> - strlen(statusBaton.statusVect[j].path))
>> - j = i;
>> - }
>> -
>> - jobject jStatus = createJavaStatus(statusBaton.statusVect[j].path,
>> - statusBaton.statusVect[j].status);
>> -
>> - return jStatus;
>> - }
>> - else
>> - {
>> - JNIUtil::handleSVNError(Err);
>> - return NULL;
>> - }
>> -}
> ...
>> --- trunk/subversion/bindings/java/javahl/src/org/tigris/subversion/javahl/SVNClient.java (original)
>> +++ trunk/subversion/bindings/java/javahl/src/org/tigris/subversion/javahl/SVNClient.java Tue Mar 20 07:57:28 2007
>> @@ -270,8 +270,11 @@
>> * @param onServer Request status information from the server.
>> * @return the subversion status of the file.
>> */
>> - public native Status singleStatus(String path, boolean onServer)
>> - throws ClientException;
>> + public Status singleStatus(String path, boolean onServer)
>> + throws ClientException
>> + {
>> + return status(path, false, onServer, true, false, false)[0];
>> + }
> ...
Received on Wed Mar 21 18:49:40 2007