mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-27 06:45:07 +02:00
8122937: [JEP 245] Validate JVM Command-Line Flag Arguments
Validate the arguments to all JVM command-line flags so as to avoid crashes, and ensure that appropriate error messages are displayed when they are invalid. Reviewed-by: ddmitriev, dholmes, kbarrett, drwhite, brutisso, coleenp
This commit is contained in:
parent
ac072b303d
commit
ed2bb8c9fc
49 changed files with 2843 additions and 938 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2003, 2015, 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
|
||||
|
@ -32,6 +32,7 @@
|
|||
#include "services/memoryService.hpp"
|
||||
#include "utilities/dtrace.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
#include "utilities/defaultStream.hpp"
|
||||
|
||||
#ifdef DTRACE_ENABLED
|
||||
|
||||
|
@ -176,13 +177,12 @@ size_t ClassLoadingService::compute_class_size(InstanceKlass* k) {
|
|||
return class_size * oopSize;
|
||||
}
|
||||
|
||||
|
||||
bool ClassLoadingService::set_verbose(bool verbose) {
|
||||
MutexLocker m(Management_lock);
|
||||
|
||||
// verbose will be set to the previous value
|
||||
bool succeed = CommandLineFlags::boolAtPut((char*)"TraceClassLoading", &verbose, Flag::MANAGEMENT);
|
||||
assert(succeed, "Setting TraceClassLoading flag fails");
|
||||
Flag::Error error = CommandLineFlags::boolAtPut("TraceClassLoading", &verbose, Flag::MANAGEMENT);
|
||||
assert(error==Flag::SUCCESS, err_msg("Setting TraceClassLoading flag failed with error %s", Flag::flag_error_str(error)));
|
||||
reset_trace_class_unloading();
|
||||
|
||||
return verbose;
|
||||
|
@ -192,8 +192,8 @@ bool ClassLoadingService::set_verbose(bool verbose) {
|
|||
void ClassLoadingService::reset_trace_class_unloading() {
|
||||
assert(Management_lock->owned_by_self(), "Must own the Management_lock");
|
||||
bool value = MemoryService::get_verbose() || ClassLoadingService::get_verbose();
|
||||
bool succeed = CommandLineFlags::boolAtPut((char*)"TraceClassUnloading", &value, Flag::MANAGEMENT);
|
||||
assert(succeed, "Setting TraceClassUnLoading flag fails");
|
||||
Flag::Error error = CommandLineFlags::boolAtPut("TraceClassUnloading", &value, Flag::MANAGEMENT);
|
||||
assert(error==Flag::SUCCESS, err_msg("Setting TraceClassUnLoading flag failed with error %s", Flag::flag_error_str(error)));
|
||||
}
|
||||
|
||||
GrowableArray<KlassHandle>* LoadedClassesEnumerator::_loaded_classes = NULL;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue