subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hwri...@apache.org
Subject svn commit: r918604 - in /subversion/trunk/subversion/bindings/javahl: native/CommitMessage.cpp src/org/apache/subversion/javahl/CommitMessage.java src/org/tigris/subversion/javahl/SVNClient.java tests/org/apache/subversion/javahl/SVNTests.java
Date Wed, 03 Mar 2010 18:07:25 GMT
Author: hwright
Date: Wed Mar  3 18:07:25 2010
New Revision: 918604

URL: http://svn.apache.org/viewvc?rev=918604&view=rev
Log:
JavaHL: Update another API to return a Set of items, rather than an array.

[ subversion/bindings/javahl/ ]
* tests/org/apache/subversion/javahl/SVNTests.java
  (testBasicCommit): Expect the new API.

* native/CommitMessage.cpp
  (getCommitMessage): Update to create a Set of items, rather than an array.

* src/org/tigris/subversion/javahl/SVNClient.java
  (commitMessageHandler): Update wrapper.

* src/org/apache/subversion/javahl/CommitMessage.java
  (getLogMessage): Return a set of commit items, rather than an array.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/CommitMessage.cpp
    subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitMessage.java
    subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
    subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java

Modified: subversion/trunk/subversion/bindings/javahl/native/CommitMessage.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CommitMessage.cpp?rev=918604&r1=918603&r2=918604&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CommitMessage.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CommitMessage.cpp Wed Mar  3 18:07:25
2010
@@ -25,6 +25,7 @@
  */
 
 #include "CommitMessage.h"
+#include "CreateJ.h"
 #include "JNIUtil.h"
 #include <apr_tables.h>
 #include "svn_client.h"
@@ -95,11 +96,6 @@
   if (JNIUtil::isExceptionThrown())
     return NULL;
 
-  int count = commit_items->nelts;
-  jobjectArray jitems = env->NewObjectArray(count, clazz, NULL);
-  if (JNIUtil::isExceptionThrown())
-    return NULL;
-
   // Java method ids will not change during the time this library is
   // loaded, so they can be cached.
 
@@ -124,8 +120,7 @@
         return NULL;
 
       midCallback = env->GetMethodID(clazz2, "getLogMessage",
-                                     "([L"JAVA_PACKAGE"/CommitItem;)"
-                                     "Ljava/lang/String;");
+                                     "(Ljava/util/Set;)Ljava/lang/String;");
       if (JNIUtil::isJavaExceptionThrown())
         return NULL;
 
@@ -135,7 +130,8 @@
     }
 
   // create a Java CommitItem for each of the passed in commit items
-  for (int i = 0; i < count; ++i)
+  std::vector<jobject> jitems;
+  for (int i = 0; i < commit_items->nelts; ++i)
     {
       svn_client_commit_item3_t *item =
         APR_ARRAY_IDX(commit_items, i, svn_client_commit_item3_t *);
@@ -190,10 +186,9 @@
         return NULL;
 
       // store the Java object into the array
-      env->SetObjectArrayElement(jitems, i, jitem);
-      if (JNIUtil::isJavaExceptionThrown())
-        return NULL;
+      jitems.push_back(jitem);
     }
+
   env->DeleteLocalRef(clazz);
   if (JNIUtil::isJavaExceptionThrown())
     return NULL;
@@ -201,12 +196,7 @@
   // call the Java callback method
   jstring jmessage = (jstring)env->CallObjectMethod(m_jcommitMessage,
                                                     midCallback,
-                                                    jitems);
-  if (JNIUtil::isJavaExceptionThrown())
-    return NULL;
-
-  // release the Java object array
-  env->DeleteLocalRef(jitems);
+                                                    CreateJ::Set(jitems));
   if (JNIUtil::isJavaExceptionThrown())
     return NULL;
 

Modified: subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitMessage.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitMessage.java?rev=918604&r1=918603&r2=918604&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitMessage.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/apache/subversion/javahl/CommitMessage.java
Wed Mar  3 18:07:25 2010
@@ -23,6 +23,8 @@
 
 package org.apache.subversion.javahl;
 
+import java.util.Set;
+
 /**
  * This is callback interface which has to implemented by the client
  * to receive which files will be commited and to enter the log
@@ -36,5 +38,5 @@
      * @param elementsToBeCommited Array of elements to be commited
      * @return the log message of the commit.
      */
-    String getLogMessage(CommitItem[] elementsToBeCommited);
+    String getLogMessage(Set<CommitItem> elementsToBeCommited);
 }

Modified: subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java?rev=918604&r1=918603&r2=918604&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/src/org/tigris/subversion/javahl/SVNClient.java
Wed Mar  3 18:07:25 2010
@@ -655,14 +655,17 @@
             implements org.apache.subversion.javahl.CommitMessage
         {
             public String getLogMessage(
-                org.apache.subversion.javahl.CommitItem[] elementsToBeCommited)
+                Set<org.apache.subversion.javahl.CommitItem> elementsToBeCommited)
             {
                 CommitItem[] aElements =
-                        new CommitItem[elementsToBeCommited.length];
+                        new CommitItem[elementsToBeCommited.size()];
 
-                for (int i = 0; i < elementsToBeCommited.length; i++)
+                int i = 0;
+                for (org.apache.subversion.javahl.CommitItem item
+                                                        : elementsToBeCommited)
                 {
-                    aElements[i] = new CommitItem(elementsToBeCommited[i]);
+                    aElements[i] = new CommitItem(item);
+                    i++;
                 }
 
                 if (messageHandler == null)

Modified: subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java?rev=918604&r1=918603&r2=918604&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java
(original)
+++ subversion/trunk/subversion/bindings/javahl/tests/org/apache/subversion/javahl/SVNTests.java
Wed Mar  3 18:07:25 2010
@@ -842,7 +842,7 @@
          * @param elementsToBeCommited  Array of elements to be commited
          * @return  the log message of the commit.
          */
-        public String getLogMessage(CommitItem[] elementsToBeCommited)
+        public String getLogMessage(Set<CommitItem> elementsToBeCommited)
         {
             // check all received CommitItems are expected as received
             for (CommitItem commitItem : elementsToBeCommited)



Mime
View raw message