-
Enhancement
-
Resolution: Fixed
-
P4
-
17
-
b17
We have many version of num_arguments for the DCmd subclasses. They all have identical structure. We should templatize them to reduce duplicated code and avoid cut-and-paste errors.
Examples:
int ThreadDumpDCmd::num_arguments() {
ResourceMark rm;
ThreadDumpDCmd* dcmd = new ThreadDumpDCmd(NULL, false);
if (dcmd != NULL) {
DCmdMark mark(dcmd);
return dcmd->_dcmdparser.num_arguments();
} else {
return 0;
}
}
int JMXStartRemoteDCmd::num_arguments() {
ResourceMark rm;
JMXStartRemoteDCmd* dcmd = new JMXStartRemoteDCmd(NULL, false);
if (dcmd != NULL) {
DCmdMark mark(dcmd);
return dcmd->_dcmdparser.num_arguments();
} else {
return 0;
}
}
Examples:
int ThreadDumpDCmd::num_arguments() {
ResourceMark rm;
ThreadDumpDCmd* dcmd = new ThreadDumpDCmd(NULL, false);
if (dcmd != NULL) {
DCmdMark mark(dcmd);
return dcmd->_dcmdparser.num_arguments();
} else {
return 0;
}
}
int JMXStartRemoteDCmd::num_arguments() {
ResourceMark rm;
JMXStartRemoteDCmd* dcmd = new JMXStartRemoteDCmd(NULL, false);
if (dcmd != NULL) {
DCmdMark mark(dcmd);
return dcmd->_dcmdparser.num_arguments();
} else {
return 0;
}
}
- relates to
-
JDK-8277029 JMM GetDiagnosticXXXInfo APIs should verify output array sizes
-
- Resolved
-