< prev index next >
src/share/vm/services/attachListener.cpp
Print this page
@@ -1,7 +1,7 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2016, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
@@ -269,18 +269,22 @@
}
// set a uintx global flag using value from AttachOperation
static jint set_uintx_flag(const char* name, AttachOperation* op, outputStream* out) {
uintx value;
- const char* arg1;
- if ((arg1 = op->arg(1)) != NULL) {
+
+ const char* arg1 = op->arg(1);
+ if (arg1 == NULL) {
+ out->print_cr("flag value must be specified");
+ return JNI_ERR;
+ }
+
int n = sscanf(arg1, UINTX_FORMAT, &value);
if (n != 1) {
out->print_cr("flag value must be an unsigned integer");
return JNI_ERR;
}
- }
if (strncmp(name, "MaxHeapFreeRatio", 17) == 0) {
FormatBuffer<80> err_msg("%s", "");
if (!Arguments::verify_MaxHeapFreeRatio(err_msg, value)) {
out->print_cr("%s", err_msg.buffer());
< prev index next >