Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b30688c

Browse files
committed
Address sonar coverage issues.
1 parent 5b46140 commit b30688c

2 files changed

Lines changed: 18 additions & 10 deletions

File tree

source/core/ut_suite_cache_manager.pkb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -227,11 +227,10 @@ create or replace package body ut_suite_cache_manager is
227227
- = NOT
228228
we will perform a replace of that characters into
229229
new notation.
230-
|| = OR
231-
&& = AND
232-
^ = NOT
230+
| = OR
231+
& = AND
232+
! = NOT
233233
*/
234-
--TODO: How do we prevent when old notation reach 4k an new will be longer?
235234
function replace_legacy_tag_notation(a_tags varchar2
236235
) return varchar2 is
237236
l_tags ut_varchar2_list := ut_utils.string_to_table(a_tags,',');
@@ -331,8 +330,11 @@ with
331330
)
332331
) t where c.id = t.id and r_num = 1 ]';
333332

334-
execute immediate l_sql bulk collect into l_suite_tags using a_suite_items;
335-
return l_suite_tags;
333+
execute immediate l_sql bulk collect into l_suite_tags using a_suite_items;
334+
return l_suite_tags;
335+
exception when others then
336+
--If the dynamic SQL fails we will fall gracefully with meaningfull message
337+
raise_application_error(ut_utils.gc_invalid_tag_expression, 'Tag expression, causing error. If expression is correct please report error.');
336338
end;
337339

338340
/*

source/core/ut_utils.pkb

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -990,15 +990,21 @@ create or replace package body ut_utils is
990990
return l_result;
991991
end;
992992

993+
/*
994+
Purpose of this function is to break down the tag expressions
995+
We can separate operators on left and rigth side.
996+
Left ones are AND and OR as they require an operator on left side to
997+
be valid. Right side is NOT.
998+
In each iteration we breakdown string into parts
999+
1000+
*/
9931001
function valid_tag_expression(a_tags in varchar2) return number is
994-
t_left_side ut_varchar2_list := ut_varchar2_list('|','&',',');
995-
t_right_side ut_varchar2_list := ut_varchar2_list('!','-');
9961002
l_left_side_expression varchar2(100) := '[|&,]';
997-
l_left_side_regex varchar(400) := '([^|&,]*)[|&,](.*)';
1003+
l_left_side_regex varchar2(400) := '([^|&,]*)[|&,](.*)';
9981004
l_left_side varchar2(4000);
9991005

10001006
l_rigth_side_expression varchar2(100) := '[!-]';
1001-
l_right_side_regex varchar(400) := '([!-])([^!-].*)';
1007+
l_right_side_regex varchar2(400) := '([!-])([^!-].*)';
10021008
l_right_side varchar2(4000);
10031009

10041010
l_tags varchar2(4000) := a_tags;

0 commit comments

Comments
 (0)