You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mesos.apache.org by be...@apache.org on 2014/10/26 02:44:15 UTC

[2/3] git commit: Fixes necessary due to JSON::Array::values change to std::vector.

Fixes necessary due to JSON::Array::values change to std::vector.

Review: https://reviews.apache.org/r/26635


Project: http://git-wip-us.apache.org/repos/asf/mesos/repo
Commit: http://git-wip-us.apache.org/repos/asf/mesos/commit/06bec4fa
Tree: http://git-wip-us.apache.org/repos/asf/mesos/tree/06bec4fa
Diff: http://git-wip-us.apache.org/repos/asf/mesos/diff/06bec4fa

Branch: refs/heads/master
Commit: 06bec4fa91f5f1c30eb1eac30f2a123100872d8e
Parents: dfe3380
Author: Benjamin Hindman <be...@gmail.com>
Authored: Sun Oct 12 21:34:43 2014 -0700
Committer: Benjamin Hindman <be...@gmail.com>
Committed: Sat Oct 25 16:57:40 2014 -0700

----------------------------------------------------------------------
 3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp | 3 +--
 3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp   | 7 +++++++
 src/docker/docker.cpp                                     | 2 +-
 3 files changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mesos/blob/06bec4fa/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp b/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
index 11bb7ed..334c898 100644
--- a/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
+++ b/3rdparty/libprocess/3rdparty/stout/include/stout/json.hpp
@@ -237,8 +237,7 @@ Result<T> Object::find(const std::string& path) const
 
     // Now remove the closing bracket (last character) and everything
     // before and including the opening bracket.
-    std::string s = name.substr(0, name.length() - 1);
-    s = s.substr(index + 1);
+    std::string s = name.substr(index + 1, name.length() - index - 2);
 
     // Now numify the subscript.
     Try<int> i = numify<int>(s);

http://git-wip-us.apache.org/repos/asf/mesos/blob/06bec4fa/3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp
----------------------------------------------------------------------
diff --git a/3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp b/3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp
index 2be4c65..f60d1bb 100644
--- a/3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp
+++ b/3rdparty/libprocess/3rdparty/stout/tests/json_tests.cpp
@@ -230,6 +230,13 @@ TEST(JsonTest, Find)
   ASSERT_ERROR(object.find<JSON::String>("nested1.nested2.array.[1]"));
   ASSERT_ERROR(object.find<JSON::String>("nested1.nested2.array[.1]"));
   ASSERT_ERROR(object.find<JSON::String>("nested1.nested2.array[1.]"));
+  ASSERT_ERROR(object.find<JSON::String>("nested1.nested2.array[]"));
+  ASSERT_ERROR(object.find<JSON::String>("nested1.nested2.array[[]"));
+  ASSERT_ERROR(object.find<JSON::String>("nested1.nested2.array[]]"));
+  ASSERT_ERROR(object.find<JSON::String>("nested1.nested2.array[[]]"));
+  ASSERT_ERROR(object.find<JSON::String>("nested1.nested2.array[[1]]"));
+  ASSERT_ERROR(object.find<JSON::String>("nested1.nested2.array[[1]"));
+  ASSERT_ERROR(object.find<JSON::String>("nested1.nested2.array[1]]"));
 
   // Out of bounds is none.
   ASSERT_NONE(object.find<JSON::String>("nested1.nested2.array[1]"));

http://git-wip-us.apache.org/repos/asf/mesos/blob/06bec4fa/src/docker/docker.cpp
----------------------------------------------------------------------
diff --git a/src/docker/docker.cpp b/src/docker/docker.cpp
index e09b51c..9973782 100644
--- a/src/docker/docker.cpp
+++ b/src/docker/docker.cpp
@@ -253,7 +253,7 @@ Try<Docker::Image> Docker::Image::create(const JSON::Object& json)
     return Error("Unexpected type found for 'ContainerConfig.Entrypoint'");
   }
 
-  const list<JSON::Value>& values = entrypoint.get().as<JSON::Array>().values;
+  const vector<JSON::Value>& values = entrypoint.get().as<JSON::Array>().values;
   if (values.size() == 0) {
     return Docker::Image(None());
   }