Merge lp:~marcustomlinson/unity-scopes-api/ss_fail_on_neg_version into lp:unity-scopes-api/devel

Proposed by Marcus Tomlinson
Status: Merged
Approved by: Michi Henning
Approved revision: 537
Merged at revision: 538
Proposed branch: lp:~marcustomlinson/unity-scopes-api/ss_fail_on_neg_version
Merge into: lp:unity-scopes-api/devel
Diff against target: 36 lines (+10/-2)
2 files modified
src/scopes/internal/smartscopes/SmartScopesClient.cpp (+8/-0)
test/gtest/scopes/internal/smartscopes/SmartScopesClient/SmartScopesClient_test.cpp (+2/-2)
To merge this branch: bzr merge lp:~marcustomlinson/unity-scopes-api/ss_fail_on_neg_version
Reviewer Review Type Date Requested Status
Michi Henning (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+242877@code.launchpad.net

Commit message

Skip remote scopes that return an invalid (negative) version number

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Michi Henning (michihenning) wrote :

Nice, thank you!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/scopes/internal/smartscopes/SmartScopesClient.cpp'
2--- src/scopes/internal/smartscopes/SmartScopesClient.cpp 2014-11-19 13:05:49 +0000
3+++ src/scopes/internal/smartscopes/SmartScopesClient.cpp 2014-11-26 08:31:37 +0000
4@@ -283,6 +283,14 @@
5 scope.invisible = child_node->has_node("invisible") ? child_node->get_node("invisible")->as_bool() : false;
6
7 scope.version = child_node->has_node("version") ? child_node->get_node("version")->as_int() : 0;
8+ if (scope.version < 0)
9+ {
10+ std::cerr << "SmartScopesClient.get_remote_scopes(): Scope: \"" << scope.id
11+ << "\" returned a negative \"version\" value" << std::endl;
12+ std::cerr << "SmartScopesClient.get_remote_scopes(): Skipping scope: \""
13+ << scope.id << "\"" << std::endl;
14+ continue;
15+ }
16
17 remote_scopes.push_back(scope);
18 }
19
20=== modified file 'test/gtest/scopes/internal/smartscopes/SmartScopesClient/SmartScopesClient_test.cpp'
21--- test/gtest/scopes/internal/smartscopes/SmartScopesClient/SmartScopesClient_test.cpp 2014-11-19 13:05:49 +0000
22+++ test/gtest/scopes/internal/smartscopes/SmartScopesClient/SmartScopesClient_test.cpp 2014-11-26 08:31:37 +0000
23@@ -68,11 +68,11 @@
24
25 // now try an empty locale
26 EXPECT_TRUE(ssc_->get_remote_scopes(scopes, "", false));
27- ASSERT_EQ(5u, scopes.size());
28+ ASSERT_EQ(4u, scopes.size());
29
30 // now try a valid locale
31 EXPECT_TRUE(ssc_->get_remote_scopes(scopes, "test_TEST", false));
32- ASSERT_EQ(5u, scopes.size());
33+ ASSERT_EQ(4u, scopes.size());
34
35 EXPECT_EQ("dummy.scope", scopes[0].id);
36 EXPECT_EQ("Dummy Demo Scope", scopes[0].name);

Subscribers

People subscribed via source and target branches

to all changes: