Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
batmen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
sepia-pub
mael
batmen
Commits
9542cae3
Commit
9542cae3
authored
2 years ago
by
jgatt
Browse files
Options
Downloads
Patches
Plain Diff
added error check for parse_dm_window function
parent
b54f0fef
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!12
Merge Request multibehavior
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/users/broker.cpp
+13
-9
13 additions, 9 deletions
src/users/broker.cpp
with
13 additions
and
9 deletions
src/users/broker.cpp
+
13
−
9
View file @
9542cae3
...
...
@@ -127,7 +127,7 @@ Broker::Broker(rapidjson::Document *user_description_file)
else
if
(
category
==
"dm_user_multi_behavior"
){
PPK_ASSERT_ERROR
(
dm_window
||
red_windows_list
||
yellow_windows_list
,
"One of these 3 fiels should be defined to use dm_user_multi_behavior"
"One of these 3 fiel
d
s should be defined to use dm_user_multi_behavior"
" 'dm_windows' 'red_windows', 'yellow_windows' "
);
PPK_ASSERT_ERROR
(
...
...
@@ -280,19 +280,23 @@ DMWindow_list* Broker::parse_dm_windows(const std::string attr_name,
const
rapidjson
::
Document
*
user_description_file
)
{
const
Value
&
windows_param
=
(
*
user_description_file
)[
attr_name
.
c_str
()];
/*PPK_ASSERT_ERROR(yellow_windows_param.IsArray(),
"Invalid user_description file: field "
attr_name "should be an array.");*/
std
::
string
error_message
=
"Invalid user_description file: field "
;
error_message
+=
attr_name
;
error_message
=
"should be an array"
;
PPK_ASSERT_ERROR
(
windows_param
.
IsArray
(),
error_message
.
c_str
());
error_message
=
"Invalid user_description file: the field "
;
error_message
+=
attr_name
;
error_message
+=
" should be an array containing only array of int of size 2."
;
std
::
vector
<
DMWindow
>
windows_collect
;
for
(
SizeType
i
=
0
;
i
<
windows_param
.
GetArray
().
Size
();
i
++
)
{
const
Value
&
window
=
(
*
user_description_file
)[
attr_name
.
c_str
()].
GetArray
()[
i
];
/*PPK_ASSERT_ERROR(window.IsArray()
PPK_ASSERT_ERROR
(
window
.
IsArray
()
&&
window
.
GetArray
().
Size
()
==
2
&&
window
.
GetArray
()[
0
].
IsInt
()
&& window.GetArray()[1].IsInt()
&& window.GetArray().Size()==2,
"Invalid user_description file: field "
attr_name "should be an array containing only array of int of size 2.");*/
&&
window
.
GetArray
()[
1
].
IsInt
(),
error_message
.
c_str
());
DMWindow
*
dm_window
=
new
DMWindow
(
window
.
GetArray
()[
0
].
GetInt
(),
window
.
GetArray
()[
1
].
GetInt
());
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment