--- a/hotspot/src/share/vm/logging/logTagLevelExpression.cpp Fri Sep 02 09:49:10 2016 +0200
+++ b/hotspot/src/share/vm/logging/logTagLevelExpression.cpp Fri Sep 02 11:18:04 2016 +0200
@@ -164,7 +164,14 @@
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);
--- a/hotspot/src/share/vm/logging/logTagLevelExpression.hpp Fri Sep 02 09:49:10 2016 +0200
+++ b/hotspot/src/share/vm/logging/logTagLevelExpression.hpp Fri Sep 02 11:18:04 2016 +0200
@@ -59,9 +59,15 @@
_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) {
--- a/hotspot/test/native/logging/test_logTagLevelExpression.cpp Fri Sep 02 09:49:10 2016 +0200
+++ b/hotspot/test/native/logging/test_logTagLevelExpression.cpp Fri Sep 02 11:18:04 2016 +0200
@@ -33,7 +33,7 @@
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",