You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by br...@apache.org on 2013/10/31 17:40:37 UTC

svn commit: r1537549 - in /subversion/trunk/subversion/bindings/javahl/native: CommitEditor.cpp PropertyTable.cpp PropertyTable.h org_apache_subversion_javahl_SVNClient.cpp

Author: brane
Date: Thu Oct 31 16:40:37 2013
New Revision: 1537549

URL: http://svn.apache.org/r1537549
Log:
Fixed a silly thinko in the design of the JavahL PropertyTable wrapper:
whether it generates a NULL hash table should depend on the value
of the original Java property set, and the semantics should be defined
when the wrapper is created, not when it's converted to a hash table.

* subversion/bindings/javahl/native/PropertyTable.h
  (PropertyTable::m_empty_if_null): New private member.
  (PropertyTable::PropertyTable): Remove default value from
   the bytearray_values parameter and add empty_if_null parameter.
  (PropertyTable::hash): Remove nullIfEmpty parameter.
* subversion/bindings/javahl/native/PropertyTable.cpp
  (PropertyTable::hash): Update signature and change the logic
   that decides whether we should return a NULL hash value.
  (PropertyTable::PropertyTable): Update signature and
   initialize the new private member.

* subversion/bindings/javahl/native/CommitEditor.cpp,
  subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp:
   Update all uses of PropertyTable.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp
    subversion/trunk/subversion/bindings/javahl/native/PropertyTable.cpp
    subversion/trunk/subversion/bindings/javahl/native/PropertyTable.h
    subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp

Modified: subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp?rev=1537549&r1=1537548&r2=1537549&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/CommitEditor.cpp Thu Oct 31 16:40:37 2013
@@ -89,7 +89,7 @@ CommitEditor::CommitEditor(RemoteSession
                                &m_callback_session_uuid,
                                pool.getPool()),);
 
-  PropertyTable revprops(jrevprops, true);
+  PropertyTable revprops(jrevprops, true, true);
   if (JNIUtil::isJavaExceptionThrown())
     return;
   LockTokenTable lock_tokens(jlock_tokens);
