You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2010/09/22 03:11:50 UTC

svn commit: r999709 - /subversion/branches/object-model/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp

Author: hwright
Date: Wed Sep 22 01:11:50 2010
New Revision: 999709

URL: http://svn.apache.org/viewvc?rev=999709&view=rev
Log:
On the object-model branch:
Introduce a useful macro within JavaHL.

* subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
  (JNI_CPP_ERR): New.
  (Java_org_apache_subversion_javahl_SVNClient_streamFileContents): Use.

Modified:
    subversion/branches/object-model/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp

Modified: subversion/branches/object-model/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/object-model/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=999709&r1=999708&r2=999709&view=diff
==============================================================================
--- subversion/branches/object-model/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp (original)
+++ subversion/branches/object-model/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp Wed Sep 22 01:11:50 2010
@@ -59,6 +59,18 @@
 #include "Revision.h"
 #include "Common.h"
 
+#define JNI_CPP_ERR(expr)                                               \
+  do {                                                                  \
+    try {                                                               \
+      (expr);                                                           \
+    } catch (SVN::Exception ex) {                                       \
+      JNIUtil::throwNativeException(JAVA_PACKAGE"/ClientException",     \
+                                    ex.what(), ex.getSource().c_str(),  \
+                                    ex.getAPRErr());                    \
+      return;                                                           \
+    }                                                                   \
+  } while (0)
+
 JNIEXPORT jlong JNICALL
 Java_org_apache_subversion_javahl_SVNClient_ctNative
 (JNIEnv *env, jobject jthis)
@@ -1354,17 +1366,8 @@ Java_org_apache_subversion_javahl_SVNCli
   if (JNIUtil::isExceptionThrown())
     return;
 
-  try
-    {
-      cl->getClient().cat(dataOut.to_ostream(), path.str(), revision,
-                          pegRevision);
-    }
-  catch (SVN::Exception ex)
-    {
-      JNIUtil::throwNativeException(JAVA_PACKAGE"/ClientException",
-                                    ex.what(), ex.getSource().c_str(),
-                                    ex.getAPRErr());
-    }
+  JNI_CPP_ERR(cl->getClient().cat(dataOut.to_ostream(), path.str(), revision,
+              pegRevision));
 }
 
 JNIEXPORT jstring JNICALL