8165215: Setting same UL tag multiple times matches wrong tagset
Reviewed-by: mlarsson, rprotacio
This commit is contained in:
parent
8b9c8fc1c4
commit
3e07dc6611
@ -164,7 +164,14 @@ bool LogTagLevelExpression::parse(const char* str, outputStream* errstream) {
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
add_tag(tag);
|
||||
if (!add_tag(tag)) {
|
||||
if (errstream != NULL) {
|
||||
errstream->print_cr("Tag combination have duplicate tag '%s' in what-expression.",
|
||||
cur_tag);
|
||||
}
|
||||
success = false;
|
||||
break;
|
||||
}
|
||||
cur_tag = plus_pos + 1;
|
||||
} while (plus_pos != NULL);
|
||||
|
||||
|
@ -59,9 +59,15 @@ class LogTagLevelExpression : public StackObj {
|
||||
_ntags = 0;
|
||||
}
|
||||
|
||||
void add_tag(LogTagType tag) {
|
||||
bool add_tag(LogTagType tag) {
|
||||
assert(_ntags < LogTag::MaxTags, "Can't have more tags than MaxTags!");
|
||||
for (size_t i = 0; i < _ntags; i++) {
|
||||
if (_tags[_ncombinations][i] == tag) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
_tags[_ncombinations][_ntags++] = tag;
|
||||
return true;
|
||||
}
|
||||
|
||||
void set_level(LogLevelType level) {
|
||||
|
@ -33,7 +33,7 @@ TEST(LogTagLevelExpression, parse) {
|
||||
const char* invalid_substr[] = {
|
||||
"=", "+", " ", "+=", "+=*", "*+", " +", "**", "++", ".", ",", ",," ",+",
|
||||
" *", "all+", "all*", "+all", "+all=Warning", "==Info", "=InfoWarning",
|
||||
"BadTag+", "logging++", "logging*+", ",=", "gc+gc+gc+gc+gc+gc"
|
||||
"BadTag+", "logging++", "logging*+", ",=", "gc+gc+"
|
||||
};
|
||||
const char* valid_expression[] = {
|
||||
"all", "gc", "gc,logging", "gc+logging", "logging+gc", "logging+gc,gc", "logging+gc*", "gc=trace",
|
||||
|
Loading…
x
Reference in New Issue
Block a user