Mercurial > hg > graal-compiler
diff src/share/vm/services/diagnosticArgument.cpp @ 4849:520830f632e7
7131346: Parsing of boolean arguments to diagnostic commands is broken
Reviewed-by: dholmes, dcubed
author | fparain |
---|---|
date | Wed, 25 Jan 2012 10:32:29 -0800 |
parents | 3b688d6ff3d0 |
children | f1cb6f9cfe21 |
line wrap: on
line diff
--- a/src/share/vm/services/diagnosticArgument.cpp Wed Jan 25 01:16:03 2012 -0800 +++ b/src/share/vm/services/diagnosticArgument.cpp Wed Jan 25 10:32:29 2012 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2012 Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,12 +59,13 @@ template <> void DCmdArgument<bool>::parse_value(const char* str, size_t len, TRAPS) { + // len is the length of the current token starting at str if (len == 0) { set_value(true); } else { - if (strcasecmp(str, "true") == 0) { + if (len == strlen("true") && strncasecmp(str, "true", len) == 0) { set_value(true); - } else if (strcasecmp(str, "false") == 0) { + } else if (len == strlen("false") && strncasecmp(str, "false", len) == 0) { set_value(false); } else { THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),