subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From svn-r...@apache.org
Subject svn commit: r1688548 - in /subversion/branches/1.9.x: ./ subversion/bindings/javahl/native/ subversion/bindings/javahl/src/org/apache/subversion/javahl/ subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ subversion/bindings/javahl/te...
Date Wed, 01 Jul 2015 04:00:31 GMT
Author: svn-role
Date: Wed Jul  1 04:00:31 2015
New Revision: 1688548

URL: http://svn.apache.org/r1688548
Log:
Merge the r1688273 group from trunk:

 * r1688273, r1688395
   Implement the new semantics of the changed svn_repos_verify_fs3 in JavaHL.
   Justification:
     This is a follow-up to the changed in the r1684940 group which is
     already approved for backport, and a bindings API change that
     can't be backported after 1.9.0.
   Depends:
     Depends on the r1684940, r1685034, r1687769, r1687776 backport.
   Notes:
     r1688273 implements the API semantics; r1688395 contains
     minor spelling and documentation fixes.
     .
     Clean merge depends on merging the r1684940 group first.
   Votes:
     +1: brane, rhuijben

Added:
    subversion/branches/1.9.x/subversion/bindings/javahl/native/ReposVerifyCallback.cpp
      - copied, changed from r1688273, subversion/trunk/subversion/bindings/javahl/native/ReposVerifyCallback.cpp
    subversion/branches/1.9.x/subversion/bindings/javahl/native/ReposVerifyCallback.h
      - copied, changed from r1688273, subversion/trunk/subversion/bindings/javahl/native/ReposVerifyCallback.h
    subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposVerifyCallback.java
      - copied, changed from r1688273, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposVerifyCallback.java
Modified:
    subversion/branches/1.9.x/   (props changed)
    subversion/branches/1.9.x/STATUS
    subversion/branches/1.9.x/subversion/bindings/javahl/native/JNIUtil.cpp
    subversion/branches/1.9.x/subversion/bindings/javahl/native/JNIUtil.h
    subversion/branches/1.9.x/subversion/bindings/javahl/native/SVNRepos.cpp
    subversion/branches/1.9.x/subversion/bindings/javahl/native/SVNRepos.h
    subversion/branches/1.9.x/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp
    subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRepos.java
    subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java
    subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNRepos.java
    subversion/branches/1.9.x/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNReposTests.java

Propchange: subversion/branches/1.9.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul  1 04:00:31 2015
@@ -93,4 +93,4 @@
 /subversion/branches/verify-at-commit:1462039-1462408
 /subversion/branches/verify-keep-going:1439280-1546110
 /subversion/branches/wc-collate-path:1402685-1480384
-/subversion/trunk:1660545-1660547,1660549-1662901,1663003,1663183-1663184,1663338,1663347,1663355,1663374,1663450,1663530,1663671,1663697,1663706,1663738,1663749,1663791,1663991,1664035,1664078,1664080,1664084-1664085,1664187,1664191,1664193,1664200,1664344,1664476,1664480-1664481,1664483,1664489-1664490,1664507,1664520-1664521,1664523,1664526-1664527,1664531-1664532,1664588,1664593-1664594,1664596,1664653,1664664,1664672,1664674,1664684,1664927,1664938-1664940,1664978,1664984,1664997,1665164,1665195,1665213,1665259,1665318,1665437-1665438,1665609,1665611-1665612,1665845,1665850,1665852,1665886,1665894,1665896,1666096,1666258,1666270,1666272,1666379,1666449,1666690,1666832,1666851,1666965,1667101,1667106-1667107,1667120,1667228,1667233-1667235,1667249-1667250,1667258,1667290,1667301,1667471,1667691-1667693,1667699-1667700,1667715,1667941,1667976,1668320,1668598-1668600,1668602-1668603,1668607-1668608,1668618,1669743,1669746,1669749,1669945,1670139,1670149,1670152,1670329,1670337,167
 0347,1670353,1671164,1671388,1672295,1672311,1672372,1672404,1672511-1672512,1672578,1672728,1673044,1673062-1673063,1673065,1673153,1673170,1673172,1673197,1673202,1673204,1673228,1673282,1673445,1673691-1673692,1673746,1673785,1673803,1674015,1674032,1674170,1674301,1674305,1674308,1674339-1674340,1674406,1674415,1674455-1674456,1674475,1674487,1674522,1674580,1674627,1674891,1675771,1675774,1676526,1676535,1676538,1676555,1676564,1676570,1676665,1676667,1676769,1677003,1677191,1677267,1677440,1678147,1678149,1678494,1678571,1678734,1678742,1678745-1678746,1678839,1678846,1678894,1678950,1678963,1679166,1679169,1679228,1679230,1679287,1679864,1679866,1679909,1680242,1680264,1680495,1680705,1680819,1681317,1682714,1682854,1683071,1683126,1683135,1683290,1683303,1683311,1683378,1683387,1684034,1684077,1684322,1684325,1684344,1684412,1684940,1685034,1685085,1686239,1686478,1686541,1686543,1686554,1686557,1686802,1686888,1686984,1687769,1687776
+/subversion/trunk:1660545-1660547,1660549-1662901,1663003,1663183-1663184,1663338,1663347,1663355,1663374,1663450,1663530,1663671,1663697,1663706,1663738,1663749,1663791,1663991,1664035,1664078,1664080,1664084-1664085,1664187,1664191,1664193,1664200,1664344,1664476,1664480-1664481,1664483,1664489-1664490,1664507,1664520-1664521,1664523,1664526-1664527,1664531-1664532,1664588,1664593-1664594,1664596,1664653,1664664,1664672,1664674,1664684,1664927,1664938-1664940,1664978,1664984,1664997,1665164,1665195,1665213,1665259,1665318,1665437-1665438,1665609,1665611-1665612,1665845,1665850,1665852,1665886,1665894,1665896,1666096,1666258,1666270,1666272,1666379,1666449,1666690,1666832,1666851,1666965,1667101,1667106-1667107,1667120,1667228,1667233-1667235,1667249-1667250,1667258,1667290,1667301,1667471,1667691-1667693,1667699-1667700,1667715,1667941,1667976,1668320,1668598-1668600,1668602-1668603,1668607-1668608,1668618,1669743,1669746,1669749,1669945,1670139,1670149,1670152,1670329,1670337,167
 0347,1670353,1671164,1671388,1672295,1672311,1672372,1672404,1672511-1672512,1672578,1672728,1673044,1673062-1673063,1673065,1673153,1673170,1673172,1673197,1673202,1673204,1673228,1673282,1673445,1673691-1673692,1673746,1673785,1673803,1674015,1674032,1674170,1674301,1674305,1674308,1674339-1674340,1674406,1674415,1674455-1674456,1674475,1674487,1674522,1674580,1674627,1674891,1675771,1675774,1676526,1676535,1676538,1676555,1676564,1676570,1676665,1676667,1676769,1677003,1677191,1677267,1677440,1678147,1678149,1678494,1678571,1678734,1678742,1678745-1678746,1678839,1678846,1678894,1678950,1678963,1679166,1679169,1679228,1679230,1679287,1679864,1679866,1679909,1680242,1680264,1680495,1680705,1680819,1681317,1682714,1682854,1683071,1683126,1683135,1683290,1683303,1683311,1683378,1683387,1684034,1684077,1684322,1684325,1684344,1684412,1684940,1685034,1685085,1686239,1686478,1686541,1686543,1686554,1686557,1686802,1686888,1686984,1687769,1687776,1688273,1688395

Modified: subversion/branches/1.9.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/STATUS?rev=1688548&r1=1688547&r2=1688548&view=diff
==============================================================================
--- subversion/branches/1.9.x/STATUS (original)
+++ subversion/branches/1.9.x/STATUS Wed Jul  1 04:00:31 2015
@@ -46,19 +46,3 @@ Veto-blocked changes:
 
 Approved changes:
 =================
-
- * r1688273, r1688395
-   Implement the new semantics of the changed svn_repos_verify_fs3 in JavaHL.
-   Justification:
-     This is a follow-up to the changed in the r1684940 group which is
-     already approved for backport, and a bindings API change that
-     can't be backported after 1.9.0.
-   Depends:
-     Depends on the r1684940, r1685034, r1687769, r1687776 backport.
-   Notes:
-     r1688273 implements the API semantics; r1688395 contains
-     minor spelling and documentation fixes.
-     .
-     Clean merge depends on merging the r1684940 group first.
-   Votes:
-     +1: brane, rhuijben

Modified: subversion/branches/1.9.x/subversion/bindings/javahl/native/JNIUtil.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/bindings/javahl/native/JNIUtil.cpp?rev=1688548&r1=1688547&r2=1688548&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/bindings/javahl/native/JNIUtil.cpp (original)
+++ subversion/branches/1.9.x/subversion/bindings/javahl/native/JNIUtil.cpp Wed Jul  1 04:00:31
2015
@@ -570,13 +570,13 @@ std::string JNIUtil::makeSVNErrorMessage
   return buffer;
 }
 
-void JNIUtil::wrappedHandleSVNError(svn_error_t *err, jthrowable jcause)
+jthrowable JNIUtil::wrappedCreateClientException(svn_error_t *err, jthrowable jcause)
 {
   jstring jmessage;
   jobject jstack;
   std::string msg = makeSVNErrorMessage(err, &jmessage, &jstack);
   if (JNIUtil::isJavaExceptionThrown())
-    return;
+    return NULL;
 
   const char *source = NULL;
 #ifdef SVN_DEBUG
@@ -604,11 +604,11 @@ void JNIUtil::wrappedHandleSVNError(svn_
   // Create a local frame for our references
   env->PushLocalFrame(LOCAL_FRAME_SIZE);
   if (JNIUtil::isJavaExceptionThrown())
-    return;
+    return NULL;
 
   jclass clazz = env->FindClass(JAVAHL_CLASS("/ClientException"));
   if (isJavaExceptionThrown())
-    POP_AND_RETURN_NOTHING();
+    POP_AND_RETURN_NULL;
 
   if (getLogLevel() >= exceptionLog)
     {
@@ -622,11 +622,11 @@ void JNIUtil::wrappedHandleSVNError(svn_
       g_logStream << std::endl;
     }
   if (isJavaExceptionThrown())
-    POP_AND_RETURN_NOTHING();
+    POP_AND_RETURN_NULL;
 
   jstring jsource = makeJString(source);
   if (isJavaExceptionThrown())
-    POP_AND_RETURN_NOTHING();
+    POP_AND_RETURN_NULL;
 
   jmethodID mid = env->GetMethodID(clazz, "<init>",
                                    "(Ljava/lang/String;"
@@ -634,12 +634,12 @@ void JNIUtil::wrappedHandleSVNError(svn_
                                    "Ljava/lang/String;I"
                                    "Ljava/util/List;)V");
   if (isJavaExceptionThrown())
-    POP_AND_RETURN_NOTHING();
+    POP_AND_RETURN_NULL;
   jobject nativeException = env->NewObject(clazz, mid, jmessage, jcause,
                                            jsource, jint(err->apr_err),
                                            jstack);
   if (isJavaExceptionThrown())
-    POP_AND_RETURN_NOTHING();
+    POP_AND_RETURN_NULL;
 
 #ifdef SVN_ERR__TRACING
   // Add all the C error stack trace information to the Java Exception
@@ -651,7 +651,7 @@ void JNIUtil::wrappedHandleSVNError(svn_
       mid_gst = env->GetMethodID(clazz, "getStackTrace",
                                  "()[Ljava/lang/StackTraceElement;");
       if (isJavaExceptionThrown())
-        POP_AND_RETURN_NOTHING();
+        POP_AND_RETURN_NULL;
     }
   Array stackTraceArray((jobjectArray) env->CallObjectMethod(nativeException,
                                                              mid_gst));
@@ -670,18 +670,18 @@ void JNIUtil::wrappedHandleSVNError(svn_
 
   jclass stClazz = env->FindClass("java/lang/StackTraceElement");
   if (isJavaExceptionThrown())
-    POP_AND_RETURN_NOTHING();
+    POP_AND_RETURN_NULL;
 
   const jsize stSize = static_cast<jsize>(newStackTrace.size());
   if (stSize < 0 || stSize != newStackTrace.size())
     {
       env->ThrowNew(env->FindClass("java.lang.ArithmeticException"),
                     "Overflow converting C size_t to JNI jsize");
-      POP_AND_RETURN_NOTHING();
+      POP_AND_RETURN_NULL;
     }
   jobjectArray jStackTrace = env->NewObjectArray(stSize, stClazz, NULL);
   if (isJavaExceptionThrown())
-    POP_AND_RETURN_NOTHING();
+    POP_AND_RETURN_NULL;
 
   int i = 0;
   for (std::vector<jobject>::const_iterator it = newStackTrace.begin();
@@ -698,25 +698,34 @@ void JNIUtil::wrappedHandleSVNError(svn_
       mid_sst = env->GetMethodID(clazz, "setStackTrace",
                                  "([Ljava/lang/StackTraceElement;)V");
       if (isJavaExceptionThrown())
-        POP_AND_RETURN_NOTHING();
+        POP_AND_RETURN_NULL;
     }
   env->CallVoidMethod(nativeException, mid_sst, jStackTrace);
   if (isJavaExceptionThrown())
-    POP_AND_RETURN_NOTHING();
+    POP_AND_RETURN_NULL;
 #endif
 
-  env->Throw(static_cast<jthrowable>(env->PopLocalFrame(nativeException)));
+  return static_cast<jthrowable>(env->PopLocalFrame(nativeException));
 }
 
-void JNIUtil::handleSVNError(svn_error_t *err, jthrowable jcause)
+jthrowable JNIUtil::createClientException(svn_error_t *err, jthrowable jcause)
 {
+  jthrowable jexc = NULL;
   try {
-    wrappedHandleSVNError(err, jcause);
+    jexc = wrappedCreateClientException(err, jcause);
   } catch (...) {
     svn_error_clear(err);
     throw;
   }
   svn_error_clear(err);
+  return jexc;
+}
+
+void JNIUtil::handleSVNError(svn_error_t *err, jthrowable jcause)
+{
+  jthrowable jexc = createClientException(err, jcause);
+  if (jexc)
+    getEnv()->Throw(jexc);
 }
 
 void JNIUtil::putFinalizedClient(SVNBase *object)

Modified: subversion/branches/1.9.x/subversion/bindings/javahl/native/JNIUtil.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/bindings/javahl/native/JNIUtil.h?rev=1688548&r1=1688547&r2=1688548&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/bindings/javahl/native/JNIUtil.h (original)
+++ subversion/branches/1.9.x/subversion/bindings/javahl/native/JNIUtil.h Wed Jul  1 04:00:31
2015
@@ -136,6 +136,13 @@ class JNIUtil
   static svn_error_t* checkJavaException(apr_status_t errorcode);
 
   /**
+   * Create a Java exception corresponding to err, and run
+   * svn_error_clear() on err.
+   */
+  static jthrowable createClientException(svn_error_t *err,
+                                          jthrowable jcause = NULL);
+
+  /**
    * Throw a Java exception corresponding to err, and run
    * svn_error_clear() on err.
    */
@@ -178,7 +185,8 @@ class JNIUtil
   friend bool initialize_jni_util(JNIEnv *env);
   static bool JNIGlobalInit(JNIEnv *env);
 
-  static void wrappedHandleSVNError(svn_error_t *err, jthrowable jcause);
+  static jthrowable wrappedCreateClientException(svn_error_t *err,
+                                                 jthrowable jcause);
   static void putErrorsInTrace(svn_error_t *err,
                                std::vector<jobject> &stackTrace);
 

Copied: subversion/branches/1.9.x/subversion/bindings/javahl/native/ReposVerifyCallback.cpp
(from r1688273, subversion/trunk/subversion/bindings/javahl/native/ReposVerifyCallback.cpp)
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/bindings/javahl/native/ReposVerifyCallback.cpp?p2=subversion/branches/1.9.x/subversion/bindings/javahl/native/ReposVerifyCallback.cpp&p1=subversion/trunk/subversion/bindings/javahl/native/ReposVerifyCallback.cpp&r1=1688273&r2=1688548&rev=1688548&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/ReposVerifyCallback.cpp (original)
+++ subversion/branches/1.9.x/subversion/bindings/javahl/native/ReposVerifyCallback.cpp Wed
Jul  1 04:00:31 2015
@@ -27,12 +27,8 @@
 #include "ReposVerifyCallback.h"
 #include "JNIUtil.h"
 
-/**
- * Create a new object and store the Java object.
- * @param notify    global reference to the Java object
- */
-ReposVerifyCallback::ReposVerifyCallback(jobject verify_cb)
-  : m_verify_cb(verify_cb)
+ReposVerifyCallback::ReposVerifyCallback(jobject jverify_cb)
+  : m_jverify_cb(jverify_cb)
 {}
 
 ReposVerifyCallback::~ReposVerifyCallback()
@@ -86,7 +82,7 @@ ReposVerifyCallback::onVerifyError(svn_r
   if (JNIUtil::isJavaExceptionThrown())
     return;
 
-  env->CallVoidMethod(m_verify_cb, mid, jlong(revision), jverify_err);
+  env->CallVoidMethod(m_jverify_cb, mid, jlong(revision), jverify_err);
   if (verify_err)
     env->DeleteLocalRef(jverify_err);
 }

Copied: subversion/branches/1.9.x/subversion/bindings/javahl/native/ReposVerifyCallback.h
(from r1688273, subversion/trunk/subversion/bindings/javahl/native/ReposVerifyCallback.h)
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/bindings/javahl/native/ReposVerifyCallback.h?p2=subversion/branches/1.9.x/subversion/bindings/javahl/native/ReposVerifyCallback.h&p1=subversion/trunk/subversion/bindings/javahl/native/ReposVerifyCallback.h&r1=1688273&r2=1688548&rev=1688548&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/ReposVerifyCallback.h (original)
+++ subversion/branches/1.9.x/subversion/bindings/javahl/native/ReposVerifyCallback.h Wed
Jul  1 04:00:31 2015
@@ -40,18 +40,24 @@ class ReposVerifyCallback
   /**
    * The local reference to the Java object.
    */
-  jobject m_verify_cb;
+  jobject m_jverify_cb;
 
  public:
-  ReposVerifyCallback(jobject verify_cb);
+  /**
+   * Create a new object and store the Java object.
+   * @param verify_cb  global reference to the Java object
+   */
+  ReposVerifyCallback(jobject jverify_cb);
+
   ~ReposVerifyCallback();
 
   /**
    * Implementation of the svn_repos_verify_callback_t API.
    *
-   * @param baton notification instance is passed using this parameter
-   * @param notify all the information about the event
-   * @param pool An APR pool from which to allocate memory.
+   * @param baton Notification instance is passed using this parameter
+   * @param revision The revision that the error was emitted for
+   * @param verify_err The emitted error
+   * @param scratch_pool An APR pool from which to allocate memory.
    */
   static svn_error_t * callback(void *baton,
                                 svn_revnum_t revision,

Modified: subversion/branches/1.9.x/subversion/bindings/javahl/native/SVNRepos.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/bindings/javahl/native/SVNRepos.cpp?rev=1688548&r1=1688547&r2=1688548&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/bindings/javahl/native/SVNRepos.cpp (original)
+++ subversion/branches/1.9.x/subversion/bindings/javahl/native/SVNRepos.cpp Wed Jul  1 04:00:31
2015
@@ -26,7 +26,6 @@
 
 #include "SVNRepos.h"
 #include "CreateJ.h"
-#include "ReposNotifyCallback.h"
 #include "JNIUtil.h"
 #include "svn_error_codes.h"
 #include "svn_repos.h"
@@ -595,7 +594,8 @@ SVNRepos::getRevnum(svn_revnum_t *revnum
 void
 SVNRepos::verify(File &path, Revision &revisionStart, Revision &revisionEnd,
                  bool checkNormalization, bool metadataOnly,
-                 ReposNotifyCallback *notifyCallback)
+                 ReposNotifyCallback *notifyCallback,
+                 ReposVerifyCallback *verifyCallback)
 {
   SVN::Pool requestPool;
   svn_repos_t *repos;
@@ -641,11 +641,12 @@ SVNRepos::verify(File &path, Revision &r
   SVN_JNI_ERR(svn_repos_verify_fs3(repos, lower, upper,
                                    checkNormalization,
                                    metadataOnly,
-                                   notifyCallback != NULL
-                                    ? ReposNotifyCallback::notify
-                                    : NULL,
+                                   (!notifyCallback ? NULL
+                                    : ReposNotifyCallback::notify),
                                    notifyCallback,
-                                   NULL, NULL, /* verify callback/baton */
+                                   (!verifyCallback ? NULL
+                                    : ReposVerifyCallback::callback),
+                                   verifyCallback,
                                    checkCancel, this /* cancel callback/baton */,
                                    requestPool.getPool()), );
 }

Modified: subversion/branches/1.9.x/subversion/bindings/javahl/native/SVNRepos.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/bindings/javahl/native/SVNRepos.h?rev=1688548&r1=1688547&r2=1688548&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/bindings/javahl/native/SVNRepos.h (original)
+++ subversion/branches/1.9.x/subversion/bindings/javahl/native/SVNRepos.h Wed Jul  1 04:00:31
2015
@@ -35,6 +35,7 @@
 #include "InputStream.h"
 #include "MessageReceiver.h"
 #include "ReposNotifyCallback.h"
+#include "ReposVerifyCallback.h"
 #include "ReposFreezeAction.h"
 #include "StringArray.h"
 #include "File.h"
@@ -46,7 +47,8 @@ class SVNRepos : public SVNBase
   jobject lslocks(File &path, svn_depth_t depth);
   void verify(File &path, Revision &revisionStart, Revision &revisionEnd,
               bool checkNormalization, bool metadataOnly,
-              ReposNotifyCallback *notifyCallback);
+              ReposNotifyCallback *notifyCallback,
+              ReposVerifyCallback *verifyCallback);
   void setRevProp(File &path, Revision &revision,
                   const char *propName, const char *propValue,
                   bool usePreRevPropChangeHook,

Modified: subversion/branches/1.9.x/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp?rev=1688548&r1=1688547&r2=1688548&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp
(original)
+++ subversion/branches/1.9.x/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNRepos.cpp
Wed Jul  1 04:00:31 2015
@@ -420,7 +420,7 @@ Java_org_apache_subversion_javahl_SVNRep
     JNIEnv *env, jobject jthis, jobject jpath,
     jobject jrevisionStart, jobject jrevisionEnd,
     jboolean jcheckNormalization, jboolean jmetadataOnly,
-    jobject jcallback)
+    jobject jnotifyCallback, jobject jverifyCallback)
 {
   JNIEntry(SVNRepos, verify);
   SVNRepos *cl = SVNRepos::getCppObject(jthis);
@@ -442,13 +442,18 @@ Java_org_apache_subversion_javahl_SVNRep
   if (JNIUtil::isExceptionThrown())
     return;
 
-  ReposNotifyCallback callback(jcallback);
+  ReposNotifyCallback notify_cb(jnotifyCallback);
+  if (JNIUtil::isExceptionThrown())
+    return;
+
+  ReposVerifyCallback verify_cb(jverifyCallback);
   if (JNIUtil::isExceptionThrown())
     return;
 
   cl->verify(path, revisionStart, revisionEnd,
              jcheckNormalization, jmetadataOnly,
-             jcallback != NULL ? &callback : NULL);
+             jnotifyCallback != NULL ? &notify_cb : NULL,
+             jverifyCallback != NULL ? &verify_cb : NULL);
 }
 
 JNIEXPORT jobject JNICALL

Modified: subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRepos.java
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRepos.java?rev=1688548&r1=1688547&r2=1688548&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRepos.java
(original)
+++ subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/ISVNRepos.java
Wed Jul  1 04:00:31 2015
@@ -29,6 +29,7 @@ import java.io.InputStream;
 import java.io.File;
 
 import org.apache.subversion.javahl.callback.ReposNotifyCallback;
+import org.apache.subversion.javahl.callback.ReposVerifyCallback;
 import org.apache.subversion.javahl.callback.ReposFreezeAction;
 import org.apache.subversion.javahl.types.*;
 
@@ -295,30 +296,44 @@ public interface ISVNRepos {
     /**
      * Verify the repository at <code>path</code> between revisions
      * <code>start</code> and <code>end</code>.
+     *<p>
+     * If <code>verifyCallback</code> is <code>null</code>, verification
+     * will stop at the first encountered error. Otherwise, the verification
+     * process may continue, depending on the value returned from the
+     * invocation of <code>verifyCallback</code>.
      *
      * @param path              the path to the repository
      * @param start             the first revision
      * @param end               the last revision
-         * @param checkNormalization report directory entry and mergeinfo name collisions
-         *                           caused by denormalized Unicode representations
-         * @param metadataOnly      check only metadata, not file contents
-         * @param callback          the callback to receive notifications
+     * @param checkNormalization report directory entry and mergeinfo name collisions
+     *                           caused by denormalized Unicode representations
+     * @param metadataOnly      check only metadata, not file contents
+     * @param notifyCallback    the callback to receive notifications
+     * @param verifyCallback    the callback to receive verification status
      * @throws ClientException If an error occurred.
-         * @since 1.9
+     * @since 1.9
      */
     public abstract void verify(File path, Revision start, Revision end,
-                boolean checkNormalization, boolean metadataOnly,
-                ReposNotifyCallback callback)
+                boolean checkNormalization,
+                boolean metadataOnly,
+                ReposNotifyCallback notifyCallback,
+                ReposVerifyCallback verifyCallback)
             throws ClientException;
 
     /**
      * Verify the repository at <code>path</code> between revisions
      * <code>start</code> and <code>end</code>.
+     *<p>
+     *<b>Note:</b> Behaves like the 1.9 version with
+     *             <code>checkNormailzation</code> and
+     *             <code>metadataOnly</code> set to <code>false</code>
+     *             and <code>verifyCallback</code> set to
+     *             <code>null</code>.
      *
      * @param path              the path to the repository
      * @param start             the first revision
      * @param end               the last revision
-         * @param callback          the callback to receive notifications
+     * @param callback          the callback to receive notifications
      * @throws ClientException If an error occurred.
      */
     public abstract void verify(File path, Revision start, Revision end,

Modified: subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java?rev=1688548&r1=1688547&r2=1688548&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java
(original)
+++ subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/ReposNotifyInformation.java
Wed Jul  1 04:00:31 2015
@@ -35,7 +35,7 @@ public class ReposNotifyInformation exte
     // Update the serialVersionUID when there is a incompatible change made to
     // this class.  See the java documentation for when a change is incompatible.
     // http://java.sun.com/javase/7/docs/platform/serialization/spec/version.html#6678
-    private static final long serialVersionUID = 1L;
+    private static final long serialVersionUID = 2L;
 
     /**
      * The {@link Action} which triggered this event.

Modified: subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNRepos.java
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNRepos.java?rev=1688548&r1=1688547&r2=1688548&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNRepos.java
(original)
+++ subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/SVNRepos.java
Wed Jul  1 04:00:31 2015
@@ -29,6 +29,7 @@ import java.io.InputStream;
 import java.io.File;
 
 import org.apache.subversion.javahl.callback.ReposNotifyCallback;
+import org.apache.subversion.javahl.callback.ReposVerifyCallback;
 import org.apache.subversion.javahl.callback.ReposFreezeAction;
 import org.apache.subversion.javahl.types.*;
 
@@ -238,12 +239,14 @@ public class SVNRepos implements ISVNRep
                        ReposNotifyCallback callback)
             throws ClientException
     {
-        verify(path, start, end, false, false, callback);
+        verify(path, start, end, false, false, callback, null);
     }
 
     public native void verify(File path, Revision start, Revision end,
-                              boolean checkNormalization, boolean metadataOnly,
-                              ReposNotifyCallback callback)
+                       boolean checkNormalization,
+                       boolean metadataOnly,
+                       ReposNotifyCallback notifyCallback,
+                       ReposVerifyCallback verifyCallback)
             throws ClientException;
 
     /**

Copied: subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposVerifyCallback.java
(from r1688273, subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposVerifyCallback.java)
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposVerifyCallback.java?p2=subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposVerifyCallback.java&p1=subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposVerifyCallback.java&r1=1688273&r2=1688548&rev=1688548&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposVerifyCallback.java
(original)
+++ subversion/branches/1.9.x/subversion/bindings/javahl/src/org/apache/subversion/javahl/callback/ReposVerifyCallback.java
Wed Jul  1 04:00:31 2015
@@ -40,7 +40,7 @@ public interface ReposVerifyCallback ext
 {
     /**
      * This callback method is invoked every time {@link ISVNRepos#verify}
-     * encounters and error.
+     * encounters an error.
      *<p>
      * The implementation can either consume <code>verifyError</code>
      * and return normally to continue verifying the repository after

Modified: subversion/branches/1.9.x/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNReposTests.java
URL: http://svn.apache.org/viewvc/subversion/branches/1.9.x/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNReposTests.java?rev=1688548&r1=1688547&r2=1688548&view=diff
==============================================================================
--- subversion/branches/1.9.x/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNReposTests.java
(original)
+++ subversion/branches/1.9.x/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNReposTests.java
Wed Jul  1 04:00:31 2015
@@ -26,6 +26,7 @@ import org.apache.subversion.javahl.call
 import org.apache.subversion.javahl.types.*;
 
 import java.io.File;
+import java.io.FileWriter;
 import java.io.FileInputStream;
 import java.io.OutputStream;
 import java.io.InputStream;
@@ -79,12 +80,107 @@ public class SVNReposTests extends SVNTe
     public void testVerify()
         throws SubversionException, IOException
     {
-        OneTest thisTest = new OneTest(false);
+        OneTest thisTest = new OneTest(false, true);
         admin.verify(thisTest.getRepository(), Revision.getInstance(0),
                      Revision.HEAD, null);
     }
 
-    /* This test only tests the call down to the C++ layer. */
+    private class VerifyCallback implements ReposVerifyCallback
+    {
+        public int mderr = 0;
+        public int reverr = 0;
+        public boolean keepGoing = false;
+
+        public void onVerifyError(long revision, ClientException verifyError)
+            throws ClientException
+        {
+            if (revision == Revision.SVN_INVALID_REVNUM) {
+                ++mderr;
+            }
+            else {
+                ++reverr;
+            }
+            if (keepGoing) {
+                return;
+            }
+            else {
+                throw verifyError;
+            }
+        }
+
+    }
+
+    private boolean tryToBreakRepo(OneTest test) throws IOException
+    {
+        File repo = test.getRepository();
+
+        // Check for a sharded repo first
+        File rev1 = new File(repo, "db/revs/0/1");
+        if (!rev1.exists() || !rev1.setWritable(true))
+        {
+            // Try non-sharded
+            rev1 = new File(repo, "db/revs/1");
+        }
+        if (!rev1.exists() || !rev1.setWritable(true))
+            return false;
+
+        FileWriter fd = new FileWriter(rev1);
+        fd.write("inserting junk to corrupt the rev");
+        fd.close();
+        return true;
+    }
+
+    public void testVerifyBrokenRepo() throws Throwable
+    {
+        OneTest thisTest = new OneTest(false, true);
+
+        if (!tryToBreakRepo(thisTest)) {
+            // We don't support the repos format
+            System.err.print("Cannot break repository for verify test.");
+            return;
+        }
+
+        VerifyCallback cb = new VerifyCallback();
+        cb.keepGoing = false;
+
+        try {
+            admin.verify(thisTest.getRepository(),
+                         Revision.getInstance(0),
+                         Revision.HEAD,
+                         false, false, null, cb);
+        }
+        catch(ClientException ex) {
+            assertEquals(cb.mderr, 1);
+            assertEquals(cb.reverr, 0);
+            return;
+        }
+
+        assert("Verify did not catch repository corruption." == "");
+    }
+
+    public void testVerifyBrokenRepo_KeepGoing() throws Throwable
+    {
+        OneTest thisTest = new OneTest(false, true);
+
+        if (!tryToBreakRepo(thisTest)) {
+            // We don't support the repos format
+            System.err.print("Cannot break repository for verify test.");
+            return;
+        }
+
+        VerifyCallback cb = new VerifyCallback();
+        cb.keepGoing = true;
+
+        admin.verify(thisTest.getRepository(),
+                     Revision.getInstance(0),
+                     Revision.HEAD,
+                     false, false, null, cb);
+
+        assertEquals(cb.mderr, 1);
+        assertEquals(cb.reverr, 1);
+    }
+
+    /* this test only tests the call down to the C++ layer. */
     public void testUpgrade()
         throws SubversionException, IOException
     {



Mime
View raw message