Request for review: 8012695: Assertion message displays %u and %s text instead of actual values

Ioi Lam ioi.lam at oracle.com
Mon Apr 22 10:52:54 PDT 2013


It seems tedious that all callers of check_property have to pass in  
"...  in class file %s".

Also, if the "%s" is placed at the wrong place we could potentially 
crash inside printf().

How about this?

check_property(
     ...
       "outer_class_info_index %u has bad constant type in class file 
%s", outer_class_info_index ...)

->

check_property(
     ...
       "outer_class_info_index",  outer_class_info_index, "has bad 
constant type", ...)

This way the passed-in strings are treated as plain strings instead of 
printf formatters.

Thanks
- Ioi

On 04/22/2013 06:49 AM, harold seigel wrote:
> Hi,
>
> Please review this small fix for bug 8012695.
>
> Summary:   The fix uses err_msg() to create an assertion message 
> containing actual text instead of printf formatters.
>
> Open webrev at http://cr.openjdk.java.net/~hseigel/bug_8012695/ 
> <http://cr.openjdk.java.net/%7Ehseigel/bug_8012695/>
>
> Bug link at http://bugs.sun.com/view_bug.do?bug_id=8012695
>
> Regression testing was done using JCK Lang and VM tests and ute 
> vm.quick.testlist tests.  Also, assertion messages were generated to 
> ensure that the fix works:
>
> Old message:   # fatal error: Invalid field attribute index %u in 
> class file %s
>
> New message:  #  fatal error: Invalid code attribute name index 92 in 
> class file vm/mlvm/anonloader/share/AnonkTestee01
>
> Thank you!
> Harold



More information about the hotspot-runtime-dev mailing list