subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r1785429 - in /subversion/trunk/subversion/bindings/javahl/native: Array.h StringArray.cpp StringArray.h
Date Sat, 04 Mar 2017 06:09:50 GMT
Author: brane
Date: Sat Mar  4 06:09:50 2017
New Revision: 1785429

URL: http://svn.apache.org/viewvc?rev=1785429&view=rev
Log:
Make JavaHL's native StringArray container nullable.

* subversion/bindings/javahl/native/Array.h
  (Array::isNull): New method.

* subversion/bindings/javahl/native/StringArray.h
  (StringArray::isNull): New method.
* subversion/bindings/javahl/native/StringArray.cpp
  (StringArray::StringArray): Leave the contents of the container empty if
   the underlying Java object is null.
  (StringArray::array): Return a null APR array if the Java object is null.

Modified:
    subversion/trunk/subversion/bindings/javahl/native/Array.h
    subversion/trunk/subversion/bindings/javahl/native/StringArray.cpp
    subversion/trunk/subversion/bindings/javahl/native/StringArray.h

Modified: subversion/trunk/subversion/bindings/javahl/native/Array.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/Array.h?rev=1785429&r1=1785428&r2=1785429&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/Array.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/Array.h Sat Mar  4 06:09:50 2017
@@ -45,6 +45,10 @@ class Array
   Array(jobject jobjectsCollection);
   virtual ~Array();
   const std::vector<jobject> &vector(void) const;
+  bool isNull() const
+  {
+    return !m_objectArray;
+  }
 };
 
 #endif // ARRAY_H

Modified: subversion/trunk/subversion/bindings/javahl/native/StringArray.cpp
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/StringArray.cpp?rev=1785429&r1=1785428&r2=1785429&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/StringArray.cpp (original)
+++ subversion/trunk/subversion/bindings/javahl/native/StringArray.cpp Sat Mar  4 06:09:50
2017
@@ -38,6 +38,9 @@ StringArray::~StringArray()
 
 const apr_array_header_t *StringArray::array(const SVN::Pool &pool)
 {
+  if (isNull())
+    return NULL;
+
   apr_array_header_t *strings
     = apr_array_make(pool.getPool(), static_cast<int>(m_strings.size()),
                      sizeof(char *));
@@ -77,11 +80,13 @@ StringArray::init(void)
 StringArray::StringArray(jobjectArray jstrings)
     : Array(jstrings), m_strings()
 {
-  init();
+  if (!isNull())
+    init();
 }
 
 StringArray::StringArray(jobject jstringCollection)
     : Array(jstringCollection), m_strings()
 {
-  init();
+  if (!isNull())
+    init();
 }

Modified: subversion/trunk/subversion/bindings/javahl/native/StringArray.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/bindings/javahl/native/StringArray.h?rev=1785429&r1=1785428&r2=1785429&view=diff
==============================================================================
--- subversion/trunk/subversion/bindings/javahl/native/StringArray.h (original)
+++ subversion/trunk/subversion/bindings/javahl/native/StringArray.h Sat Mar  4 06:09:50 2017
@@ -47,6 +47,10 @@ class StringArray : Array
   ~StringArray();
   const apr_array_header_t *array(const SVN::Pool &pool);
   const std::vector<std::string> &vector(void) const;
+  bool isNull() const
+  {
+    return Array::isNull();
+  }
 };
 
 #endif // STRINGARRAY_H



Mime
View raw message