@@ -100,7 +100,7 @@ CommitEditor::CommitEditor(RemoteSession
   SVN_JNI_ERR(svn_ra__get_commit_ev2(
                   &m_editor,
                   session->m_session,
-                  revprops.hash(subPool, false),
+                  revprops.hash(subPool),
                   m_callback.callback, &m_callback,
                   lock_tokens.hash(subPool, true),
                   bool(jkeep_locks),
@@ -213,7 +213,7 @@ void CommitEditor::addDirectory(jstring 
   Iterator children(jchildren);
   if (JNIUtil::isJavaExceptionThrown())
     return;
-  PropertyTable properties(jproperties, true);
+  PropertyTable properties(jproperties, true, true);
   if (JNIUtil::isJavaExceptionThrown())
     return;
 
@@ -225,7 +225,7 @@ void CommitEditor::addDirectory(jstring 
 
   SVN_JNI_ERR(svn_editor_add_directory(m_editor, relpath.c_str(),
                                        build_children(children, subPool),
-                                       properties.hash(subPool, false),
+                                       properties.hash(subPool),
                                        svn_revnum_t(jreplaces_revision)),);
 }
 
@@ -238,7 +238,7 @@ void CommitEditor::addFile(jstring jrelp
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
   InputStream contents(jcontents);
-  PropertyTable properties(jproperties, true);
+  PropertyTable properties(jproperties, true, true);
   if (JNIUtil::isJavaExceptionThrown())
     return;
 
@@ -253,7 +253,7 @@ void CommitEditor::addFile(jstring jrelp
     return;
   SVN_JNI_ERR(svn_editor_add_file(m_editor, relpath.c_str(),
                                   &checksum, contents.getStream(subPool),
-                                  properties.hash(subPool, false),
+                                  properties.hash(subPool),
                                   svn_revnum_t(jreplaces_revision)),);
 }
 
@@ -290,7 +290,7 @@ void CommitEditor::alterDirectory(jstrin
   Iterator children(jchildren);
   if (JNIUtil::isJavaExceptionThrown())
     return;
-  PropertyTable properties(jproperties, true);
+  PropertyTable properties(jproperties, true, false);
   if (JNIUtil::isJavaExceptionThrown())
     return;
 
@@ -303,7 +303,7 @@ void CommitEditor::alterDirectory(jstrin
   SVN_JNI_ERR(svn_editor_alter_directory(
                   m_editor, relpath.c_str(), svn_revnum_t(jrevision),
                   (jchildren ? build_children(children, subPool) : NULL),
-                  properties.hash(subPool, false)),);
+                  properties.hash(subPool)),);
 }
 
 void CommitEditor::alterFile(jstring jrelpath, jlong jrevision,
@@ -314,7 +314,7 @@ void CommitEditor::alterFile(jstring jre
   SVN_JNI_ERR(m_session->m_context->checkCancel(m_session->m_context),);
 
   InputStream contents(jcontents);
-  PropertyTable properties(jproperties, true);
+  PropertyTable properties(jproperties, true, false);
   if (JNIUtil::isJavaExceptionThrown())
     return;
 
@@ -331,7 +331,7 @@ void CommitEditor::alterFile(jstring jre
                   m_editor, relpath.c_str(), svn_revnum_t(jrevision),
                   (jcontents ? &checksum : NULL),
                   (jcontents ? contents.getStream(subPool) : NULL),
-                  properties.hash(subPool, false)),);
+                  properties.hash(subPool)),);
 }
 
 void CommitEditor::alterSymlink(jstring jrelpath, jlong jrevision,

Modified: subversion/trunk/subversion/bindings/javahl/native/PropertyTable.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/PropertyTable.cpp?rev=1537549&r1=1537548&r2=1537549&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/PropertyTable.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/PropertyTable.cpp Thu Oct 31 16:40:37 2013
@@ -42,9 +42,9 @@ PropertyTable::~PropertyTable()
     JNIUtil::getEnv()->DeleteLocalRef(m_revpropTable);
 }
 
-apr_hash_t *PropertyTable::hash(const SVN::Pool &pool, bool nullIfEmpty)
+apr_hash_t *PropertyTable::hash(const SVN::Pool &pool)
 {
-  if (m_revprops.size() == 0 && nullIfEmpty)
+  if (!m_revpropTable && !m_empty_if_null)
     return NULL;
 
   apr_hash_t *revprop_table = apr_hash_make(pool.getPool());
@@ -73,7 +73,10 @@ apr_hash_t *PropertyTable::hash(const SV
   return revprop_table;
 }
 
-PropertyTable::PropertyTable(jobject jrevpropTable, bool bytearray_values)
+PropertyTable::PropertyTable(jobject jrevpropTable, bool bytearray_values,
+                             bool empty_if_null)
+  : m_revpropTable(jrevpropTable),
+    m_empty_if_null(empty_if_null)
 {
   m_revpropTable = jrevpropTable;
 

Modified: subversion/trunk/subversion/bindings/javahl/native/PropertyTable.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/PropertyTable.h?rev=1537549&r1=1537548&r2=1537549&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/PropertyTable.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/PropertyTable.h Thu Oct 31 16:40:37 2013
@@ -41,10 +41,13 @@ class PropertyTable
  private:
   std::map<std::string, std::string> m_revprops;
   jobject m_revpropTable;
+  bool m_empty_if_null;
  public:
-  PropertyTable(jobject jrevpropTable, bool bytearray_values=false);
+  PropertyTable(jobject jrevpropTable,
+                bool bytearray_values,
+                bool empty_if_null);
   ~PropertyTable();
-  apr_hash_t *hash(const SVN::Pool &pool, bool nullIfEmpty = true);
+  apr_hash_t *hash(const SVN::Pool &pool);
 };
 
 #endif // REVPROPTABLE_H

Modified: subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp?rev=1537549&r1=1537548&r2=1537549&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/org_apache_subversion_javahl_SVNClient.cpp Thu Oct 31 16:40:37 2013
@@ -399,7 +399,7 @@ Java_org_apache_subversion_javahl_SVNCli
   if (JNIUtil::isExceptionThrown())
     return;
 
-  PropertyTable revprops(jrevpropTable);
+  PropertyTable revprops(jrevpropTable, false, false);
   if (JNIUtil::isExceptionThrown())
     return;
 
@@ -513,7 +513,7 @@ Java_org_apache_subversion_javahl_SVNCli
   if (JNIUtil::isExceptionThrown())
     return;
 
-  PropertyTable revprops(jrevpropTable);
+  PropertyTable revprops(jrevpropTable, false, false);
   if (JNIUtil::isExceptionThrown())
     return;
 
@@ -554,7 +554,7 @@ Java_org_apache_subversion_javahl_SVNCli
   if (JNIUtil::isExceptionThrown())
     return;
 
-  PropertyTable revprops(jrevpropTable);
+  PropertyTable revprops(jrevpropTable, false, false);
   if (JNIUtil::isExceptionThrown())
     return;
 
@@ -592,7 +592,7 @@ Java_org_apache_subversion_javahl_SVNCli
   if (JNIUtil::isExceptionThrown())
     return;
 
-  PropertyTable revprops(jrevpropTable);
+  PropertyTable revprops(jrevpropTable, false, false);
   if (JNIUtil::isExceptionThrown())
     return;
 
@@ -625,7 +625,7 @@ Java_org_apache_subversion_javahl_SVNCli
   if (JNIUtil::isExceptionThrown())
     return;
 
-  PropertyTable revprops(jrevpropTable);
+  PropertyTable revprops(jrevpropTable, false, false);
   if (JNIUtil::isExceptionThrown())
     return;
 
@@ -776,7 +776,7 @@ Java_org_apache_subversion_javahl_SVNCli
   if (JNIUtil::isExceptionThrown())
     return;
 
-  PropertyTable revprops(jrevpropTable);
+  PropertyTable revprops(jrevpropTable, false, false);
   if (JNIUtil::isExceptionThrown())
     return;
 
@@ -1027,7 +1027,7 @@ Java_org_apache_subversion_javahl_SVNCli
   if (JNIUtil::isExceptionThrown())
     return;
 
-  PropertyTable revprops(jrevpropTable);
+  PropertyTable revprops(jrevpropTable, false, false);
   if (JNIUtil::isExceptionThrown())
     return;