Merge lp:~marcustomlinson/unity-scopes-api/lp-1410125-rtm into lp:unity-scopes-api/rtm-14.09

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Michi Henning
Approved revision: 261
Merged at revision: 261
Proposed branch: lp:~marcustomlinson/unity-scopes-api/lp-1410125-rtm
Merge into: lp:unity-scopes-api/rtm-14.09
Diff against target: 53 lines (+12/-3)
3 files modified
src/scopes/internal/JsonCppNode.cpp (+5/-0)
src/scopes/internal/JsonSettingsSchema.cpp (+5/-1)
test/gtest/scopes/internal/JsonSettingsSchema/JsonSettingsSchema_test.cpp (+2/-2)
To merge this branch: bzr merge lp:~marcustomlinson/unity-scopes-api/lp-1410125-rtm
Reviewer Review Type Date Requested Status
Michi Henning (community) Approve
Review via email: mp+247418@code.launchpad.net

Commit message

Fixed smartscopesproxy crash due to json-cpp update

To post a comment you must log in.
Revision history for this message
Michi Henning (michihenning) wrote :

Yes, please!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/scopes/internal/JsonCppNode.cpp'
--- src/scopes/internal/JsonCppNode.cpp 2014-08-18 08:12:22 +0000
+++ src/scopes/internal/JsonCppNode.cpp 2015-01-23 12:23:57 +0000
@@ -252,6 +252,11 @@
252252
253bool JsonCppNode::has_node(std::string const& node_name) const253bool JsonCppNode::has_node(std::string const& node_name) const
254{254{
255 if (!root_)
256 {
257 throw unity::LogicException("Current node is empty");
258 }
259
255 return root_.isMember(node_name);260 return root_.isMember(node_name);
256}261}
257262
258263
=== modified file 'src/scopes/internal/JsonSettingsSchema.cpp'
--- src/scopes/internal/JsonSettingsSchema.cpp 2014-08-28 00:20:56 +0000
+++ src/scopes/internal/JsonSettingsSchema.cpp 2015-01-23 12:23:57 +0000
@@ -181,7 +181,11 @@
181void Setting::set_default_value(Json::Value const& v, Type expected_type)181void Setting::set_default_value(Json::Value const& v, Type expected_type)
182{182{
183 auto v_param = v[parameters_key];183 auto v_param = v[parameters_key];
184 if (!v_param.isObject())184 if (v_param.isNull())
185 {
186 return;
187 }
188 else if (!v_param.isObject())
185 {189 {
186 throw ResourceException("JsonSettingsSchema(): expected value of type object for \"parameters\", id = \"" + id_ + "\"");190 throw ResourceException("JsonSettingsSchema(): expected value of type object for \"parameters\", id = \"" + id_ + "\"");
187 }191 }
188192
=== modified file 'test/gtest/scopes/internal/JsonSettingsSchema/JsonSettingsSchema_test.cpp'
--- test/gtest/scopes/internal/JsonSettingsSchema/JsonSettingsSchema_test.cpp 2014-08-14 14:39:01 +0000
+++ test/gtest/scopes/internal/JsonSettingsSchema/JsonSettingsSchema_test.cpp 2015-01-23 12:23:57 +0000
@@ -397,7 +397,7 @@
397 {397 {
398 "id": "x",398 "id": "x",
399 "type": "number",399 "type": "number",
400 "displayName": "X",400 "displayName": "X",
401 "parameters": {401 "parameters": {
402 "defaultValue": "banana"402 "defaultValue": "banana"
403 }403 }
@@ -457,7 +457,7 @@
457 }457 }
458 catch (ResourceException const& e)458 catch (ResourceException const& e)
459 {459 {
460 EXPECT_STREQ("unity::ResourceException: JsonSettingsSchema(): missing \"parameters\" definition, id = \"x\"",460 EXPECT_STREQ("unity::ResourceException: JsonSettingsSchema(): missing \"displayName\" definition, id = \"x\"",
461 e.what());461 e.what());
462 }462 }
463463

Subscribers

People subscribed via source and target branches

to all changes: