RFR(xs): 8153845: UL log write method missing essential assert

Robbin Ehn robbin.ehn at oracle.com
Fri Apr 8 12:45:45 UTC 2016


Hi again,

I missed LogLevel:Off, it should be:

diff -r 35cb720769c5 src/share/vm/logging/logTagSet.cpp
--- a/src/share/vm/logging/logTagSet.cpp	Fri Apr 08 08:51:45 2016 +0200
+++ b/src/share/vm/logging/logTagSet.cpp	Fri Apr 08 14:44:33 2016 +0200
@@ -98,6 +98,7 @@
  const size_t vwrite_buffer_size = 512;

  void LogTagSet::vwrite(LogLevelType level, const char* fmt, va_list 
args) {
+  assert(level >= LogLevel::First && level <= LogLevel::Last, "Log 
level:%d is incorrect", level);
    char buf[vwrite_buffer_size];
    va_list saved_args;           // For re-format on buf overflow.
    va_copy(saved_args, args);


Thanks !

/Robbin

On 04/08/2016 02:28 PM, Robbin Ehn wrote:
> Hi all,
>
> Updated after reviews:
>
> diff -r 35cb720769c5 src/share/vm/logging/logTagSet.cpp
> --- a/src/share/vm/logging/logTagSet.cpp    Fri Apr 08 08:51:45 2016 +0200
> +++ b/src/share/vm/logging/logTagSet.cpp    Fri Apr 08 14:26:44 2016 +0200
> @@ -98,6 +98,7 @@
>   const size_t vwrite_buffer_size = 512;
>
>   void LogTagSet::vwrite(LogLevelType level, const char* fmt, va_list
> args) {
> +  assert(level >= LogLevel::Off && level <= LogLevel::Last, "Log
> level:%d is incorrect", level);
>     char buf[vwrite_buffer_size];
>     va_list saved_args;           // For re-format on buf overflow.
>     va_copy(saved_args, args);
>
> Thanks!
>
> /Robbin
>
> On 04/08/2016 01:54 PM, Robbin Ehn wrote:
>>
>> Hi all,
>>
>> Please review,
>>
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8153845
>>
>> Tested with jprt.
>>
>> diff -r 35cb720769c5 src/share/vm/logging/logTagSet.cpp
>> --- a/src/share/vm/logging/logTagSet.cpp    Fri Apr 08 08:51:45 2016
>> +0200
>> +++ b/src/share/vm/logging/logTagSet.cpp    Fri Apr 08 13:39:12 2016
>> +0200
>> @@ -98,6 +98,7 @@
>>   const size_t vwrite_buffer_size = 512;
>>
>>   void LogTagSet::vwrite(LogLevelType level, const char* fmt, va_list
>> args) {
>> +  assert(level >= LogLevel::Off && level < LogLevel::Count, "Log level
>> is incorrect");
>>     char buf[vwrite_buffer_size];
>>     va_list saved_args;           // For re-format on buf overflow.
>>     va_copy(saved_args, args);
>>
>>
>>
>> Thanks!
>>
>> /Robbin


More information about the serviceability-dev mailing list